From 591ca5bc5e501b15620a569ab338871d6de0bf39 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 17 Jan 2010 22:49:03 +0000 Subject: [PATCH] Fix batch operations menu * Add an explicit configuration option for stars * Replace now-outdated "left handed" widgets config option, now that select widgets are always on the left. * since the multi-modality of the message list was now only a "toggle stars" option, kill that, as it was lots of code and rather redundant --- res/values/strings.xml | 2 +- res/xml/global_preferences.xml | 4 +- src/com/fsck/k9/Account.java | 16 -- src/com/fsck/k9/K9.java | 14 +- src/com/fsck/k9/activity/MessageList.java | 209 +++--------------- .../k9/activity/setup/AccountSettings.java | 6 +- src/com/fsck/k9/activity/setup/Prefs.java | 10 +- 7 files changed, 50 insertions(+), 211 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 01ca4e46f..48ab3ef5b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -421,7 +421,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Notify in status bar when mail arrives Notify in status bar while mail is checked Show combined Inbox - Widgets on the left + Star flagged messages Touch-friendly view Notify for mail I sent Notify even for mail sent from an account identity diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index 9b52f56cb..2d54de085 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -44,8 +44,8 @@ android:title="@string/account_settings_touchable_label"/> + android:key="messagelist_stars" + android:title="@string/account_settings_star_label"/> diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index 96fb6ce69..d8a0d73d0 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -58,7 +58,6 @@ public class Account implements Serializable boolean mNotifySync; HideButtons mHideMessageViewButtons; boolean mIsSignatureBeforeQuotedText; - boolean mLeftHanded; private String mExpungePolicy = EXPUNGE_IMMEDIATELY; private int mMaxPushFolders; @@ -100,7 +99,6 @@ public class Account implements Serializable mVibrate = false; mRing = true; mNotifySelfNewMail = true; - mLeftHanded = false; mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS; mFolderSyncMode = FolderMode.FIRST_CLASS; mFolderPushMode = FolderMode.FIRST_CLASS; @@ -181,7 +179,6 @@ public class Account implements Serializable mTransportUri = Utility.base64Decode(preferences.getPreferences().getString(mUuid + ".transportUri", null)); mDescription = preferences.getPreferences().getString(mUuid + ".description", null); - mLeftHanded = preferences.getPreferences().getBoolean(mUuid + ".leftHanded", false); mAlwaysBcc = preferences.getPreferences().getString(mUuid + ".alwaysBcc", mAlwaysBcc); mAutomaticCheckIntervalMinutes = preferences.getPreferences().getInt(mUuid + ".automaticCheckIntervalMinutes", -1); @@ -445,17 +442,6 @@ public class Account implements Serializable identities.get(0).setEmail(email); } - - public boolean getLeftHanded() - { - return mLeftHanded; - } - - public void setLeftHanded(boolean leftie) - { - mLeftHanded = leftie; - } - public String getAlwaysBcc() { return mAlwaysBcc; @@ -521,7 +507,6 @@ public class Account implements Serializable editor.remove(mUuid + ".name"); editor.remove(mUuid + ".email"); editor.remove(mUuid + ".alwaysBcc"); - editor.remove(mUuid + ".mLeftHanded"); editor.remove(mUuid + ".automaticCheckIntervalMinutes"); editor.remove(mUuid + ".lastAutomaticCheckTime"); editor.remove(mUuid + ".notifyNewMail"); @@ -593,7 +578,6 @@ public class Account implements Serializable editor.putString(mUuid + ".transportUri", Utility.base64Encode(mTransportUri)); editor.putString(mUuid + ".description", mDescription); editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc); - editor.putBoolean(mUuid + ".leftHanded", mLeftHanded); editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes); editor.putInt(mUuid + ".displayCount", mDisplayCount); editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime); diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index bc1093f4b..95a1db073 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -66,7 +66,7 @@ public class K9 extends Application private static boolean mAnimations = true; - private static boolean mMessageListLefthandedWidgets = false; + private static boolean mMessageListStars = true; private static boolean mMessageListTouchable = false; @@ -307,7 +307,7 @@ public class K9 extends Application editor.putBoolean("enableSensitiveLogging", K9.DEBUG_SENSITIVE); editor.putString("backgroundOperations", K9.backgroundOps.toString()); editor.putBoolean("animations", mAnimations); - editor.putBoolean("messageListLefthandedWidgets",mMessageListLefthandedWidgets); + editor.putBoolean("messageListStars",mMessageListStars); editor.putBoolean("messageListTouchable",mMessageListTouchable); editor.putInt("theme", theme); } @@ -322,7 +322,7 @@ public class K9 extends Application DEBUG = sprefs.getBoolean("enableDebugLogging", false); DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); mAnimations = sprefs.getBoolean("animations", true); - mMessageListLefthandedWidgets = sprefs.getBoolean("messageListLefthandedWidgets",false); + mMessageListStars = sprefs.getBoolean("messageListStars",true); mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false); @@ -454,14 +454,14 @@ public class K9 extends Application mMessageListTouchable = touchy; } - public static boolean messageListLefthandedWidgets() + public static boolean messageListStars() { - return mMessageListLefthandedWidgets; + return mMessageListStars; } - public static void setMessageListLefthandedWidgets(boolean lefty) + public static void setMessageListStars(boolean stars) { - mMessageListLefthandedWidgets = lefty; + mMessageListStars = stars; } } diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index f13dbd87f..e1b4498d7 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -74,16 +74,11 @@ public class MessageList private static final String STATE_KEY_SELECTION = "com.fsck.k9.activity.messagelist_selection"; private static final String STATE_KEY_SELECTED_COUNT = "com.fsck.k9.activity.messagelist_selected_count"; - private static final int WIDGET_NONE = 1; - private static final int WIDGET_FLAG = 2; - private ListView mListView; private boolean mTouchView = true; - private int mSelectedWidget = WIDGET_FLAG; - private MessageListAdapter mAdapter; private FolderInfoHolder mCurrentFolder; @@ -113,7 +108,7 @@ public class MessageList private boolean sortAscending = true; private boolean sortDateAscending = false; - private boolean mLeftHanded = false; + private boolean mStars = true; private int mSelectedCount = 0; private View mBatchButtonArea; @@ -308,8 +303,8 @@ public class MessageList mController.loadMoreMessages(mAccount, mFolderName, mAdapter.mListener); return; } - - + + MessageInfoHolder message = (MessageInfoHolder) mAdapter.getItem(position); if (mSelectedCount > 0) { @@ -362,14 +357,7 @@ public class MessageList mBatchFlagButton.setOnClickListener(this); mBatchDoneButton = (Button) findViewById(R.id.batch_done_button); - if (mTouchView == true) - { - mBatchDoneButton.setOnClickListener(this); - } - else - { - mBatchDoneButton.setVisibility(View.GONE); - } + mBatchDoneButton.setOnClickListener(this); Intent intent = getIntent(); mAccount = (Account)intent.getSerializableExtra(EXTRA_ACCOUNT); @@ -476,7 +464,7 @@ public class MessageList { super.onResume(); - mLeftHanded = K9.messageListLefthandedWidgets(); + mStars = K9.messageListStars(); mTouchView = K9.messageListTouchable(); sortType = mController.getSortType(); @@ -537,34 +525,23 @@ public class MessageList case KeyEvent.KEYCODE_DPAD_LEFT: { - if (mQueryString != null) - { // no widget customization in search results yet - return false; - } - else if (mBatchButtonArea.hasFocus()) + if (mBatchButtonArea.hasFocus()) { return false; } else { - - cycleVisibleWidgets(true); return true; } } case KeyEvent.KEYCODE_DPAD_RIGHT: { - if (mQueryString != null) - { // no widget customization in search results yet - return false; - } - else if (mBatchButtonArea.hasFocus()) + if (mBatchButtonArea.hasFocus()) { return false; } else { - cycleVisibleWidgets(false); return true; } } @@ -712,97 +689,6 @@ public class MessageList } - public void cycleVisibleWidgets(boolean ascending) - { - if (mTouchView == true) - { - return; - } - - if (ascending) - { - - switch (mSelectedWidget) - { - case WIDGET_FLAG: - { - mSelectedWidget = WIDGET_NONE; - break; - } - case WIDGET_NONE: - { - mSelectedWidget = WIDGET_FLAG; - break; - } - - } - } - else - { - switch (mSelectedWidget) - { - case WIDGET_FLAG: - { - mSelectedWidget=WIDGET_NONE; - break; - } - case WIDGET_NONE: - { - mSelectedWidget=WIDGET_FLAG; - break; - } - - } - - } - - configureWidgets(); - - } - - private void configureWidgets() - { - switch (mSelectedWidget) - { - case WIDGET_FLAG: - hideBatchButtons(); - break; - case WIDGET_NONE: - hideBatchButtons(); - break; - } - - int count = mListView.getChildCount(); - for (int i=0; i