1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

remove lots of duplicate menu ui, particularly cutting down on context menu stuff.

This commit is contained in:
Jesse Vincent 2012-09-12 23:11:57 -05:00
parent 5d4a2132d8
commit 3a68360e30
4 changed files with 4 additions and 123 deletions

View File

@ -1,18 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/open"
android:title="@string/open_action" />
<item android:id="@+id/check_mail"
android:title="@string/check_mail_action" />
<item android:id="@+id/empty_trash"
android:title="@string/empty_trash_action" />
<item android:id="@+id/edit_account"
android:title="@string/account_settings_action" />
<item android:id="@+id/move_up"
android:title="@string/manage_accounts_move_up_action" />
<item android:id="@+id/move_down"
android:title="@string/manage_accounts_move_down_action" />
<item android:id="@+id/advanced"
android:title="@string/advanced">
<menu>
<item android:id="@+id/compact"
android:title="@string/compact_action" />
<item android:id="@+id/clear"
android:title="@string/clear_action" />
<item android:id="@+id/recreate"
@ -23,10 +17,6 @@
android:title="@string/clear_pending_action" />
<item android:id="@+id/export"
android:title="@string/settings_export_account" />
<item android:id="@+id/move_up"
android:title="@string/manage_accounts_move_up_action" />
<item android:id="@+id/move_down"
android:title="@string/manage_accounts_move_down_action" />
</menu>
</item>
</menu>

View File

@ -1,32 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/open_folder"
android:title="@string/open_action"
/>
<item
android:id="@+id/empty_trash"
android:title="@string/empty_trash_action"
/>
<item
android:id="@+id/check_mail"
android:title="@string/check_mail_action"
/>
<item
android:id="@+id/send_messages"
android:title="@string/send_messages_action"
/>
<item
android:id="@+id/folder_settings"
android:title="@string/folder_settings_action"
/>
<item
android:id="@+id/clear_local_folder"
android:title="@string/clear_local_folder_action"
/>
<item
android:id="@+id/expunge"
android:title="@string/expunge_action"
/>
</menu>

View File

@ -565,10 +565,6 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
AccountSetupBasics.actionNewAccount(this);
}
private void onEditAccount(Account account) {
AccountSettings.actionSettings(this, account);
}
private void onEditPrefs() {
Prefs.actionPrefs(this);
}
@ -593,11 +589,6 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
MessagingController.getInstance(getApplication()).clearAllPending(account);
}
private void onEmptyTrash(Account account) {
MessagingController.getInstance(getApplication()).emptyTrash(account, null);
}
private void onCompose() {
Account defaultAccount = Preferences.getPreferences(this).getDefaultAccount();
if (defaultAccount != null) {
@ -1102,27 +1093,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
case R.id.delete_account:
onDeleteAccount(realAccount);
break;
case R.id.edit_account:
onEditAccount(realAccount);
break;
case R.id.open:
onOpenAccount(mSelectedContextAccount);
break;
case R.id.activate:
onActivateAccount(realAccount);
break;
case R.id.check_mail:
onCheckMail(realAccount);
break;
case R.id.clear_pending:
onClearCommands(realAccount);
break;
case R.id.empty_trash:
onEmptyTrash(realAccount);
break;
case R.id.compact:
onCompact(realAccount);
break;
case R.id.clear:
onClear(realAccount);
break;
@ -1144,11 +1120,6 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
private void onCompact(Account account) {
mHandler.workingAccount(account, R.string.compacting_account);
MessagingController.getInstance(getApplication()).compact(account, null);
}
private void onClear(Account account) {
showDialog(DIALOG_CLEAR_ACCOUNT);
@ -1313,9 +1284,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
if (account instanceof SearchAccount) {
for (int i = 0; i < menu.size(); i++) {
android.view.MenuItem item = menu.getItem(i);
if (item.getItemId() != R.id.open) {
item.setVisible(false);
}
}
}
else {

View File

@ -500,10 +500,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
AccountSettings.actionSettings(this, mAccount);
}
private void onEditFolder(Account account, String folderName) {
FolderSettings.actionSettings(this, account, folderName);
}
private void onAccounts() {
Accounts.listAccounts(this);
finish();
@ -644,34 +640,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);
switch (item.getItemId()) {
case R.id.open_folder:
onOpenFolder(folder.name);
break;
case R.id.send_messages:
sendMail(mAccount);
break;
case R.id.check_mail:
checkMail(folder);
break;
case R.id.folder_settings:
onEditFolder(mAccount, folder.name);
break;
case R.id.empty_trash:
onEmptyTrash(mAccount);
break;
case R.id.expunge:
onExpunge(mAccount, folder.name);
break;
case R.id.clear_local_folder:
onClearFolder(mAccount, folder.name);
break;
@ -765,29 +733,6 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);
menu.setHeaderTitle(folder.displayName);
if (!folder.name.equals(mAccount.getTrashFolderName()))
menu.findItem(R.id.empty_trash).setVisible(false);
if (folder.name.equals(mAccount.getOutboxFolderName())) {
menu.findItem(R.id.check_mail).setVisible(false);
} else {
menu.findItem(R.id.send_messages).setVisible(false);
}
if (K9.ERROR_FOLDER_NAME.equals(folder.name)) {
menu.findItem(R.id.expunge).setVisible(false);
}
if (!MessagingController.getInstance(getApplication()).isMoveCapable(mAccount)) {
// FIXME: Really we want to do this for all local-only folders
if (!mAccount.getInboxFolderName().equals(folder.name)) {
menu.findItem(R.id.check_mail).setVisible(false);
}
menu.findItem(R.id.expunge).setVisible(false);
}
menu.setHeaderTitle(folder.displayName);
}
class FolderListAdapter extends BaseAdapter implements Filterable {