Imediately switch to remote when selecting a new host

This commit is contained in:
Synced Synapse 2015-02-01 15:50:37 +00:00
parent 9b786a6012
commit 9b17da2800
1 changed files with 26 additions and 20 deletions

View File

@ -105,26 +105,32 @@ public class HostListFragment extends Fragment {
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;
// }
}
});