aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/ui/ManageAccountActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/ui/ManageAccountActivity.java')
-rw-r--r--src/eu/siacs/conversations/ui/ManageAccountActivity.java562
1 files changed, 336 insertions, 226 deletions
diff --git a/src/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/eu/siacs/conversations/ui/ManageAccountActivity.java
index 7e5a60c5..c3f1e105 100644
--- a/src/eu/siacs/conversations/ui/ManageAccountActivity.java
+++ b/src/eu/siacs/conversations/ui/ManageAccountActivity.java
@@ -5,6 +5,7 @@ import java.util.List;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
+import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
import eu.siacs.conversations.ui.EditAccount.EditAccountListener;
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
import eu.siacs.conversations.xmpp.XmppConnection;
@@ -31,21 +32,21 @@ import android.widget.ListView;
import android.widget.TextView;
public class ManageAccountActivity extends XmppActivity {
-
+
protected boolean isActionMode = false;
protected ActionMode actionMode;
protected Account selectedAccountForActionMode = null;
protected ManageAccountActivity activity = this;
-
+
protected boolean firstrun = true;
-
+
protected List<Account> accountList = new ArrayList<Account>();
protected ListView accountListView;
protected ArrayAdapter<Account> accountListViewAdapter;
- protected OnAccountListChangedListener accountChanged = new OnAccountListChangedListener() {
+ protected OnAccountUpdate accountChanged = new OnAccountUpdate() {
@Override
- public void onAccountListChangedListener() {
+ public void onAccountUpdate() {
accountList.clear();
accountList.addAll(xmppConnectionService.getAccounts());
runOnUiThread(new Runnable() {
@@ -57,47 +58,55 @@ public class ManageAccountActivity extends XmppActivity {
});
}
};
-
+
protected OnTLSExceptionReceived tlsExceptionReceived = new OnTLSExceptionReceived() {
-
+
@Override
- public void onTLSExceptionReceived(final String fingerprint, final Account account) {
+ public void onTLSExceptionReceived(final String fingerprint,
+ final Account account) {
activity.runOnUiThread(new Runnable() {
-
+
@Override
public void run() {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ activity);
builder.setTitle(getString(R.string.account_status_error));
builder.setIconAttribute(android.R.attr.alertDialogIcon);
- View view = (View) getLayoutInflater().inflate(R.layout.cert_warning, null);
+ View view = (View) getLayoutInflater().inflate(
+ R.layout.cert_warning, null);
TextView sha = (TextView) view.findViewById(R.id.sha);
TextView hint = (TextView) view.findViewById(R.id.hint);
StringBuilder humanReadableSha = new StringBuilder();
humanReadableSha.append(fingerprint);
- for(int i = 2; i < 59; i += 3) {
- if ((i==14)||(i==29)||(i==44)) {
+ for (int i = 2; i < 59; i += 3) {
+ if ((i == 14) || (i == 29) || (i == 44)) {
humanReadableSha.insert(i, "\n");
} else {
humanReadableSha.insert(i, ":");
}
-
+
}
- hint.setText(getString(R.string.untrusted_cert_hint,account.getServer()));
+ hint.setText(getString(R.string.untrusted_cert_hint,
+ account.getServer()));
sha.setText(humanReadableSha.toString());
builder.setView(view);
- builder.setNegativeButton(getString(R.string.certif_no_trust), null);
- builder.setPositiveButton(getString(R.string.certif_trust), new OnClickListener() {
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- account.setSSLCertFingerprint(fingerprint);
- activity.xmppConnectionService.updateAccount(account);
- }
- });
+ builder.setNegativeButton(
+ getString(R.string.certif_no_trust), null);
+ builder.setPositiveButton(getString(R.string.certif_trust),
+ new OnClickListener() {
+
+ @Override
+ public void onClick(DialogInterface dialog,
+ int which) {
+ account.setSSLCertFingerprint(fingerprint);
+ activity.xmppConnectionService
+ .updateAccount(account);
+ }
+ });
builder.create().show();
}
});
-
+
}
};
@@ -124,55 +133,68 @@ public class ManageAccountActivity extends XmppActivity {
.findViewById(R.id.account_status);
switch (account.getStatus()) {
case Account.STATUS_DISABLED:
- statusView.setText(getString(R.string.account_status_disabled));
+ statusView
+ .setText(getString(R.string.account_status_disabled));
statusView.setTextColor(0xFF1da9da);
break;
case Account.STATUS_ONLINE:
- statusView.setText(getString(R.string.account_status_online));
+ statusView
+ .setText(getString(R.string.account_status_online));
statusView.setTextColor(0xFF83b600);
break;
case Account.STATUS_CONNECTING:
- statusView.setText(getString(R.string.account_status_connecting));
+ statusView
+ .setText(getString(R.string.account_status_connecting));
statusView.setTextColor(0xFF1da9da);
break;
case Account.STATUS_OFFLINE:
- statusView.setText(getString(R.string.account_status_offline));
+ statusView
+ .setText(getString(R.string.account_status_offline));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_UNAUTHORIZED:
- statusView.setText(getString(R.string.account_status_unauthorized));
+ statusView
+ .setText(getString(R.string.account_status_unauthorized));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_SERVER_NOT_FOUND:
- statusView.setText(getString(R.string.account_status_not_found));
+ statusView
+ .setText(getString(R.string.account_status_not_found));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_NO_INTERNET:
- statusView.setText(getString(R.string.account_status_no_internet));
+ statusView
+ .setText(getString(R.string.account_status_no_internet));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_SERVER_REQUIRES_TLS:
- statusView.setText(getString(R.string.account_status_requires_tls));
+ statusView
+ .setText(getString(R.string.account_status_requires_tls));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_TLS_ERROR:
- statusView.setText(getString(R.string.account_status_error));
+ statusView
+ .setText(getString(R.string.account_status_error));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_REGISTRATION_FAILED:
- statusView.setText(getString(R.string.account_status_regis_fail));
+ statusView
+ .setText(getString(R.string.account_status_regis_fail));
statusView.setTextColor(0xFFe92727);
break;
case Account.STATUS_REGISTRATION_CONFLICT:
- statusView.setText(getString(R.string.account_status_regis_conflict));
+ statusView
+ .setText(getString(R.string.account_status_regis_conflict));
statusView.setTextColor(0xFFe92727);
break;
- case Account.STATUS_REGISTRATION_SUCCESSFULL:
- statusView.setText(getString(R.string.account_status_regis_success));
+ case Account.STATUS_REGISTRATION_SUCCESSFULL:
+ statusView
+ .setText(getString(R.string.account_status_regis_success));
statusView.setTextColor(0xFF83b600);
break;
case Account.STATUS_REGISTRATION_NOT_SUPPORTED:
- statusView.setText(getString(R.string.account_status_regis_not_sup));
+ statusView
+ .setText(getString(R.string.account_status_regis_not_sup));
statusView.setTextColor(0xFFe92727);
break;
default:
@@ -192,10 +214,14 @@ public class ManageAccountActivity extends XmppActivity {
int position, long arg3) {
if (!isActionMode) {
Account account = accountList.get(position);
- if ((account.getStatus() == Account.STATUS_OFFLINE)||(account.getStatus() == Account.STATUS_TLS_ERROR)) {
- activity.xmppConnectionService.reconnectAccount(accountList.get(position),true);
+ if ((account.getStatus() == Account.STATUS_OFFLINE)
+ || (account.getStatus() == Account.STATUS_TLS_ERROR)) {
+ activity.xmppConnectionService.reconnectAccount(
+ accountList.get(position), true);
} else if (account.getStatus() == Account.STATUS_ONLINE) {
- activity.startActivity(new Intent(activity.getApplicationContext(),StartConversation.class));
+ activity.startActivity(new Intent(activity
+ .getApplicationContext(),
+ StartConversation.class));
} else if (account.getStatus() != Account.STATUS_DISABLED) {
editAccount(account);
}
@@ -205,159 +231,242 @@ public class ManageAccountActivity extends XmppActivity {
}
}
});
- accountListView.setOnItemLongClickListener(new OnItemLongClickListener() {
+ accountListView
+ .setOnItemLongClickListener(new OnItemLongClickListener() {
- @Override
- public boolean onItemLongClick(AdapterView<?> arg0, View view,
- int position, long arg3) {
- if (!isActionMode) {
- accountListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
- accountListView.setItemChecked(position,true);
- selectedAccountForActionMode = accountList.get(position);
- actionMode = activity.startActionMode((new ActionMode.Callback() {
-
- @Override
- public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
- if (selectedAccountForActionMode.isOptionSet(Account.OPTION_DISABLED)) {
- menu.findItem(R.id.mgmt_account_enable).setVisible(true);
- menu.findItem(R.id.mgmt_account_disable).setVisible(false);
- } else {
- menu.findItem(R.id.mgmt_account_disable).setVisible(true);
- menu.findItem(R.id.mgmt_account_enable).setVisible(false);
- }
- return true;
- }
-
- @Override
- public void onDestroyActionMode(ActionMode mode) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean onCreateActionMode(ActionMode mode, Menu menu) {
- MenuInflater inflater = mode.getMenuInflater();
- inflater.inflate(R.menu.manageaccounts_context, menu);
- return true;
- }
-
- @Override
- public boolean onActionItemClicked(final ActionMode mode, MenuItem item) {
- if (item.getItemId()==R.id.mgmt_account_edit) {
- editAccount(selectedAccountForActionMode);
- } else if (item.getItemId()==R.id.mgmt_account_disable) {
- selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, true);
- xmppConnectionService.updateAccount(selectedAccountForActionMode);
- mode.finish();
- } else if (item.getItemId()==R.id.mgmt_account_enable) {
- selectedAccountForActionMode.setOption(Account.OPTION_DISABLED, false);
- xmppConnectionService.updateAccount(selectedAccountForActionMode);
- mode.finish();
- } else if (item.getItemId()==R.id.mgmt_account_delete) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setTitle(getString(R.string.mgmt_account_are_you_sure));
- builder.setIconAttribute(android.R.attr.alertDialogIcon);
- builder.setMessage(getString(R.string.mgmt_account_delete_confirm_text));
- builder.setPositiveButton(getString(R.string.delete), new OnClickListener() {
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- xmppConnectionService.deleteAccount(selectedAccountForActionMode);
- selectedAccountForActionMode = null;
- mode.finish();
- }
- });
- builder.setNegativeButton(getString(R.string.cancel),null);
- builder.create().show();
- } else if (item.getItemId()==R.id.mgmt_account_announce_pgp) {
- if (activity.hasPgp()) {
- mode.finish();
- announcePgp(selectedAccountForActionMode,null);
- } else {
- activity.showInstallPgpDialog();
- }
- } else if (item.getItemId() == R.id.mgmt_otr_key) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setTitle("OTR Fingerprint");
- String fingerprintTxt = selectedAccountForActionMode.getOtrFingerprint(getApplicationContext());
- View view = (View) getLayoutInflater().inflate(R.layout.otr_fingerprint, null);
- if (fingerprintTxt!=null) {
- TextView fingerprint = (TextView) view.findViewById(R.id.otr_fingerprint);
- TextView noFingerprintView = (TextView) view.findViewById(R.id.otr_no_fingerprint);
- fingerprint.setText(fingerprintTxt);
- fingerprint.setVisibility(View.VISIBLE);
- noFingerprintView.setVisibility(View.GONE);
- }
- builder.setView(view);
- builder.setPositiveButton(getString(R.string.done), null);
- builder.create().show();
- } else if (item.getItemId() == R.id.mgmt_account_info) {
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setTitle(getString(R.string.account_info));
- if (selectedAccountForActionMode.getStatus() == Account.STATUS_ONLINE) {
- XmppConnection xmpp = selectedAccountForActionMode.getXmppConnection();
- long connectionAge = (SystemClock.elapsedRealtime() - xmpp.lastConnect) / 60000;
- long sessionAge = (SystemClock.elapsedRealtime() - xmpp.lastSessionStarted) / 60000;
- long connectionAgeHours = connectionAge / 60;
- long sessionAgeHours = sessionAge / 60;
- View view = (View) getLayoutInflater().inflate(R.layout.server_info, null);
- TextView connection = (TextView) view.findViewById(R.id.connection);
- TextView session = (TextView) view.findViewById(R.id.session);
- TextView pcks_sent = (TextView) view.findViewById(R.id.pcks_sent);
- TextView pcks_received = (TextView) view.findViewById(R.id.pcks_received);
- TextView carbon = (TextView) view.findViewById(R.id.carbon);
- TextView stream = (TextView) view.findViewById(R.id.stream);
- TextView roster = (TextView) view.findViewById(R.id.roster);
- TextView presences = (TextView) view.findViewById(R.id.number_presences);
- presences.setText(selectedAccountForActionMode.countPresences()+"");
- pcks_received.setText(""+xmpp.getReceivedStanzas());
- pcks_sent.setText(""+xmpp.getSentStanzas());
- if (connectionAgeHours >= 2) {
- connection.setText(connectionAgeHours+" " + getString(R.string.hours));
- } else {
- connection.setText(connectionAge+" " + getString(R.string.mins));
- }
- if (xmpp.hasFeatureStreamManagment()) {
- if (sessionAgeHours >= 2) {
- session.setText(sessionAgeHours+" " + getString(R.string.hours));
- } else {
- session.setText(sessionAge+" " + getString(R.string.mins));
+ @Override
+ public boolean onItemLongClick(AdapterView<?> arg0,
+ View view, int position, long arg3) {
+ if (!isActionMode) {
+ accountListView
+ .setChoiceMode(ListView.CHOICE_MODE_SINGLE);
+ accountListView.setItemChecked(position, true);
+ selectedAccountForActionMode = accountList
+ .get(position);
+ actionMode = activity
+ .startActionMode((new ActionMode.Callback() {
+
+ @Override
+ public boolean onPrepareActionMode(
+ ActionMode mode, Menu menu) {
+ if (selectedAccountForActionMode
+ .isOptionSet(Account.OPTION_DISABLED)) {
+ menu.findItem(
+ R.id.mgmt_account_enable)
+ .setVisible(true);
+ menu.findItem(
+ R.id.mgmt_account_disable)
+ .setVisible(false);
+ } else {
+ menu.findItem(
+ R.id.mgmt_account_disable)
+ .setVisible(true);
+ menu.findItem(
+ R.id.mgmt_account_enable)
+ .setVisible(false);
+ }
+ return true;
}
- stream.setText(getString(R.string.yes));
- } else {
- stream.setText(getString(R.string.no));
- session.setText(connection.getText());
- }
- if (xmpp.hasFeaturesCarbon()) {
- carbon.setText(getString(R.string.yes));
- } else {
- carbon.setText(getString(R.string.no));
- }
- if (xmpp.hasFeatureRosterManagment()) {
- roster.setText(getString(R.string.yes));
- } else {
- roster.setText(getString(R.string.no));
- }
- builder.setView(view);
- } else {
- builder.setMessage(getString(R.string.mgmt_account_account_offline));
- }
- builder.setPositiveButton(getString(R.string.hide), null);
- builder.create().show();
- }
+
+ @Override
+ public void onDestroyActionMode(
+ ActionMode mode) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean onCreateActionMode(
+ ActionMode mode, Menu menu) {
+ MenuInflater inflater = mode
+ .getMenuInflater();
+ inflater.inflate(
+ R.menu.manageaccounts_context,
+ menu);
+ return true;
+ }
+
+ @Override
+ public boolean onActionItemClicked(
+ final ActionMode mode,
+ MenuItem item) {
+ if (item.getItemId() == R.id.mgmt_account_edit) {
+ editAccount(selectedAccountForActionMode);
+ } else if (item.getItemId() == R.id.mgmt_account_disable) {
+ selectedAccountForActionMode
+ .setOption(
+ Account.OPTION_DISABLED,
+ true);
+ xmppConnectionService
+ .updateAccount(selectedAccountForActionMode);
+ mode.finish();
+ } else if (item.getItemId() == R.id.mgmt_account_enable) {
+ selectedAccountForActionMode
+ .setOption(
+ Account.OPTION_DISABLED,
+ false);
+ xmppConnectionService
+ .updateAccount(selectedAccountForActionMode);
+ mode.finish();
+ } else if (item.getItemId() == R.id.mgmt_account_delete) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ activity);
+ builder.setTitle(getString(R.string.mgmt_account_are_you_sure));
+ builder.setIconAttribute(android.R.attr.alertDialogIcon);
+ builder.setMessage(getString(R.string.mgmt_account_delete_confirm_text));
+ builder.setPositiveButton(
+ getString(R.string.delete),
+ new OnClickListener() {
+
+ @Override
+ public void onClick(
+ DialogInterface dialog,
+ int which) {
+ xmppConnectionService
+ .deleteAccount(selectedAccountForActionMode);
+ selectedAccountForActionMode = null;
+ mode.finish();
+ }
+ });
+ builder.setNegativeButton(
+ getString(R.string.cancel),
+ null);
+ builder.create().show();
+ } else if (item.getItemId() == R.id.mgmt_account_announce_pgp) {
+ if (activity.hasPgp()) {
+ mode.finish();
+ announcePgp(
+ selectedAccountForActionMode,
+ null);
+ } else {
+ activity.showInstallPgpDialog();
+ }
+ } else if (item.getItemId() == R.id.mgmt_otr_key) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ activity);
+ builder.setTitle("OTR Fingerprint");
+ String fingerprintTxt = selectedAccountForActionMode
+ .getOtrFingerprint(getApplicationContext());
+ View view = (View) getLayoutInflater()
+ .inflate(
+ R.layout.otr_fingerprint,
+ null);
+ if (fingerprintTxt != null) {
+ TextView fingerprint = (TextView) view
+ .findViewById(R.id.otr_fingerprint);
+ TextView noFingerprintView = (TextView) view
+ .findViewById(R.id.otr_no_fingerprint);
+ fingerprint
+ .setText(fingerprintTxt);
+ fingerprint
+ .setVisibility(View.VISIBLE);
+ noFingerprintView
+ .setVisibility(View.GONE);
+ }
+ builder.setView(view);
+ builder.setPositiveButton(
+ getString(R.string.done),
+ null);
+ builder.create().show();
+ } else if (item.getItemId() == R.id.mgmt_account_info) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(
+ activity);
+ builder.setTitle(getString(R.string.account_info));
+ if (selectedAccountForActionMode
+ .getStatus() == Account.STATUS_ONLINE) {
+ XmppConnection xmpp = selectedAccountForActionMode
+ .getXmppConnection();
+ long connectionAge = (SystemClock
+ .elapsedRealtime() - xmpp.lastConnect) / 60000;
+ long sessionAge = (SystemClock
+ .elapsedRealtime() - xmpp.lastSessionStarted) / 60000;
+ long connectionAgeHours = connectionAge / 60;
+ long sessionAgeHours = sessionAge / 60;
+ View view = (View) getLayoutInflater()
+ .inflate(
+ R.layout.server_info,
+ null);
+ TextView connection = (TextView) view
+ .findViewById(R.id.connection);
+ TextView session = (TextView) view
+ .findViewById(R.id.session);
+ TextView pcks_sent = (TextView) view
+ .findViewById(R.id.pcks_sent);
+ TextView pcks_received = (TextView) view
+ .findViewById(R.id.pcks_received);
+ TextView carbon = (TextView) view
+ .findViewById(R.id.carbon);
+ TextView stream = (TextView) view
+ .findViewById(R.id.stream);
+ TextView roster = (TextView) view
+ .findViewById(R.id.roster);
+ TextView presences = (TextView) view
+ .findViewById(R.id.number_presences);
+ presences.setText(selectedAccountForActionMode
+ .countPresences()
+ + "");
+ pcks_received.setText(""
+ + xmpp.getReceivedStanzas());
+ pcks_sent.setText(""
+ + xmpp.getSentStanzas());
+ if (connectionAgeHours >= 2) {
+ connection
+ .setText(connectionAgeHours
+ + " "
+ + getString(R.string.hours));
+ } else {
+ connection
+ .setText(connectionAge
+ + " "
+ + getString(R.string.mins));
+ }
+ if (xmpp.hasFeatureStreamManagment()) {
+ if (sessionAgeHours >= 2) {
+ session.setText(sessionAgeHours
+ + " "
+ + getString(R.string.hours));
+ } else {
+ session.setText(sessionAge
+ + " "
+ + getString(R.string.mins));
+ }
+ stream.setText(getString(R.string.yes));
+ } else {
+ stream.setText(getString(R.string.no));
+ session.setText(connection
+ .getText());
+ }
+ if (xmpp.hasFeaturesCarbon()) {
+ carbon.setText(getString(R.string.yes));
+ } else {
+ carbon.setText(getString(R.string.no));
+ }
+ if (xmpp.hasFeatureRosterManagment()) {
+ roster.setText(getString(R.string.yes));
+ } else {
+ roster.setText(getString(R.string.no));
+ }
+ builder.setView(view);
+ } else {
+ builder.setMessage(getString(R.string.mgmt_account_account_offline));
+ }
+ builder.setPositiveButton(
+ getString(R.string.hide),
+ null);
+ builder.create().show();
+ }
+ return true;
+ }
+
+ }));
return true;
+ } else {
+ return false;
}
-
-
- }));
- return true;
- } else {
- return false;
- }
- }
- });
+ }
+ });
}
-
+
@Override
protected void onStop() {
if (xmppConnectionServiceBound) {
@@ -370,11 +479,12 @@ public class ManageAccountActivity extends XmppActivity {
@Override
void onBackendConnected() {
xmppConnectionService.setOnAccountListChangedListener(accountChanged);
- xmppConnectionService.setOnTLSExceptionReceivedListener(tlsExceptionReceived);
+ xmppConnectionService
+ .setOnTLSExceptionReceivedListener(tlsExceptionReceived);
this.accountList.clear();
this.accountList.addAll(xmppConnectionService.getAccounts());
accountListViewAdapter.notifyDataSetChanged();
- if ((this.accountList.size() == 0)&&(this.firstrun)) {
+ if ((this.accountList.size() == 0) && (this.firstrun)) {
getActionBar().setDisplayHomeAsUpEnabled(false);
getActionBar().setHomeButtonEnabled(false);
addAccount();
@@ -405,12 +515,13 @@ public class ManageAccountActivity extends XmppActivity {
if (xmppConnectionService.getConversations().size() == 0) {
Intent contactsIntent = new Intent(this, StartConversation.class);
contactsIntent.setFlags(
- // if activity exists in stack, pop the stack and go back to it
+ // if activity exists in stack, pop the stack and go back to it
Intent.FLAG_ACTIVITY_CLEAR_TOP |
// otherwise, make a new task for it
- Intent.FLAG_ACTIVITY_NEW_TASK |
- // don't use the new activity animation; finish animation runs instead
- Intent.FLAG_ACTIVITY_NO_ANIMATION);
+ Intent.FLAG_ACTIVITY_NEW_TASK |
+ // don't use the new activity animation; finish
+ // animation runs instead
+ Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(contactsIntent);
finish();
return true;
@@ -420,23 +531,23 @@ public class ManageAccountActivity extends XmppActivity {
}
private void editAccount(Account account) {
- EditAccount dialog = new EditAccount();
- dialog.setAccount(account);
- dialog.setEditAccountListener(new EditAccountListener() {
+ EditAccount dialog = new EditAccount();
+ dialog.setAccount(account);
+ dialog.setEditAccountListener(new EditAccountListener() {
- @Override
- public void onAccountEdited(Account account) {
- xmppConnectionService.updateAccount(account);
- if (actionMode != null) {
- actionMode.finish();
- }
+ @Override
+ public void onAccountEdited(Account account) {
+ xmppConnectionService.updateAccount(account);
+ if (actionMode != null) {
+ actionMode.finish();
}
- });
- dialog.show(getFragmentManager(), "edit_account");
- dialog.setKnownHosts(xmppConnectionService.getKnownHosts(),this);
-
+ }
+ });
+ dialog.show(getFragmentManager(), "edit_account");
+ dialog.setKnownHosts(xmppConnectionService.getKnownHosts(), this);
+
}
-
+
protected void addAccount() {
final Activity activity = this;
EditAccount dialog = new EditAccount();
@@ -450,16 +561,15 @@ public class ManageAccountActivity extends XmppActivity {
}
});
dialog.show(getFragmentManager(), "add_account");
- dialog.setKnownHosts(xmppConnectionService.getKnownHosts(),this);
+ dialog.setKnownHosts(xmppConnectionService.getKnownHosts(), this);
}
-
@Override
public void onActionModeStarted(ActionMode mode) {
super.onActionModeStarted(mode);
this.isActionMode = true;
}
-
+
@Override
public void onActionModeFinished(ActionMode mode) {
super.onActionModeFinished(mode);
@@ -467,20 +577,20 @@ public class ManageAccountActivity extends XmppActivity {
accountListView.clearChoices();
accountListView.requestLayout();
accountListView.post(new Runnable() {
- @Override
- public void run() {
- accountListView.setChoiceMode(ListView.CHOICE_MODE_NONE);
- }
- });
+ @Override
+ public void run() {
+ accountListView.setChoiceMode(ListView.CHOICE_MODE_NONE);
+ }
+ });
}
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (resultCode == RESULT_OK) {
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_ANNOUNCE_PGP) {
- announcePgp(selectedAccountForActionMode,null);
+ announcePgp(selectedAccountForActionMode, null);
}
- }
- }
+ }
+ }
}