1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Add a new preference to always show multiselect checkboxes.

This commit is contained in:
Jesse Vincent 2010-01-19 00:43:52 +00:00
parent 23af9f3e6d
commit ae029762cf
5 changed files with 59 additions and 21 deletions

View File

@ -268,6 +268,12 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="about_header">About <xliff:g id="app_name">%s</xliff:g></string> <string name="about_header">About <xliff:g id="app_name">%s</xliff:g></string>
<string name="about_version">Version: <xliff:g id="version">%s</xliff:g></string> <string name="about_version">Version: <xliff:g id="version">%s</xliff:g></string>
<string name="global_settings_star_label">Star flagged messages</string>
<string name="global_settings_checkbox_label">Multi-select checkboxes</string>
<string name="global_settings_checkbox_summary">Always show multi-select checkboxes</string>
<string name="global_settings_touchable_label">Touch-friendly view</string>
<string name="account_setup_basics_title">Set up a new account</string> <string name="account_setup_basics_title">Set up a new account</string>
<string name="account_setup_basics_instructions">Enter this account\'s email address:</string> <string name="account_setup_basics_instructions">Enter this account\'s email address:</string>
<string name="account_setup_basics_instructions2_fmt">(You may add <xliff:g id="number_accounts">%d</xliff:g> more accounts.)</string> <string name="account_setup_basics_instructions2_fmt">(You may add <xliff:g id="number_accounts">%d</xliff:g> more accounts.)</string>
@ -421,8 +427,6 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_settings_notify_summary">Notify in status bar when mail arrives</string> <string name="account_settings_notify_summary">Notify in status bar when mail arrives</string>
<string name="account_settings_notify_sync_summary">Notify in status bar while mail is checked</string> <string name="account_settings_notify_sync_summary">Notify in status bar while mail is checked</string>
<string name="account_settings_show_combined_label">Show combined Inbox</string> <string name="account_settings_show_combined_label">Show combined Inbox</string>
<string name="account_settings_star_label">Star flagged messages</string>
<string name="account_settings_touchable_label">Touch-friendly view</string>
<string name="account_settings_notify_self_label">Notify for mail I sent</string> <string name="account_settings_notify_self_label">Notify for mail I sent</string>
<string name="account_settings_notify_self_summary">Notify even for mail sent from an account identity</string> <string name="account_settings_notify_self_summary">Notify even for mail sent from an account identity</string>

View File

@ -41,11 +41,17 @@
<PreferenceCategory android:title="@string/messagelist_preferences" android:key="messagelist_preferences"> <PreferenceCategory android:title="@string/messagelist_preferences" android:key="messagelist_preferences">
<CheckBoxPreference <CheckBoxPreference
android:key="messagelist_touchable" android:key="messagelist_touchable"
android:title="@string/account_settings_touchable_label"/> android:title="@string/global_settings_touchable_label"/>
<CheckBoxPreference <CheckBoxPreference
android:key="messagelist_stars" android:key="messagelist_stars"
android:title="@string/account_settings_star_label"/> android:title="@string/global_settings_star_label"/>
<CheckBoxPreference
android:key="messagelist_checkboxes"
android:title="@string/global_settings_checkbox_label"
android:summary="@string/global_settings_checkbox_summary"
/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences"> <PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences">

View File

@ -67,6 +67,7 @@ public class K9 extends Application
private static boolean mMessageListStars = true; private static boolean mMessageListStars = true;
private static boolean mMessageListCheckboxes = false;
private static boolean mMessageListTouchable = false; private static boolean mMessageListTouchable = false;
@ -308,6 +309,7 @@ public class K9 extends Application
editor.putString("backgroundOperations", K9.backgroundOps.toString()); editor.putString("backgroundOperations", K9.backgroundOps.toString());
editor.putBoolean("animations", mAnimations); editor.putBoolean("animations", mAnimations);
editor.putBoolean("messageListStars",mMessageListStars); editor.putBoolean("messageListStars",mMessageListStars);
editor.putBoolean("messageListCheckboxes",mMessageListCheckboxes);
editor.putBoolean("messageListTouchable",mMessageListTouchable); editor.putBoolean("messageListTouchable",mMessageListTouchable);
editor.putInt("theme", theme); editor.putInt("theme", theme);
} }
@ -323,6 +325,7 @@ public class K9 extends Application
DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false); DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false);
mAnimations = sprefs.getBoolean("animations", true); mAnimations = sprefs.getBoolean("animations", true);
mMessageListStars = sprefs.getBoolean("messageListStars",true); mMessageListStars = sprefs.getBoolean("messageListStars",true);
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false);
mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false); mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false);
@ -463,6 +466,15 @@ public class K9 extends Application
{ {
mMessageListStars = stars; mMessageListStars = stars;
} }
public static boolean messageListCheckboxes()
{
return mMessageListCheckboxes;
}
public static void setMessageListCheckboxes(boolean checkboxes)
{
mMessageListCheckboxes = checkboxes;
}
} }

View File

