2014-02-28 17:46:01 +00:00
|
|
|
package eu.siacs.conversations.ui;
|
2014-01-24 01:04:05 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2014-01-24 01:04:05 +00:00
|
|
|
|
2014-02-28 17:46:01 +00:00
|
|
|
import eu.siacs.conversations.R;
|
|
|
|
import eu.siacs.conversations.entities.Account;
|
2014-07-12 11:42:17 +00:00
|
|
|
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
|
2014-07-16 22:03:37 +00:00
|
|
|
import eu.siacs.conversations.ui.EditAccountDialog.EditAccountListener;
|
2014-07-31 13:09:34 +00:00
|
|
|
import eu.siacs.conversations.ui.adapter.AccountAdapter;
|
2014-03-12 21:31:50 +00:00
|
|
|
import eu.siacs.conversations.xmpp.XmppConnection;
|
2014-01-28 22:15:30 +00:00
|
|
|
import android.app.Activity;
|
2014-02-04 20:44:16 +00:00
|
|
|
import android.app.AlertDialog;
|
2014-02-04 21:26:46 +00:00
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.DialogInterface.OnClickListener;
|
2014-01-28 18:21:54 +00:00
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
2014-03-12 21:31:50 +00:00
|
|
|
import android.os.SystemClock;
|
2014-02-04 20:44:16 +00:00
|
|
|
import android.view.ActionMode;
|
2014-01-28 18:21:54 +00:00
|
|
|
import android.view.Menu;
|
2014-02-04 20:44:16 +00:00
|
|
|
import android.view.MenuInflater;
|
2014-01-28 18:21:54 +00:00
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.AdapterView;
|
|
|
|
import android.widget.AdapterView.OnItemClickListener;
|
2014-02-04 20:44:16 +00:00
|
|
|
import android.widget.AdapterView.OnItemLongClickListener;
|
2014-01-28 18:21:54 +00:00
|
|
|
import android.widget.ListView;
|
|
|
|
import android.widget.TextView;
|
2014-01-24 01:04:05 +00:00
|
|
|
|
2014-03-06 02:30:03 +00:00
|
|
|
public class ManageAccountActivity extends XmppActivity {
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-02-04 20:44:16 +00:00
|
|
|
protected boolean isActionMode = false;
|
|
|
|
protected ActionMode actionMode;
|
|
|
|
protected Account selectedAccountForActionMode = null;
|
2014-03-07 13:24:33 +00:00
|
|
|
protected ManageAccountActivity activity = this;
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-04-01 21:16:19 +00:00
|
|
|
protected boolean firstrun = true;
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
protected List<Account> accountList = new ArrayList<Account>();
|
|
|
|
protected ListView accountListView;
|
2014-07-31 13:09:34 +00:00
|
|
|
protected AccountAdapter mAccountAdapter;
|
2014-07-12 11:42:17 +00:00
|
|
|
protected OnAccountUpdate accountChanged = new OnAccountUpdate() {
|
2014-02-04 14:09:50 +00:00
|
|
|
|
|
|
|
@Override
|
2014-07-12 11:42:17 +00:00
|
|
|
public void onAccountUpdate() {
|
2014-02-04 14:09:50 +00:00
|
|
|
accountList.clear();
|
|
|
|
accountList.addAll(xmppConnectionService.getAccounts());
|
|
|
|
runOnUiThread(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run() {
|
2014-07-31 13:09:34 +00:00
|
|
|
mAccountAdapter.notifyDataSetChanged();
|
2014-02-04 14:09:50 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-07-31 13:09:34 +00:00
|
|
|
protected ActionMode.Callback mActionModeCallback = 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();
|
2014-08-03 18:28:13 +00:00
|
|
|
} else if (item.getItemId() == R.id.mgmt_account_publish_avatar) {
|
2014-08-03 18:42:05 +00:00
|
|
|
Intent intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
|
|
|
|
intent.putExtra("account", selectedAccountForActionMode.getJid());
|
|
|
|
startActivity(intent);
|
2014-07-31 13:09:34 +00:00
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
setContentView(R.layout.manage_accounts);
|
2014-02-04 14:09:50 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
accountListView = (ListView) findViewById(R.id.account_list);
|
2014-03-06 02:30:03 +00:00
|
|
|
final XmppActivity activity = this;
|
2014-07-31 13:09:34 +00:00
|
|
|
this.mAccountAdapter = new AccountAdapter(this, accountList);
|
|
|
|
accountListView.setAdapter(this.mAccountAdapter);
|
2014-01-28 18:21:54 +00:00
|
|
|
accountListView.setOnItemClickListener(new OnItemClickListener() {
|
|
|
|
|
|
|
|
@Override
|
2014-02-04 14:09:50 +00:00
|
|
|
public void onItemClick(AdapterView<?> arg0, View view,
|
|
|
|
int position, long arg3) {
|
2014-02-04 20:44:16 +00:00
|
|
|
if (!isActionMode) {
|
2014-03-07 13:24:33 +00:00
|
|
|
Account account = accountList.get(position);
|
2014-07-23 23:37:38 +00:00
|
|
|
if (account.getStatus() == Account.STATUS_OFFLINE) {
|
2014-07-12 11:42:17 +00:00
|
|
|
activity.xmppConnectionService.reconnectAccount(
|
|
|
|
accountList.get(position), true);
|
2014-03-07 13:24:33 +00:00
|
|
|
} else if (account.getStatus() == Account.STATUS_ONLINE) {
|
2014-07-12 11:42:17 +00:00
|
|
|
activity.startActivity(new Intent(activity
|
|
|
|
.getApplicationContext(),
|
2014-07-16 22:03:37 +00:00
|
|
|
StartConversationActivity.class));
|
2014-04-01 21:16:19 +00:00
|
|
|
} else if (account.getStatus() != Account.STATUS_DISABLED) {
|
2014-03-13 03:21:59 +00:00
|
|
|
editAccount(account);
|
2014-03-07 13:24:33 +00:00
|
|
|
}
|
2014-02-04 20:44:16 +00:00
|
|
|
} else {
|
|
|
|
selectedAccountForActionMode = accountList.get(position);
|
|
|
|
actionMode.invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2014-07-12 11:42:17 +00:00
|
|
|
accountListView
|
|
|
|
.setOnItemLongClickListener(new OnItemLongClickListener() {
|
2014-01-28 18:21:54 +00:00
|
|
|
|
2014-07-12 11:42:17 +00:00
|
|
|
@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
|
2014-07-31 13:09:34 +00:00
|
|
|
.startActionMode(mActionModeCallback);
|
2014-03-06 02:30:03 +00:00
|
|
|
return true;
|
2014-07-12 11:42:17 +00:00
|
|
|
} else {
|
|
|
|
return false;
|
2014-03-06 02:30:03 +00:00
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
}
|
|
|
|
});
|
2014-01-28 18:21:54 +00:00
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
@Override
|
2014-02-04 14:09:50 +00:00
|
|
|
protected void onStop() {
|
2014-01-28 18:21:54 +00:00
|
|
|
if (xmppConnectionServiceBound) {
|
2014-02-04 14:09:50 +00:00
|
|
|
xmppConnectionService.removeOnAccountListChangedListener();
|
2014-01-28 18:21:54 +00:00
|
|
|
}
|
2014-02-05 21:33:39 +00:00
|
|
|
super.onStop();
|
2014-01-28 18:21:54 +00:00
|
|
|
}
|
2014-02-04 14:09:50 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
@Override
|
|
|
|
void onBackendConnected() {
|
2014-02-04 14:09:50 +00:00
|
|
|
xmppConnectionService.setOnAccountListChangedListener(accountChanged);
|
2014-01-28 18:21:54 +00:00
|
|
|
this.accountList.clear();
|
|
|
|
this.accountList.addAll(xmppConnectionService.getAccounts());
|
2014-07-31 13:09:34 +00:00
|
|
|
mAccountAdapter.notifyDataSetChanged();
|
2014-07-12 11:42:17 +00:00
|
|
|
if ((this.accountList.size() == 0) && (this.firstrun)) {
|
2014-01-28 22:15:30 +00:00
|
|
|
getActionBar().setDisplayHomeAsUpEnabled(false);
|
2014-05-31 03:18:50 +00:00
|
|
|
getActionBar().setHomeButtonEnabled(false);
|
2014-01-28 22:15:30 +00:00
|
|
|
addAccount();
|
2014-04-01 21:16:19 +00:00
|
|
|
this.firstrun = false;
|
2014-01-28 22:15:30 +00:00
|
|
|
}
|
2014-01-28 18:21:54 +00:00
|
|
|
}
|
2014-02-04 14:09:50 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
@Override
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
|
getMenuInflater().inflate(R.menu.manageaccounts, menu);
|
|
|
|
return true;
|
|
|
|
}
|
2014-02-04 14:09:50 +00:00
|
|
|
|
2014-01-28 18:21:54 +00:00
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
case R.id.action_add_account:
|
2014-01-28 22:15:30 +00:00
|
|
|
addAccount();
|
2014-01-28 18:21:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
2014-01-28 22:15:30 +00:00
|
|
|
|
2014-05-31 15:50:09 +00:00
|
|
|
@Override
|
|
|
|
public boolean onNavigateUp() {
|
|
|
|
if (xmppConnectionService.getConversations().size() == 0) {
|
2014-07-31 13:09:34 +00:00
|
|
|
Intent contactsIntent = new Intent(this,
|
|
|
|
StartConversationActivity.class);
|
2014-05-31 16:53:23 +00:00
|
|
|
contactsIntent.setFlags(
|
2014-07-12 11:42:17 +00:00
|
|
|
// if activity exists in stack, pop the stack and go back to it
|
2014-05-31 16:53:23 +00:00
|
|
|
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
|
|
|
// otherwise, make a new task for it
|
2014-07-12 11:42:17 +00:00
|
|
|
Intent.FLAG_ACTIVITY_NEW_TASK |
|
|
|
|
// don't use the new activity animation; finish
|
|
|
|
// animation runs instead
|
|
|
|
Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
2014-05-31 16:53:23 +00:00
|
|
|
startActivity(contactsIntent);
|
2014-05-31 15:50:09 +00:00
|
|
|
finish();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return super.onNavigateUp();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-13 03:21:59 +00:00
|
|
|
private void editAccount(Account account) {
|
2014-07-16 22:03:37 +00:00
|
|
|
EditAccountDialog dialog = new EditAccountDialog();
|
2014-07-12 11:42:17 +00:00
|
|
|
dialog.setAccount(account);
|
|
|
|
dialog.setEditAccountListener(new EditAccountListener() {
|
2014-03-13 03:21:59 +00:00
|
|
|
|
2014-07-12 11:42:17 +00:00
|
|
|
@Override
|
|
|
|
public void onAccountEdited(Account account) {
|
|
|
|
xmppConnectionService.updateAccount(account);
|
|
|
|
if (actionMode != null) {
|
|
|
|
actionMode.finish();
|
2014-03-13 03:21:59 +00:00
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
dialog.show(getFragmentManager(), "edit_account");
|
|
|
|
dialog.setKnownHosts(xmppConnectionService.getKnownHosts(), this);
|
|
|
|
|
2014-03-13 03:21:59 +00:00
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-01-28 22:15:30 +00:00
|
|
|
protected void addAccount() {
|
|
|
|
final Activity activity = this;
|
2014-07-16 22:03:37 +00:00
|
|
|
EditAccountDialog dialog = new EditAccountDialog();
|
2014-01-28 22:15:30 +00:00
|
|
|
dialog.setEditAccountListener(new EditAccountListener() {
|
2014-02-04 14:09:50 +00:00
|
|
|
|
2014-01-28 22:15:30 +00:00
|
|
|
@Override
|
|
|
|
public void onAccountEdited(Account account) {
|
|
|
|
xmppConnectionService.createAccount(account);
|
|
|
|
activity.getActionBar().setDisplayHomeAsUpEnabled(true);
|
2014-05-31 03:18:50 +00:00
|
|
|
activity.getActionBar().setHomeButtonEnabled(true);
|
2014-01-28 22:15:30 +00:00
|
|
|
}
|
|
|
|
});
|
2014-02-04 14:09:50 +00:00
|
|
|
dialog.show(getFragmentManager(), "add_account");
|
2014-07-12 11:42:17 +00:00
|
|
|
dialog.setKnownHosts(xmppConnectionService.getKnownHosts(), this);
|
2014-01-28 22:15:30 +00:00
|
|
|
}
|
2014-02-04 20:44:16 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onActionModeStarted(ActionMode mode) {
|
|
|
|
super.onActionModeStarted(mode);
|
|
|
|
this.isActionMode = true;
|
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
|
2014-02-04 20:44:16 +00:00
|
|
|
@Override
|
|
|
|
public void onActionModeFinished(ActionMode mode) {
|
|
|
|
super.onActionModeFinished(mode);
|
|
|
|
this.isActionMode = false;
|
|
|
|
accountListView.clearChoices();
|
|
|
|
accountListView.requestLayout();
|
|
|
|
accountListView.post(new Runnable() {
|
2014-07-12 11:42:17 +00:00
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
accountListView.setChoiceMode(ListView.CHOICE_MODE_NONE);
|
|
|
|
}
|
|
|
|
});
|
2014-02-04 20:44:16 +00:00
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
|
if (resultCode == RESULT_OK) {
|
2014-02-27 23:22:56 +00:00
|
|
|
if (requestCode == REQUEST_ANNOUNCE_PGP) {
|
2014-07-12 11:42:17 +00:00
|
|
|
announcePgp(selectedAccountForActionMode, null);
|
2014-05-08 14:52:19 +00:00
|
|
|
}
|
2014-07-12 11:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-24 01:04:05 +00:00
|
|
|
}
|