Checkbox vs. sender image setting
Replace the current "Hide checkbox" setting with a tri-state setting with choice of: - Show checkboxes - Show sender image - Show neither Bug: 8512959 Change-Id: Ifa233b6d65f8c37388edeed71dbfbfdf1295d6fc
This commit is contained in:
parent
bb3a938d61
commit
9f1cff0659
@ -1027,6 +1027,24 @@ as <xliff:g id="filename">%s</xliff:g>.</string>
|
||||
<!-- On mailbox settings screen: Mailbox sync window (the number of days to synchronize email for) setting label [CHAR LIMIT=none] -->
|
||||
<string name="mailbox_settings_mailbox_sync_window_label">Days to sync</string>
|
||||
|
||||
<!-- Settings screen, title for whether to show checkboxes or sender image or neither [CHAR LIMIT=150] -->
|
||||
<string name="preference_conversation_list_icon_title">Checkbox/sender image</string>
|
||||
<!-- Options to select from for whether to show checkboxes or sender images [CHAR LIMIT=50] -->
|
||||
<string-array name="prefEntries_conversationListIconName">
|
||||
<item>Show checkbox</item>
|
||||
<item>Show image (not working yet)</item>
|
||||
<item>Show neither</item>
|
||||
</string-array>
|
||||
<!-- Description of setting for whether to show checkboxes or sender images [CHAR LIMIT=200] -->
|
||||
<string name="preference_conversation_list_icon_summary">Choose whether to show checkboxes or sender images in conversation view</string>
|
||||
<string-array translatable="false" name="prefValues_conversationListIcon">
|
||||
<item>checkbox</item>
|
||||
<item>senderimage</item>
|
||||
<item>none</item>
|
||||
</string-array>
|
||||
<!-- Dialog title for the choosing whether to show checkboxes or sender image [CHAR LIMIT=200] -->
|
||||
<string name="prefDialogTitle_conversationListIcon">Checkbox/sender image</string>
|
||||
|
||||
<!-- Strings used for account shortcut picker -->
|
||||
<!-- String displayed in launcher [CHAR_LIMIT=10] -->
|
||||
<string name="account_shortcut_picker_name">Email account</string>
|
||||
@ -1095,13 +1113,6 @@ as <xliff:g id="filename">%s</xliff:g>.</string>
|
||||
<!-- First category in general preferences [CHAR LIMIT=64] -->
|
||||
<string name="category_general_preferences">Application</string>
|
||||
|
||||
<!-- General preference: Label of the setting for hiding checkboxes in the
|
||||
message list [CHAR LIMIT=32] -->
|
||||
<string name="general_preference_hide_checkboxes_label">Hide checkboxes</string>
|
||||
<!-- General preference: Description of the setting for hiding checkboxes in the
|
||||
message list [CHAR LIMIT=64] -->
|
||||
<string name="general_preference_hide_checkboxes_summary">In lists of messages, touch and
|
||||
hold to select</string>
|
||||
<!-- General preference: Label of the setting for requiring confirmation before
|
||||
message deletion [CHAR LIMIT=32] -->
|
||||
<string name="general_preference_confirm_delete_label">Confirm before deleting</string>
|
||||
|
@ -47,12 +47,13 @@
|
||||
android:entryValues="@array/general_preference_text_zoom_values"
|
||||
android:dialogTitle="@string/general_preference_text_zoom_dialog_title" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="hide_checkboxes"
|
||||
android:persistent="true"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/general_preference_hide_checkboxes_label"
|
||||
android:summary="@string/general_preference_hide_checkboxes_summary" />
|
||||
<ListPreference
|
||||
android:key="conversation_list_icon"
|
||||
android:title="@string/preference_conversation_list_icon_title"
|
||||
android:summary="@string/preference_conversation_list_icon_summary"
|
||||
android:entries="@array/prefEntries_conversationListIconName"
|
||||
android:entryValues="@array/prefValues_conversationListIcon"
|
||||
android:dialogTitle="@string/prefDialogTitle_conversationListIcon" />
|
||||
|
||||
<!-- This may be removed in GeneralPreferences.java -->
|
||||
<CheckBoxPreference
|
||||
|
@ -23,6 +23,7 @@ import android.util.Log;
|
||||
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.mail.providers.UIProvider;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@ -55,7 +56,9 @@ public class Preferences {
|
||||
private static final String CONFIRM_SEND = "confirm_send";
|
||||
@Deprecated
|
||||
private static final String SWIPE_DELETE = "swipe_delete";
|
||||
@Deprecated
|
||||
private static final String HIDE_CHECKBOXES = "hide_checkboxes";
|
||||
private static final String CONV_LIST_ICON = "conversation_list_icon";
|
||||
|
||||
public static final int AUTO_ADVANCE_NEWER = 0;
|
||||
public static final int AUTO_ADVANCE_OLDER = 1;
|
||||
@ -64,6 +67,7 @@ public class Preferences {
|
||||
private static final int AUTO_ADVANCE_DEFAULT = AUTO_ADVANCE_OLDER;
|
||||
private static final boolean CONFIRM_DELETE_DEFAULT = false;
|
||||
private static final boolean CONFIRM_SEND_DEFAULT = false;
|
||||
@Deprecated
|
||||
private static final boolean HIDE_CHECKBOXES_DEFAULT = false;
|
||||
|
||||
// The following constants are used as offsets into R.array.general_preference_text_zoom_size.
|
||||
@ -75,6 +79,11 @@ public class Preferences {
|
||||
// "normal" will be the default
|
||||
public static final int TEXT_ZOOM_DEFAULT = TEXT_ZOOM_NORMAL;
|
||||
|
||||
public static final String CONV_LIST_ICON_CHECKBOX = "checkbox";
|
||||
public static final String CONV_LIST_ICON_SENDER_IMAGE = "senderimage";
|
||||
public static final String CONV_LIST_ICON_NONE = "none";
|
||||
public static final String CONV_LIST_ICON_DEFAULT = CONV_LIST_ICON_CHECKBOX;
|
||||
|
||||
private static Preferences sPreferences;
|
||||
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
@ -193,12 +202,34 @@ public class Preferences {
|
||||
mSharedPreferences.edit().putInt(AUTO_ADVANCE_DIRECTION, direction).apply();
|
||||
}
|
||||
|
||||
public boolean getHideCheckboxes() {
|
||||
/** @deprecated Only used for migration */
|
||||
@Deprecated
|
||||
private boolean hasHideCheckboxes() {
|
||||
return mSharedPreferences.contains(HIDE_CHECKBOXES);
|
||||
}
|
||||
|
||||
/** @deprecated Only used for migration */
|
||||
@Deprecated
|
||||
private boolean getHideCheckboxes() {
|
||||
return mSharedPreferences.getBoolean(HIDE_CHECKBOXES, HIDE_CHECKBOXES_DEFAULT);
|
||||
}
|
||||
|
||||
public void setHideCheckboxes(boolean set) {
|
||||
mSharedPreferences.edit().putBoolean(HIDE_CHECKBOXES, set).apply();
|
||||
public String getConversationListIcon() {
|
||||
if (!mSharedPreferences.contains(CONV_LIST_ICON)) {
|
||||
if (hasHideCheckboxes()) {
|
||||
// Migrate to new settings
|
||||
if (getHideCheckboxes()) {
|
||||
setConversationListIcon(CONV_LIST_ICON_NONE);
|
||||
} else {
|
||||
setConversationListIcon(CONV_LIST_ICON_CHECKBOX);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mSharedPreferences.getString(CONV_LIST_ICON, "checkbox");
|
||||
}
|
||||
|
||||
public void setConversationListIcon(String value) {
|
||||
mSharedPreferences.edit().putString(CONV_LIST_ICON, value).apply();
|
||||
}
|
||||
|
||||
public boolean getConfirmDelete() {
|
||||
|
@ -28,7 +28,6 @@ import android.widget.Toast;
|
||||
import com.android.email.Preferences;
|
||||
import com.android.email.R;
|
||||
import com.android.email.provider.EmailProvider;
|
||||
|
||||
import com.android.mail.preferences.MailPrefs;
|
||||
import com.android.mail.utils.Utils;
|
||||
|
||||
@ -39,7 +38,7 @@ public class GeneralPreferences extends EmailPreferenceFragment implements
|
||||
private static final String PREFERENCE_KEY_TEXT_ZOOM = "text_zoom";
|
||||
private static final String PREFERENCE_KEY_CONFIRM_DELETE = "confirm_delete";
|
||||
private static final String PREFERENCE_KEY_CONFIRM_SEND = "confirm_send";
|
||||
private static final String PREFERENCE_KEY_HIDE_CHECKBOXES = "hide_checkboxes";
|
||||
private static final String PREFERENCE_KEY_CONV_LIST_ICON = "conversation_list_icon";
|
||||
private static final String PREFERENCE_KEY_SWIPE_DELETE = "swipe_delete";
|
||||
private static final String PREFERENCE_KEY_CLEAR_TRUSTED_SENDERS = "clear_trusted_senders";
|
||||
|
||||
@ -54,7 +53,7 @@ public class GeneralPreferences extends EmailPreferenceFragment implements
|
||||
private ListPreference mTextZoom;
|
||||
private CheckBoxPreference mConfirmDelete;
|
||||
private CheckBoxPreference mConfirmSend;
|
||||
private CheckBoxPreference mHideCheckboxes;
|
||||
private ListPreference mConvListIcon;
|
||||
private CheckBoxPreference mSwipeDelete;
|
||||
|
||||
private boolean mSettingsChanged = false;
|
||||
@ -113,6 +112,9 @@ public class GeneralPreferences extends EmailPreferenceFragment implements
|
||||
} else if (MailPrefs.PreferenceKeys.DEFAULT_REPLY_ALL.equals(key)) {
|
||||
mMailPrefs.setDefaultReplyAll((Boolean) newValue);
|
||||
return true;
|
||||
} else if (PREFERENCE_KEY_CONV_LIST_ICON.equals(key)) {
|
||||
mPreferences.setConversationListIcon((String) newValue);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -136,9 +138,6 @@ public class GeneralPreferences extends EmailPreferenceFragment implements
|
||||
} else if (PREFERENCE_KEY_CONFIRM_SEND.equals(key)) {
|
||||
mPreferences.setConfirmSend(mConfirmSend.isChecked());
|
||||
return true;
|
||||
} else if (PREFERENCE_KEY_HIDE_CHECKBOXES.equals(key)) {
|
||||
mPreferences.setHideCheckboxes(mHideCheckboxes.isChecked());
|
||||
return true;
|
||||
} else if (MailPrefs.PreferenceKeys.CONVERSATION_LIST_SWIPE_ACTION.equals(key)) {
|
||||
mMailPrefs
|
||||
.setConversationListSwipeAction(mSwipeDelete.isChecked()
|
||||
@ -161,9 +160,14 @@ public class GeneralPreferences extends EmailPreferenceFragment implements
|
||||
mTextZoom.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
mConvListIcon = (ListPreference) findPreference(PREFERENCE_KEY_CONV_LIST_ICON);
|
||||
if (mConvListIcon != null) {
|
||||
mConvListIcon.setValue(mPreferences.getConversationListIcon());
|
||||
mConvListIcon.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
mConfirmDelete = (CheckBoxPreference) findPreference(PREFERENCE_KEY_CONFIRM_DELETE);
|
||||
mConfirmSend = (CheckBoxPreference) findPreference(PREFERENCE_KEY_CONFIRM_SEND);
|
||||
mHideCheckboxes = (CheckBoxPreference) findPreference(PREFERENCE_KEY_HIDE_CHECKBOXES);
|
||||
mSwipeDelete = (CheckBoxPreference)
|
||||
findPreference(MailPrefs.PreferenceKeys.CONVERSATION_LIST_SWIPE_ACTION);
|
||||
mSwipeDelete.setChecked(MailPrefs.ConversationListSwipeActions.DELETE.equals(
|
||||
|
@ -2824,9 +2824,10 @@ outer:
|
||||
? SWIPE_DELETE : SWIPE_DISABLED);
|
||||
}
|
||||
if (projectionColumns.contains(
|
||||
UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES)) {
|
||||
values.put(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES,
|
||||
prefs.getHideCheckboxes() ? "1" : "0");
|
||||
UIProvider.AccountColumns.SettingsColumns.CONV_LIST_ICON)) {
|
||||
String convListIcon = prefs.getConversationListIcon();
|
||||
values.put(UIProvider.AccountColumns.SettingsColumns.CONV_LIST_ICON,
|
||||
convListIconToUiValue(convListIcon));
|
||||
}
|
||||
if (projectionColumns.contains(UIProvider.AccountColumns.SettingsColumns.AUTO_ADVANCE)) {
|
||||
int autoAdvance = prefs.getAutoAdvanceDirection();
|
||||
@ -2913,6 +2914,18 @@ outer:
|
||||
}
|
||||
}
|
||||
|
||||
private static int convListIconToUiValue(String convListIcon) {
|
||||
if (Preferences.CONV_LIST_ICON_CHECKBOX.equals(convListIcon)) {
|
||||
return UIProvider.ConversationListIcon.CHECKBOX;
|
||||
} else if (Preferences.CONV_LIST_ICON_SENDER_IMAGE.equals(convListIcon)) {
|
||||
return UIProvider.ConversationListIcon.SENDER_IMAGE;
|
||||
} else if (Preferences.CONV_LIST_ICON_NONE.equals(convListIcon)) {
|
||||
return UIProvider.ConversationListIcon.NONE;
|
||||
} else {
|
||||
return UIProvider.ConversationListIcon.DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a Uri string for a combined mailbox uri
|
||||
* @param type the uri command type (e.g. "uimessages")
|
||||
@ -3032,8 +3045,9 @@ outer:
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.REPLY_BEHAVIOR)] =
|
||||
Integer.toString(UIProvider.DefaultReplyBehavior.REPLY);
|
||||
}
|
||||
if (colPosMap.containsKey(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES)) {
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES)] = 0;
|
||||
if (colPosMap.containsKey(UIProvider.AccountColumns.SettingsColumns.CONV_LIST_ICON)) {
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.CONV_LIST_ICON)] =
|
||||
prefs.getConversationListIcon();
|
||||
}
|
||||
if (colPosMap.containsKey(UIProvider.AccountColumns.SettingsColumns.CONFIRM_DELETE)) {
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.CONFIRM_DELETE)] =
|
||||
@ -3047,10 +3061,6 @@ outer:
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.CONFIRM_SEND)] =
|
||||
prefs.getConfirmSend() ? 1 : 0;
|
||||
}
|
||||
if (colPosMap.containsKey(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES)) {
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.HIDE_CHECKBOXES)] =
|
||||
prefs.getHideCheckboxes() ? 1 : 0;
|
||||
}
|
||||
if (colPosMap.containsKey(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX)) {
|
||||
values[colPosMap.get(UIProvider.AccountColumns.SettingsColumns.DEFAULT_INBOX)] =
|
||||
combinedUriString("uifolder", combinedMailboxId(Mailbox.TYPE_INBOX));
|
||||
|
Loading…
Reference in New Issue
Block a user