mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Use named indices to get values from "visible refile actions" preference
This commit is contained in:
parent
22639a7361
commit
8464a432e2
@ -1347,7 +1347,6 @@ public class K9 extends Application {
|
|||||||
sColorizeMissingContactPictures = enabled;
|
sColorizeMissingContactPictures = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isMessageViewArchiveActionVisible() {
|
public static boolean isMessageViewArchiveActionVisible() {
|
||||||
return sMessageViewArchiveActionVisible;
|
return sMessageViewArchiveActionVisible;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,12 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
|
|
||||||
private static final int ACTIVITY_CHOOSE_FOLDER = 1;
|
private static final int ACTIVITY_CHOOSE_FOLDER = 1;
|
||||||
|
|
||||||
|
// Named indices for the mVisibleRefileActions field
|
||||||
|
private static final int VISIBLE_REFILE_ACTIONS_DELETE = 0;
|
||||||
|
private static final int VISIBLE_REFILE_ACTIONS_ARCHIVE = 1;
|
||||||
|
private static final int VISIBLE_REFILE_ACTIONS_MOVE = 2;
|
||||||
|
private static final int VISIBLE_REFILE_ACTIONS_COPY = 3;
|
||||||
|
private static final int VISIBLE_REFILE_ACTIONS_SPAM = 4;
|
||||||
|
|
||||||
private ListPreference mLanguage;
|
private ListPreference mLanguage;
|
||||||
private ListPreference mTheme;
|
private ListPreference mTheme;
|
||||||
@ -413,20 +419,19 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
mWrapFolderNames.setChecked(K9.wrapFolderNames());
|
mWrapFolderNames.setChecked(K9.wrapFolderNames());
|
||||||
|
|
||||||
mVisibleRefileActions = (CheckBoxListPreference) findPreference(PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS);
|
mVisibleRefileActions = (CheckBoxListPreference) findPreference(PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS);
|
||||||
CharSequence[] visibleRefileActionsEntries = {
|
CharSequence[] visibleRefileActionsEntries = new CharSequence[5];
|
||||||
getString(R.string.delete_action),
|
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_DELETE] = getString(R.string.delete_action);
|
||||||
getString(R.string.archive_action),
|
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_ARCHIVE] = getString(R.string.archive_action);
|
||||||
getString(R.string.move_action),
|
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_MOVE] = getString(R.string.move_action);
|
||||||
getString(R.string.copy_action),
|
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_COPY] = getString(R.string.copy_action);
|
||||||
getString(R.string.spam_action),
|
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_SPAM] = getString(R.string.spam_action);
|
||||||
};
|
|
||||||
boolean[] visibleRefileActionsValues = {
|
boolean[] visibleRefileActionsValues = new boolean[5];
|
||||||
K9.isMessageViewDeleteActionVisible(),
|
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_DELETE] = K9.isMessageViewDeleteActionVisible();
|
||||||
K9.isMessageViewArchiveActionVisible(),
|
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_ARCHIVE] = K9.isMessageViewArchiveActionVisible();
|
||||||
K9.isMessageViewMoveActionVisible(),
|
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_MOVE] = K9.isMessageViewMoveActionVisible();
|
||||||
K9.isMessageViewCopyActionVisible(),
|
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_COPY] = K9.isMessageViewCopyActionVisible();
|
||||||
K9.isMessageViewSpamActionVisible(),
|
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_SPAM] = K9.isMessageViewSpamActionVisible();
|
||||||
};
|
|
||||||
|
|
||||||
mVisibleRefileActions.setItems(visibleRefileActionsEntries);
|
mVisibleRefileActions.setItems(visibleRefileActionsEntries);
|
||||||
mVisibleRefileActions.setCheckedItems(visibleRefileActionsValues);
|
mVisibleRefileActions.setCheckedItems(visibleRefileActionsValues);
|
||||||
@ -500,11 +505,16 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
K9.setMobileOptimizedLayout(mMobileOptimizedLayout.isChecked());
|
K9.setMobileOptimizedLayout(mMobileOptimizedLayout.isChecked());
|
||||||
K9.setAutofitWidth(mAutofitWidth.isChecked());
|
K9.setAutofitWidth(mAutofitWidth.isChecked());
|
||||||
K9.setQuietTimeEnabled(mQuietTimeEnabled.isChecked());
|
K9.setQuietTimeEnabled(mQuietTimeEnabled.isChecked());
|
||||||
K9.setMessageViewDeleteActionVisible(mVisibleRefileActions.getCheckedItems()[0]);
|
K9.setMessageViewDeleteActionVisible(
|
||||||
K9.setMessageViewArchiveActionVisible(mVisibleRefileActions.getCheckedItems()[1]);
|
mVisibleRefileActions.getCheckedItems()[VISIBLE_REFILE_ACTIONS_DELETE]);
|
||||||
K9.setMessageViewMoveActionVisible(mVisibleRefileActions.getCheckedItems()[2]);
|
K9.setMessageViewArchiveActionVisible(
|
||||||
K9.setMessageViewCopyActionVisible(mVisibleRefileActions.getCheckedItems()[3]);
|
mVisibleRefileActions.getCheckedItems()[VISIBLE_REFILE_ACTIONS_ARCHIVE]);
|
||||||
K9.setMessageViewSpamActionVisible(mVisibleRefileActions.getCheckedItems()[4]);
|
K9.setMessageViewMoveActionVisible(
|
||||||
|
mVisibleRefileActions.getCheckedItems()[VISIBLE_REFILE_ACTIONS_MOVE]);
|
||||||
|
K9.setMessageViewCopyActionVisible(
|
||||||
|
mVisibleRefileActions.getCheckedItems()[VISIBLE_REFILE_ACTIONS_COPY]);
|
||||||
|
K9.setMessageViewSpamActionVisible(
|
||||||
|
mVisibleRefileActions.getCheckedItems()[VISIBLE_REFILE_ACTIONS_SPAM]);
|
||||||
|
|
||||||
K9.setQuietTimeStarts(mQuietTimeStarts.getTime());
|
K9.setQuietTimeStarts(mQuietTimeStarts.getTime());
|
||||||
K9.setQuietTimeEnds(mQuietTimeEnds.getTime());
|
K9.setQuietTimeEnds(mQuietTimeEnds.getTime());
|
||||||
|
@ -234,16 +234,16 @@ public class GlobalSettings {
|
|||||||
new V(30, new BooleanSetting(true))
|
new V(30, new BooleanSetting(true))
|
||||||
));
|
));
|
||||||
s.put("messageViewArchiveActionVisible", Settings.versions(
|
s.put("messageViewArchiveActionVisible", Settings.versions(
|
||||||
new V(30, new BooleanSetting(true))
|
new V(30, new BooleanSetting(false))
|
||||||
));
|
));
|
||||||
s.put("messageViewMoveActionVisible", Settings.versions(
|
s.put("messageViewMoveActionVisible", Settings.versions(
|
||||||
new V(30, new BooleanSetting(true))
|
new V(30, new BooleanSetting(false))
|
||||||
));
|
));
|
||||||
s.put("messageViewCopyActionVisible", Settings.versions(
|
s.put("messageViewCopyActionVisible", Settings.versions(
|
||||||
new V(30, new BooleanSetting(true))
|
new V(30, new BooleanSetting(false))
|
||||||
));
|
));
|
||||||
s.put("messageViewSpamActionVisible", Settings.versions(
|
s.put("messageViewSpamActionVisible", Settings.versions(
|
||||||
new V(30, new BooleanSetting(true))
|
new V(30, new BooleanSetting(false))
|
||||||
));
|
));
|
||||||
|
|
||||||
SETTINGS = Collections.unmodifiableMap(s);
|
SETTINGS = Collections.unmodifiableMap(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user