diff --git a/res/values/strings.xml b/res/values/strings.xml index e4e1ee04c..8a15989c3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -268,6 +268,12 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin About %s Version: %s + + Star flagged messages + Multi-select checkboxes + Always show multi-select checkboxes + Touch-friendly view + Set up a new account Enter this account\'s email address: (You may add %d more accounts.) @@ -421,8 +427,6 @@ 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 - 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 2d54de085..ff1e2434b 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -41,11 +41,17 @@ + android:title="@string/global_settings_touchable_label"/> + android:title="@string/global_settings_star_label"/> + + diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 95a1db073..21f4148f9 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -67,6 +67,7 @@ public class K9 extends Application private static boolean mMessageListStars = true; + private static boolean mMessageListCheckboxes = false; private static boolean mMessageListTouchable = false; @@ -308,6 +309,7 @@ public class K9 extends Application editor.putString("backgroundOperations", K9.backgroundOps.toString()); editor.putBoolean("animations", mAnimations); editor.putBoolean("messageListStars",mMessageListStars); + editor.putBoolean("messageListCheckboxes",mMessageListCheckboxes); editor.putBoolean("messageListTouchable",mMessageListTouchable); editor.putInt("theme", theme); } @@ -323,6 +325,7 @@ public class K9 extends Application DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); mAnimations = sprefs.getBoolean("animations", true); mMessageListStars = sprefs.getBoolean("messageListStars",true); + mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false); mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false); @@ -463,6 +466,15 @@ public class K9 extends Application { mMessageListStars = stars; } + public static boolean messageListCheckboxes() + { + return mMessageListCheckboxes; + } + + public static void setMessageListCheckboxes(boolean checkboxes) + { + mMessageListCheckboxes = checkboxes; + } } diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index b0cd0e90d..6764c75c1 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -109,6 +109,7 @@ public class MessageList private boolean sortDateAscending = false; private boolean mStars = true; + private boolean mCheckboxes = true; private int mSelectedCount = 0; private View mBatchButtonArea; @@ -465,6 +466,7 @@ public class MessageList super.onResume(); mStars = K9.messageListStars(); + mCheckboxes = K9.messageListCheckboxes(); mTouchView = K9.messageListTouchable(); sortType = mController.getSortType(); @@ -1332,7 +1334,7 @@ public class MessageList public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { - if (e2 == null || e1 == null) + if (e2 == null || e1 == null) return true; float deltaX = e2.getX() - e1.getX(), @@ -1845,6 +1847,7 @@ public class MessageList holder.date = (TextView) view.findViewById(R.id.date); holder.chip = view.findViewById(R.id.chip); holder.preview = (TextView) view.findViewById(R.id.preview); + holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox); holder.flagged = (CheckBox) view.findViewById(R.id.flagged); holder.flagged.setOnClickListener(new OnClickListener() { @@ -1857,11 +1860,11 @@ public class MessageList }); if (mStars == false) - { holder.flagged.setVisibility(View.GONE); - } - holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox); + if (mCheckboxes == true) + holder.selected.setVisibility(View.VISIBLE); + if (holder.selected!=null) @@ -1887,13 +1890,16 @@ public class MessageList holder.position = -1; holder.selected.setChecked(message.selected); - if (message.selected == true) + if (!mCheckboxes) { - holder.selected.setVisibility(View.VISIBLE); - } - else - { - holder.selected.setVisibility(View.GONE); + if (message.selected == true) + { + holder.selected.setVisibility(View.VISIBLE); + } + else + { + holder.selected.setVisibility(View.GONE); + } } holder.chip.setBackgroundResource(K9.COLOR_CHIP_RES_IDS[message.account.getAccountNumber() % K9.COLOR_CHIP_RES_IDS.length]); holder.chip.getBackground().setAlpha(message.read ? 127 : 255); @@ -1965,7 +1971,8 @@ public class MessageList //WARNING: Order of the next 2 lines matter holder.position = -1; holder.selected.setChecked(false); - holder.selected.setVisibility(View.GONE); + if (!mCheckboxes) + holder.selected.setVisibility(View.GONE); holder.flagged.setChecked(false); } return view; @@ -2272,13 +2279,16 @@ public class MessageList //We must set the flag before showing the buttons //as the buttons text depends on what is selected message.selected = isChecked; - if (isChecked == true) + if (!mCheckboxes) { - selected.setVisibility(View.VISIBLE); - } - else - { - selected.setVisibility(View.GONE); + if (isChecked == true) + { + selected.setVisibility(View.VISIBLE); + } + else + { + selected.setVisibility(View.GONE); + } } toggleBatchButtons(); } diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 7fe83d3cc..19b1757ef 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -28,6 +28,7 @@ public class Prefs extends K9PreferenceActivity private static final String PREFERENCE_ANIMATIONS = "animations"; private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars"; + private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes"; private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable"; private ListPreference mTheme; @@ -37,6 +38,7 @@ public class Prefs extends K9PreferenceActivity private CheckBoxPreference mSensitiveLogging; private CheckBoxPreference mAnimations; private CheckBoxPreference mStars; + private CheckBoxPreference mCheckboxes; private CheckBoxPreference mTouchable; @@ -127,6 +129,9 @@ public class Prefs extends K9PreferenceActivity mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS); mStars.setChecked(K9.messageListStars()); + mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES); + mCheckboxes.setChecked(K9.messageListCheckboxes()); + mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable.setChecked(K9.messageListTouchable()); } @@ -148,6 +153,7 @@ public class Prefs extends K9PreferenceActivity K9.setAnimations(mAnimations.isChecked()); K9.setMessageListStars(mStars.isChecked()); + K9.setMessageListCheckboxes(mCheckboxes.isChecked()); K9.setMessageListTouchable(mTouchable.isChecked());