Skip to content

Commit

Permalink
Imediately switch to remote when selecting a new host
Browse files Browse the repository at this point in the history
  • Loading branch information
SyncedSynapse committed Feb 1, 2015
1 parent 9b786a6 commit 9b17da2
Showing 1 changed file with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,32 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
public void onItemClick(AdapterView<?> parent, View view, int position, long itemId) {
HostInfoRow clickedHostRow = hostInfoRows.get(position);

switch (clickedHostRow.status) {
case HostInfoRow.HOST_STATUS_CONNECTING:
// Jsut switch the host
hostManager.switchHost(clickedHostRow.hostInfo);
break;
case HostInfoRow.HOST_STATUS_AVAILABLE:
// Set the clicked host active
hostManager.switchHost(clickedHostRow.hostInfo);
Intent intent = new Intent(context, RemoteActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(intent);
break;
case HostInfoRow.HOST_STATUS_UNAVAILABLE:
hostManager.switchHost(clickedHostRow.hostInfo);
// Check host status again
clickedHostRow.status = HostInfoRow.HOST_STATUS_CONNECTING;
adapter.notifyDataSetChanged();
updateHostStatus(clickedHostRow);
break;
}
// Set the clicked host active
hostManager.switchHost(clickedHostRow.hostInfo);
Intent intent = new Intent(context, RemoteActivity.class);
context.startActivity(intent);


// switch (clickedHostRow.status) {
// case HostInfoRow.HOST_STATUS_CONNECTING:
// // Jsut switch the host
// hostManager.switchHost(clickedHostRow.hostInfo);
// break;
// case HostInfoRow.HOST_STATUS_AVAILABLE:
// // Set the clicked host active
// hostManager.switchHost(clickedHostRow.hostInfo);
// Intent intent = new Intent(context, RemoteActivity.class)
// .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// context.startActivity(intent);
// break;
// case HostInfoRow.HOST_STATUS_UNAVAILABLE:
// hostManager.switchHost(clickedHostRow.hostInfo);
// // Check host status again
// clickedHostRow.status = HostInfoRow.HOST_STATUS_CONNECTING;
// adapter.notifyDataSetChanged();
// updateHostStatus(clickedHostRow);
// break;
// }
}
});

Expand Down

0 comments on commit 9b17da2

Please sign in to comment.