fixed add account dialog showing up multiple times

This commit is contained in:
Daniel Gultsch 2014-04-01 23:16:19 +02:00
parent fdca690734
commit d53dc28f4c
2 changed files with 6 additions and 3 deletions

View file

@ -49,6 +49,7 @@
<activity <activity
android:name="eu.siacs.conversations.ui.ManageAccountActivity" android:name="eu.siacs.conversations.ui.ManageAccountActivity"
android:label="Manage Accounts" android:label="Manage Accounts"
android:configChanges="orientation|screenSize"
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" > android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
</activity> </activity>
<activity <activity

View file

@ -12,7 +12,6 @@ import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ClipData.Item;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
@ -44,6 +43,8 @@ public class ManageAccountActivity extends XmppActivity {
protected Account selectedAccountForActionMode = null; protected Account selectedAccountForActionMode = null;
protected ManageAccountActivity activity = this; protected ManageAccountActivity activity = this;
protected boolean firstrun = true;
protected List<Account> accountList = new ArrayList<Account>(); protected List<Account> accountList = new ArrayList<Account>();
protected ListView accountListView; protected ListView accountListView;
protected ArrayAdapter<Account> accountListViewAdapter; protected ArrayAdapter<Account> accountListViewAdapter;
@ -201,7 +202,7 @@ public class ManageAccountActivity extends XmppActivity {
activity.xmppConnectionService.reconnectAccount(accountList.get(position),true); activity.xmppConnectionService.reconnectAccount(accountList.get(position),true);
} else if (account.getStatus() == Account.STATUS_ONLINE) { } else if (account.getStatus() == Account.STATUS_ONLINE) {
activity.startActivity(new Intent(activity.getApplicationContext(),ContactsActivity.class)); activity.startActivity(new Intent(activity.getApplicationContext(),ContactsActivity.class));
} else if (account.isOptionSet(Account.OPTION_REGISTER)) { } else if (account.getStatus() != Account.STATUS_DISABLED) {
editAccount(account); editAccount(account);
} }
} else { } else {
@ -382,9 +383,10 @@ public class ManageAccountActivity extends XmppActivity {
this.accountList.clear(); this.accountList.clear();
this.accountList.addAll(xmppConnectionService.getAccounts()); this.accountList.addAll(xmppConnectionService.getAccounts());
accountListViewAdapter.notifyDataSetChanged(); accountListViewAdapter.notifyDataSetChanged();
if (this.accountList.size() == 0) { if ((this.accountList.size() == 0)&&(this.firstrun)) {
getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(false);
addAccount(); addAccount();
this.firstrun = false;
} }
} }