From ac48ee9aaed6f3622ed0073de4757e0608f9fe81 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Wed, 10 Mar 2010 23:09:39 +0100 Subject: [PATCH] Directly jump to server view on click and watch the client connecting --- src/org/yaaic/view/ServersActivity.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/org/yaaic/view/ServersActivity.java b/src/org/yaaic/view/ServersActivity.java index ed48d0a..e93ae67 100644 --- a/src/org/yaaic/view/ServersActivity.java +++ b/src/org/yaaic/view/ServersActivity.java @@ -118,20 +118,15 @@ public class ServersActivity extends ListActivity implements ServiceConnection, */ @Override protected void onListItemClick(ListView l, View v, int position, long id) { - final Server server = adapter.getItem(position); + Server server = adapter.getItem(position); - switch (server.getStatus()) { - case Status.DISCONNECTED: - server.setStatus(Status.CONNECTING); - adapter.notifyDataSetChanged(); - binder.connect(server); - break; - case Status.CONNECTED: - Intent intent = new Intent(this, ServerActivity.class); - intent.putExtra("serverId", server.getId()); - startActivityForResult(intent, 0); - break; - } + server.setStatus(Status.CONNECTING); + adapter.notifyDataSetChanged(); + binder.connect(server); + + Intent intent = new Intent(this, ServerActivity.class); + intent.putExtra("serverId", server.getId()); + startActivityForResult(intent, 0); } /**