From 8bfe1d1a75cd17f0e2dcb60b2016ac9ed4357fc9 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Sun, 21 Mar 2010 15:26:11 +0100 Subject: [PATCH] Bugfix: Do not try to connect on resume --- src/org/yaaic/model/Server.java | 1 + src/org/yaaic/model/Status.java | 1 + src/org/yaaic/view/ConversationActivity.java | 4 +++- src/org/yaaic/view/ServersActivity.java | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/org/yaaic/model/Server.java b/src/org/yaaic/model/Server.java index 1b4fe2e..2c42cea 100644 --- a/src/org/yaaic/model/Server.java +++ b/src/org/yaaic/model/Server.java @@ -296,6 +296,7 @@ public class Server return R.drawable.connected; case Status.DISCONNECTED: return R.drawable.disconnected; + case Status.PRE_CONNECTING: case Status.CONNECTING: return R.drawable.connecting; } diff --git a/src/org/yaaic/model/Status.java b/src/org/yaaic/model/Status.java index 97a82e0..3c22c61 100644 --- a/src/org/yaaic/model/Status.java +++ b/src/org/yaaic/model/Status.java @@ -29,4 +29,5 @@ public class Status { public static final int DISCONNECTED = 0; public static final int CONNECTING = 1; public static final int CONNECTED = 2; + public static final int PRE_CONNECTING = 3; } diff --git a/src/org/yaaic/view/ConversationActivity.java b/src/org/yaaic/view/ConversationActivity.java index 4af0bca..e8874b2 100644 --- a/src/org/yaaic/view/ConversationActivity.java +++ b/src/org/yaaic/view/ConversationActivity.java @@ -59,6 +59,7 @@ import org.yaaic.model.Broadcast; import org.yaaic.model.Conversation; import org.yaaic.model.Message; import org.yaaic.model.Server; +import org.yaaic.model.Status; import org.yaaic.receiver.ConversationReceiver; import org.yaaic.receiver.ServerReceiver; @@ -170,7 +171,8 @@ public class ConversationActivity extends Activity implements ServiceConnection, this.binder = (IRCBinder) service; // connect to irc server if connect has been requested - if (!server.isConnected() && getIntent().hasExtra("connect")) { + if (server.getStatus() == Status.PRE_CONNECTING && getIntent().hasExtra("connect")) { + server.setStatus(Status.CONNECTING); binder.connect(server); } } diff --git a/src/org/yaaic/view/ServersActivity.java b/src/org/yaaic/view/ServersActivity.java index 7e198a8..061500b 100644 --- a/src/org/yaaic/view/ServersActivity.java +++ b/src/org/yaaic/view/ServersActivity.java @@ -137,7 +137,7 @@ public class ServersActivity extends ListActivity implements ServiceConnection, Intent intent = new Intent(this, ConversationActivity.class); if (server.getStatus() == Status.DISCONNECTED) { - server.setStatus(Status.CONNECTING); + server.setStatus(Status.PRE_CONNECTING); intent.putExtra("connect", true); }