@ -109,6 +109,7 @@ public class MessageList
private boolean sortDateAscending = false; private boolean sortDateAscending = false;
private boolean mStars = true; private boolean mStars = true;
private boolean mCheckboxes = true;
private int mSelectedCount = 0; private int mSelectedCount = 0;
private View mBatchButtonArea; private View mBatchButtonArea;
@ -465,6 +466,7 @@ public class MessageList
super.onResume(); super.onResume();
mStars = K9.messageListStars(); mStars = K9.messageListStars();
mCheckboxes = K9.messageListCheckboxes();
mTouchView = K9.messageListTouchable(); mTouchView = K9.messageListTouchable();
sortType = mController.getSortType(); sortType = mController.getSortType();
@ -1332,7 +1334,7 @@ public class MessageList
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{ {
if (e2 == null || e1 == null) if (e2 == null || e1 == null)
return true; return true;
float deltaX = e2.getX() - e1.getX(), float deltaX = e2.getX() - e1.getX(),
@ -1845,6 +1847,7 @@ public class MessageList
holder.date = (TextView) view.findViewById(R.id.date); holder.date = (TextView) view.findViewById(R.id.date);
holder.chip = view.findViewById(R.id.chip); holder.chip = view.findViewById(R.id.chip);
holder.preview = (TextView) view.findViewById(R.id.preview); 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 = (CheckBox) view.findViewById(R.id.flagged);
holder.flagged.setOnClickListener(new OnClickListener() holder.flagged.setOnClickListener(new OnClickListener()
{ {
@ -1857,11 +1860,11 @@ public class MessageList
}); });
if (mStars == false) if (mStars == false)
{
holder.flagged.setVisibility(View.GONE); 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) if (holder.selected!=null)
@ -1887,13 +1890,16 @@ public class MessageList
holder.position = -1; holder.position = -1;
holder.selected.setChecked(message.selected); holder.selected.setChecked(message.selected);
if (message.selected == true) if (!mCheckboxes)
{ {
holder.selected.setVisibility(View.VISIBLE); if (message.selected == true)
} {
else holder.selected.setVisibility(View.VISIBLE);
{ }
holder.selected.setVisibility(View.GONE); 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.setBackgroundResource(K9.COLOR_CHIP_RES_IDS[message.account.getAccountNumber() % K9.COLOR_CHIP_RES_IDS.length]);
holder.chip.getBackground().setAlpha(message.read ? 127 : 255); holder.chip.getBackground().setAlpha(message.read ? 127 : 255);
@ -1965,7 +1971,8 @@ public class MessageList
//WARNING: Order of the next 2 lines matter //WARNING: Order of the next 2 lines matter
holder.position = -1; holder.position = -1;
holder.selected.setChecked(false); holder.selected.setChecked(false);
holder.selected.setVisibility(View.GONE); if (!mCheckboxes)
holder.selected.setVisibility(View.GONE);
holder.flagged.setChecked(false); holder.flagged.setChecked(false);
} }
return view; return view;
@ -2272,13 +2279,16 @@ public class MessageList
//We must set the flag before showing the buttons //We must set the flag before showing the buttons
//as the buttons text depends on what is selected //as the buttons text depends on what is selected
message.selected = isChecked; message.selected = isChecked;
if (isChecked == true) if (!mCheckboxes)
{ {
selected.setVisibility(View.VISIBLE); if (isChecked == true)
} {
else selected.setVisibility(View.VISIBLE);
{ }
selected.setVisibility(View.GONE); else
{
selected.setVisibility(View.GONE);
}
} }
toggleBatchButtons(); toggleBatchButtons();
} }

View File

@ -28,6 +28,7 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_ANIMATIONS = "animations"; private static final String PREFERENCE_ANIMATIONS = "animations";
private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars"; 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 static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable";
private ListPreference mTheme; private ListPreference mTheme;
@ -37,6 +38,7 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mSensitiveLogging; private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference mAnimations; private CheckBoxPreference mAnimations;
private CheckBoxPreference mStars; private CheckBoxPreference mStars;
private CheckBoxPreference mCheckboxes;
private CheckBoxPreference mTouchable; private CheckBoxPreference mTouchable;
@ -127,6 +129,9 @@ public class Prefs extends K9PreferenceActivity
mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS); mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS);
mStars.setChecked(K9.messageListStars()); mStars.setChecked(K9.messageListStars());
mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
mCheckboxes.setChecked(K9.messageListCheckboxes());
mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE);
mTouchable.setChecked(K9.messageListTouchable()); mTouchable.setChecked(K9.messageListTouchable());
} }
@ -148,6 +153,7 @@ public class Prefs extends K9PreferenceActivity
K9.setAnimations(mAnimations.isChecked()); K9.setAnimations(mAnimations.isChecked());
K9.setMessageListStars(mStars.isChecked()); K9.setMessageListStars(mStars.isChecked());
K9.setMessageListCheckboxes(mCheckboxes.isChecked());
K9.setMessageListTouchable(mTouchable.isChecked()); K9.setMessageListTouchable(mTouchable.isChecked());