Methods Summary |
---|
public static void | actionShowAccounts(android.content.Context context)Start the Accounts list activity. Uses the CLEAR_TOP flag which means that other stacked
activities may be killed in order to get back to Accounts.
Intent i = new Intent(context, Accounts.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(i);
|
private android.app.Dialog | createRemoveAccountDialog()
return new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.account_delete_dlg_title)
.setMessage(getString(R.string.account_delete_dlg_instructions_fmt,
mSelectedContextAccount.getDescription()))
.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_REMOVE_ACCOUNT);
try {
((LocalStore)Store.getInstance(
mSelectedContextAccount.getLocalStoreUri(),
getApplication())).delete();
} catch (Exception e) {
// Ignore
}
mSelectedContextAccount.delete(Preferences.getPreferences(Accounts.this));
Email.setServicesEnabled(Accounts.this);
refresh();
}
})
.setNegativeButton(R.string.cancel_action, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_REMOVE_ACCOUNT);
}
})
.create();
|
private void | onAddNewAccount()
AccountSetupBasics.actionNewAccount(this);
|
public void | onClick(android.view.View view)
if (view.getId() == R.id.add_new_account) {
onAddNewAccount();
}
|
private void | onCompose()
Account defaultAccount =
Preferences.getPreferences(this).getDefaultAccount();
if (defaultAccount != null) {
MessageCompose.actionCompose(this, defaultAccount);
}
else {
onAddNewAccount();
}
|
public boolean | onContextItemSelected(android.view.MenuItem item)
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
Account account = (Account)getListView().getItemAtPosition(menuInfo.position);
switch (item.getItemId()) {
case R.id.delete_account:
onDeleteAccount(account);
break;
case R.id.edit_account:
onEditAccount(account);
break;
case R.id.open:
onOpenAccount(account);
break;
}
return true;
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
setContentView(R.layout.accounts);
ListView listView = getListView();
listView.setOnItemClickListener(this);
listView.setItemsCanFocus(false);
listView.setEmptyView(findViewById(R.id.empty));
findViewById(R.id.add_new_account).setOnClickListener(this);
registerForContextMenu(listView);
if (icicle != null && icicle.containsKey("selectedContextAccount")) {
mSelectedContextAccount = (Account) icicle.getSerializable("selectedContextAccount");
}
|
public void | onCreateContextMenu(android.view.ContextMenu menu, android.view.View v, android.view.ContextMenu.ContextMenuInfo menuInfo)
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle(R.string.accounts_context_menu_title);
getMenuInflater().inflate(R.menu.accounts_context, menu);
|
public android.app.Dialog | onCreateDialog(int id)
switch (id) {
case DIALOG_REMOVE_ACCOUNT:
return createRemoveAccountDialog();
}
return super.onCreateDialog(id);
|
public boolean | onCreateOptionsMenu(android.view.Menu menu)
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.accounts_option, menu);
return true;
|
private void | onDeleteAccount(com.android.email.Account account)
mSelectedContextAccount = account;
showDialog(DIALOG_REMOVE_ACCOUNT);
|
private void | onEditAccount(com.android.email.Account account)
AccountSettings.actionSettings(this, account);
|
public void | onItemClick(android.widget.AdapterView parent, android.view.View view, int position, long id)
Account account = (Account)parent.getItemAtPosition(position);
onOpenAccount(account);
|
public boolean | onItemLongClick(android.widget.AdapterView parent, android.view.View view, int position, long id)
return true;
|
public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
if (event.getKeyCode() == secretKeyCodes[mSecretKeyCodeIndex]) {
mSecretKeyCodeIndex++;
if (mSecretKeyCodeIndex == secretKeyCodes.length) {
mSecretKeyCodeIndex = 0;
startActivity(new Intent(this, Debug.class));
}
} else {
mSecretKeyCodeIndex = 0;
}
return super.onKeyDown(keyCode, event);
|
private void | onOpenAccount(com.android.email.Account account)
FolderMessageList.actionHandleAccount(this, account);
|
public boolean | onOptionsItemSelected(android.view.MenuItem item)
switch (item.getItemId()) {
case R.id.add_new_account:
onAddNewAccount();
break;
case R.id.check_mail:
onRefresh();
break;
case R.id.compose:
onCompose();
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
|
private void | onRefresh()
MessagingController.getInstance(getApplication()).checkMail(this, null, null);
|
public void | onResume()
super.onResume();
NotificationManager notifMgr = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
notifMgr.cancel(1);
refresh();
|
public void | onSaveInstanceState(android.os.Bundle outState)
super.onSaveInstanceState(outState);
if (mSelectedContextAccount != null) {
outState.putSerializable("selectedContextAccount", mSelectedContextAccount);
}
|
private void | refresh()
Account[] accounts = Preferences.getPreferences(this).getAccounts();
getListView().setAdapter(new AccountsAdapter(accounts));
|