Add a PC menu header to show PC status

This commit is contained in:
Cameron Gutman
2020-12-13 13:05:36 -06:00
parent ab0531aa76
commit f26b384697
2 changed files with 19 additions and 0 deletions

View File

@@ -317,6 +317,22 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position);
// Add a header with PC status details
menu.clearHeader();
switch (computer.details.state)
{
case ONLINE:
menu.setHeaderTitle(R.string.pcview_menu_header_online);
break;
case OFFLINE:
menu.setHeaderIcon(R.drawable.ic_pc_offline);
menu.setHeaderTitle(R.string.pcview_menu_header_offline);
break;
case UNKNOWN:
menu.setHeaderTitle(R.string.pcview_menu_header_unknown);
break;
}
// Inflate the context menu
if (computer.details.state == ComputerDetails.State.OFFLINE ||
computer.details.state == ComputerDetails.State.UNKNOWN) {