From 8766f785a0b2f18228710adf8074afba33943283 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Sat, 17 Apr 2010 23:08:47 +0200 Subject: [PATCH] ConversationActivity: Only show reconnect popup if automatic reconnect is disabled --- .../yaaic/activity/ConversationActivity.java | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/org/yaaic/activity/ConversationActivity.java b/src/org/yaaic/activity/ConversationActivity.java index 21872c7..e6135ba 100644 --- a/src/org/yaaic/activity/ConversationActivity.java +++ b/src/org/yaaic/activity/ConversationActivity.java @@ -386,28 +386,30 @@ public class ConversationActivity extends Activity implements ServiceConnection, input.setEnabled(true); } else { input.setEnabled(false); - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage("You disconnected from " + server.getTitle() + ". Do you want to reconnect?") - .setCancelable(false) - .setPositiveButton("Yes", new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - binder.getService().getConnection(server.getId()).setAutojoinChannels( - server.getCurrentChannelNames() - ); - server.clearConversations(); - deckAdapter.clearConversations(); - deckAdapter.addItem(server.getConversation(ServerInfo.DEFAULT_NAME)); - binder.connect(server); - } - }) - .setNegativeButton("No", new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); - AlertDialog alert = builder.create(); - alert.show(); + + if (!binder.getService().getSettings().isReconnectEnabled()) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage("You disconnected from " + server.getTitle() + ". Do you want to reconnect?") + .setCancelable(false) + .setPositiveButton("Yes", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + binder.getService().getConnection(server.getId()).setAutojoinChannels( + server.getCurrentChannelNames() + ); + server.clearConversations(); + deckAdapter.clearConversations(); + deckAdapter.addItem(server.getConversation(ServerInfo.DEFAULT_NAME)); + binder.connect(server); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + } } }