1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-11 20:15:03 -05:00

Merge branch 'pr/364'

Make actions shown in message view menu configurable
This commit is contained in:
cketti 2013-08-29 21:14:04 +02:00
commit fb6cff238c
25 changed files with 188 additions and 19 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 612 B

View File

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 712 B

View File

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

View File

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View File

Before

Width:  |  Height:  |  Size: 491 B

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 817 B

After

Width:  |  Height:  |  Size: 817 B

View File

Before

Width:  |  Height:  |  Size: 948 B

After

Width:  |  Height:  |  Size: 948 B

View File

@ -28,11 +28,12 @@
android:id="@+id/move"
android:title="@string/move_action"
android:showAsAction="ifRoom"
android:icon="?attr/iconActionMoveOrCopy"
android:icon="?attr/iconActionMove"
/>
<item
android:id="@+id/copy"
android:title="@string/copy_action"
android:icon="?attr/iconActionCopy"
/>
<item
android:id="@+id/flag"

View File

@ -56,6 +56,30 @@
android:icon="?attr/iconActionDelete"
android:showAsAction="always"
android:title="@string/delete_action"/>
<!-- MessageView -->
<item
android:id="@+id/archive"
android:icon="?attr/iconActionArchive"
android:showAsAction="ifRoom"
android:title="@string/archive_action"/>
<!-- MessageView -->
<item
android:id="@+id/spam"
android:icon="?attr/iconActionSpam"
android:showAsAction="ifRoom"
android:title="@string/spam_action"/>
<!-- MessageView -->
<item
android:id="@+id/move"
android:icon="?attr/iconActionMove"
android:showAsAction="ifRoom"
android:title="@string/move_action"/>
<!-- MessageView -->
<item
android:id="@+id/copy"
android:icon="?attr/iconActionCopy"
android:showAsAction="ifRoom"
android:title="@string/copy_action"/>
<!-- MessageView -->
<item
@ -88,22 +112,16 @@
<menu>
<item
android:id="@+id/archive"
android:icon="?attr/iconActionArchive"
android:showAsAction="ifRoom"
android:title="@string/archive_action"/>
<!-- MessageView -->
<item
android:id="@+id/spam"
android:icon="?attr/iconActionSpam"
android:showAsAction="ifRoom"
android:title="@string/spam_action"/>
<!-- MessageView -->
<item
android:id="@+id/move"
android:icon="?attr/iconActionMoveOrCopy"
android:showAsAction="ifRoom"
android:title="@string/move_action"/>
<!-- MessageView -->

View File

@ -10,7 +10,8 @@
<attr name="iconActionArchive" format="reference" />
<attr name="iconActionCompose" format="reference" />
<attr name="iconActionDelete" format="reference" />
<attr name="iconActionMoveOrCopy" format="reference" />
<attr name="iconActionMove" format="reference" />
<attr name="iconActionCopy" format="reference" />
<attr name="iconActionNextMessage" format="reference" />
<attr name="iconActionPreviousMessage" format="reference" />
<attr name="iconActionRefresh" format="reference" />

View File

@ -1153,4 +1153,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="mark_all_as_read">Mark all as read</string>
<string name="global_settings_colorize_missing_contact_pictures">Colorize missing contact pictures</string>
<string name="global_settings_messageview_visible_refile_actions_title">Visisble message actions</string>
<string name="global_settings_messageview_visible_refile_actions_summary">Show selected actions in the message view menu</string>
</resources>

View File

@ -12,7 +12,8 @@
<item name="iconActionArchive">@drawable/ic_action_archive_light</item>
<item name="iconActionCompose">@drawable/ic_action_compose_light</item>
<item name="iconActionDelete">@drawable/ic_action_delete_light</item>
<item name="iconActionMoveOrCopy">@drawable/ic_action_move_or_copy_light</item>
<item name="iconActionMove">@drawable/ic_action_move_light</item>
<item name="iconActionCopy">@drawable/ic_action_copy_light</item>
<item name="iconActionNextMessage">@drawable/ic_action_next_message_light</item>
<item name="iconActionPreviousMessage">@drawable/ic_action_previous_message_light</item>
<item name="iconActionRefresh">@drawable/ic_action_refresh_light</item>
@ -63,7 +64,8 @@
<item name="iconActionArchive">@drawable/ic_action_archive_dark</item>
<item name="iconActionCompose">@drawable/ic_action_compose_dark</item>
<item name="iconActionDelete">@drawable/ic_action_delete_dark</item>
<item name="iconActionMoveOrCopy">@drawable/ic_action_move_or_copy_dark</item>
<item name="iconActionMove">@drawable/ic_action_move_dark</item>
<item name="iconActionCopy">@drawable/ic_action_copy_dark</item>
<item name="iconActionNextMessage">@drawable/ic_action_next_message_dark</item>
<item name="iconActionPreviousMessage">@drawable/ic_action_previous_message_dark</item>
<item name="iconActionRefresh">@drawable/ic_action_refresh_dark</item>

View File

@ -225,6 +225,15 @@
android:title="@string/global_settings_messageview_fixedwidth_label"
android:summary="@string/global_settings_messageview_fixedwidth_summary" />
<com.fsck.k9.preferences.CheckBoxListPreference
android:persistent="false"
android:key="messageview_visible_refile_actions"
android:title="@string/global_settings_messageview_visible_refile_actions_title"
android:summary="@string/global_settings_messageview_visible_refile_actions_summary"
android:dialogTitle="@string/global_settings_messageview_visible_refile_actions_title"
android:positiveButtonText="@android:string/ok"
android:negativeButtonText="@android:string/cancel" />
<CheckBoxPreference
android:persistent="false"
android:key="messageview_mobile_layout"

View File

@ -263,6 +263,13 @@ public class K9 extends Application {
private static SplitViewMode sSplitViewMode = SplitViewMode.NEVER;
private static boolean sColorizeMissingContactPictures = true;
private static boolean sMessageViewArchiveActionVisible = false;
private static boolean sMessageViewDeleteActionVisible = true;
private static boolean sMessageViewMoveActionVisible = false;
private static boolean sMessageViewCopyActionVisible = false;
private static boolean sMessageViewSpamActionVisible = false;
/**
* @see #areDatabasesUpToDate()
*/
@ -541,6 +548,13 @@ public class K9 extends Application {
editor.putBoolean("threadedView", sThreadedViewEnabled);
editor.putString("splitViewMode", sSplitViewMode.name());
editor.putBoolean("colorizeMissingContactPictures", sColorizeMissingContactPictures);
editor.putBoolean("messageViewArchiveActionVisible", sMessageViewArchiveActionVisible);
editor.putBoolean("messageViewDeleteActionVisible", sMessageViewDeleteActionVisible);
editor.putBoolean("messageViewMoveActionVisible", sMessageViewMoveActionVisible);
editor.putBoolean("messageViewCopyActionVisible", sMessageViewCopyActionVisible);
editor.putBoolean("messageViewSpamActionVisible", sMessageViewSpamActionVisible);
fontSizes.save(editor);
}
@ -766,6 +780,13 @@ public class K9 extends Application {
sColorizeMissingContactPictures = sprefs.getBoolean("colorizeMissingContactPictures", true);
sMessageViewArchiveActionVisible = sprefs.getBoolean("messageViewArchiveActionVisible", false);
sMessageViewDeleteActionVisible = sprefs.getBoolean("messageViewDeleteActionVisible", true);
sMessageViewMoveActionVisible = sprefs.getBoolean("messageViewMoveActionVisible", false);
sMessageViewCopyActionVisible = sprefs.getBoolean("messageViewCopyActionVisible", false);
sMessageViewSpamActionVisible = sprefs.getBoolean("messageViewSpamActionVisible", false);
K9.setK9Language(sprefs.getString("language", ""));
int themeValue = sprefs.getInt("theme", Theme.LIGHT.ordinal());
@ -1326,6 +1347,45 @@ public class K9 extends Application {
sColorizeMissingContactPictures = enabled;
}
public static boolean isMessageViewArchiveActionVisible() {
return sMessageViewArchiveActionVisible;
}
public static void setMessageViewArchiveActionVisible(boolean visible) {
sMessageViewArchiveActionVisible = visible;
}
public static boolean isMessageViewDeleteActionVisible() {
return sMessageViewDeleteActionVisible;
}
public static void setMessageViewDeleteActionVisible(boolean visible) {
sMessageViewDeleteActionVisible = visible;
}
public static boolean isMessageViewMoveActionVisible() {
return sMessageViewMoveActionVisible;
}
public static void setMessageViewMoveActionVisible(boolean visible) {
sMessageViewMoveActionVisible = visible;
}
public static boolean isMessageViewCopyActionVisible() {
return sMessageViewCopyActionVisible;
}
public static void setMessageViewCopyActionVisible(boolean visible) {
sMessageViewCopyActionVisible = visible;
}
public static boolean isMessageViewSpamActionVisible() {
return sMessageViewSpamActionVisible;
}
public static void setMessageViewSpamActionVisible(boolean visible) {
sMessageViewSpamActionVisible = visible;
}
/**
* Check if we already know whether all databases are using the current database schema.

View File

@ -973,8 +973,12 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|| !mMessageViewFragment.isInitialized()) {
menu.findItem(R.id.next_message).setVisible(false);
menu.findItem(R.id.previous_message).setVisible(false);
menu.findItem(R.id.delete).setVisible(false);
menu.findItem(R.id.single_message_options).setVisible(false);
menu.findItem(R.id.delete).setVisible(false);
menu.findItem(R.id.archive).setVisible(false);
menu.findItem(R.id.move).setVisible(false);
menu.findItem(R.id.copy).setVisible(false);
menu.findItem(R.id.spam).setVisible(false);
menu.findItem(R.id.refile).setVisible(false);
menu.findItem(R.id.toggle_unread).setVisible(false);
menu.findItem(R.id.select_text).setVisible(false);
@ -1022,19 +1026,43 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
menu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_read_action);
}
menu.findItem(R.id.copy).setVisible(mMessageViewFragment.isCopyCapable());
// Jellybean has built-in long press selection support
menu.findItem(R.id.select_text).setVisible(Build.VERSION.SDK_INT < 16);
menu.findItem(R.id.delete).setVisible(K9.isMessageViewDeleteActionVisible());
/*
* Set visibility of copy, move, archive, spam in action bar and refile submenu
*/
Menu refileSubmenu = menu.findItem(R.id.refile).getSubMenu();
if (mMessageViewFragment.isCopyCapable()) {
menu.findItem(R.id.copy).setVisible(K9.isMessageViewCopyActionVisible());
refileSubmenu.findItem(R.id.copy).setVisible(true);
} else {
menu.findItem(R.id.copy).setVisible(false);
refileSubmenu.findItem(R.id.copy).setVisible(false);
}
if (mMessageViewFragment.isMoveCapable()) {
menu.findItem(R.id.move).setVisible(true);
menu.findItem(R.id.archive).setVisible(mMessageViewFragment.canMessageBeArchived());
menu.findItem(R.id.spam).setVisible(mMessageViewFragment.canMessageBeMovedToSpam());
boolean canMessageBeArchived = mMessageViewFragment.canMessageBeArchived();
boolean canMessageBeMovedToSpam = mMessageViewFragment.canMessageBeMovedToSpam();
menu.findItem(R.id.move).setVisible(K9.isMessageViewMoveActionVisible());
menu.findItem(R.id.archive).setVisible(canMessageBeArchived &&
K9.isMessageViewArchiveActionVisible());
menu.findItem(R.id.spam).setVisible(canMessageBeMovedToSpam &&
K9.isMessageViewSpamActionVisible());
refileSubmenu.findItem(R.id.move).setVisible(true);
refileSubmenu.findItem(R.id.archive).setVisible(canMessageBeArchived);
refileSubmenu.findItem(R.id.spam).setVisible(canMessageBeMovedToSpam);
} else {
menu.findItem(R.id.move).setVisible(false);
menu.findItem(R.id.archive).setVisible(false);
menu.findItem(R.id.spam).setVisible(false);
menu.findItem(R.id.refile).setVisible(false);
}
if (mMessageViewFragment.allHeadersVisible()) {
@ -1042,7 +1070,6 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
} else {
menu.findItem(R.id.hide_headers).setVisible(false);
}
}

View File

@ -76,6 +76,7 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_MESSAGELIST_COLORIZE_MISSING_CONTACT_PICTURES =
"messagelist_colorize_missing_contact_pictures";
private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
private static final String PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS = "messageview_visible_refile_actions";
private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
private static final String PREFERENCE_MESSAGEVIEW_SHOW_NEXT = "messageview_show_next";
@ -99,6 +100,12 @@ public class Prefs extends K9PreferenceActivity {
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 mTheme;
@ -133,6 +140,7 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mDebugLogging;
private CheckBoxPreference mSensitiveLogging;
private CheckBoxPreference mWrapFolderNames;
private CheckBoxListPreference mVisibleRefileActions;
private CheckBoxPreference mQuietTimeEnabled;
private com.fsck.k9.preferences.TimePickerPreference mQuietTimeStarts;
@ -410,6 +418,24 @@ public class Prefs extends K9PreferenceActivity {
mWrapFolderNames = (CheckBoxPreference)findPreference(PREFERENCE_FOLDERLIST_WRAP_NAME);
mWrapFolderNames.setChecked(K9.wrapFolderNames());
mVisibleRefileActions = (CheckBoxListPreference) findPreference(PREFERENCE_MESSAGEVIEW_VISIBLE_REFILE_ACTIONS);
CharSequence[] visibleRefileActionsEntries = new CharSequence[5];
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_DELETE] = getString(R.string.delete_action);
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_ARCHIVE] = getString(R.string.archive_action);
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_MOVE] = getString(R.string.move_action);
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_COPY] = getString(R.string.copy_action);
visibleRefileActionsEntries[VISIBLE_REFILE_ACTIONS_SPAM] = getString(R.string.spam_action);
boolean[] visibleRefileActionsValues = new boolean[5];
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_DELETE] = K9.isMessageViewDeleteActionVisible();
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_ARCHIVE] = K9.isMessageViewArchiveActionVisible();
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_MOVE] = K9.isMessageViewMoveActionVisible();
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_COPY] = K9.isMessageViewCopyActionVisible();
visibleRefileActionsValues[VISIBLE_REFILE_ACTIONS_SPAM] = K9.isMessageViewSpamActionVisible();
mVisibleRefileActions.setItems(visibleRefileActionsEntries);
mVisibleRefileActions.setCheckedItems(visibleRefileActionsValues);
mSplitViewMode = (ListPreference) findPreference(PREFERENCE_SPLITVIEW_MODE);
initListPreference(mSplitViewMode, K9.getSplitViewMode().name(),
mSplitViewMode.getEntries(), mSplitViewMode.getEntryValues());
@ -479,6 +505,13 @@ public class Prefs extends K9PreferenceActivity {
K9.setAutofitWidth(mAutofitWidth.isChecked());
K9.setQuietTimeEnabled(mQuietTimeEnabled.isChecked());
boolean[] enabledRefileActions = mVisibleRefileActions.getCheckedItems();
K9.setMessageViewDeleteActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_DELETE]);
K9.setMessageViewArchiveActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_ARCHIVE]);
K9.setMessageViewMoveActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_MOVE]);
K9.setMessageViewCopyActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_COPY]);
K9.setMessageViewSpamActionVisible(enabledRefileActions[VISIBLE_REFILE_ACTIONS_SPAM]);
K9.setQuietTimeStarts(mQuietTimeStarts.getTime());
K9.setQuietTimeEnds(mQuietTimeEnds.getTime());
K9.setWrapFolderNames(mWrapFolderNames.isChecked());

View File

@ -230,6 +230,21 @@ public class GlobalSettings {
s.put("colorizeMissingContactPictures", Settings.versions(
new V(29, new BooleanSetting(true))
));
s.put("messageViewDeleteActionVisible", Settings.versions(
new V(30, new BooleanSetting(true))
));
s.put("messageViewArchiveActionVisible", Settings.versions(
new V(30, new BooleanSetting(false))
));
s.put("messageViewMoveActionVisible", Settings.versions(
new V(30, new BooleanSetting(false))
));
s.put("messageViewCopyActionVisible", Settings.versions(
new V(30, new BooleanSetting(false))
));
s.put("messageViewSpamActionVisible", Settings.versions(
new V(30, new BooleanSetting(false))
));
SETTINGS = Collections.unmodifiableMap(s);

View File

@ -35,7 +35,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 28;
public static final int VERSION = 30;
public static Map<String, Object> validate(int version, Map<String,
TreeMap<Integer, SettingsDescription>> settings,