diff --git a/res/values/arrays.xml b/res/values/arrays.xml index d2b1d226e..756bf6838 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -713,4 +713,15 @@ ALWAYS + + @string/global_settings_splitview_always + @string/global_settings_splitview_never + @string/global_settings_splitview_when_in_landscape + + + + ALWAYS + NEVER + WHEN_IN_LANDSCAPE + diff --git a/res/values/strings.xml b/res/values/strings.xml index 6301f66e1..4be74e7a0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4,7 +4,7 @@ @@ -1129,4 +1129,9 @@ Please submit bug reports, contribute new features and ask questions at Upgrading database of account \"%s\" Loading… + + Show split-screen + Always + Never + When in Landscape orientation diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index cb90924ea..c06d15ddb 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -156,6 +156,14 @@ android:title="@string/global_settings_threaded_view_label" android:summary="@string/global_settings_threaded_view_summary" /> + + 0) { + if (mDisplayMode == DisplayMode.MESSAGE_VIEW) { + showMessageList(); + } else if (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack(); - showMessageViewPlaceHolder(); } else if (mMessageListFragment.isManualSearch()) { onBackPressed(); } else if (!mSingleFolderMode) { @@ -871,4 +951,20 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme private void showNextMessage() { //TODO: implement } + + private void showMessageList() { + mDisplayMode = DisplayMode.MESSAGE_LIST; + + mMessageViewContainer.setVisibility(View.GONE); + mMessageListContainer.setVisibility(View.VISIBLE); + removeMessageViewFragment(); + mMessageListFragment.setActiveMessage(null); + } + + private void showMessageView() { + mDisplayMode = DisplayMode.MESSAGE_VIEW; + + mMessageListContainer.setVisibility(View.GONE); + mMessageViewContainer.setVisibility(View.VISIBLE); + } } diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index f7200fba3..2bcda2533 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -24,6 +24,7 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.K9.NotificationHideSubject; import com.fsck.k9.K9.NotificationQuickDelete; +import com.fsck.k9.K9.SplitViewMode; import com.fsck.k9.Preferences; import com.fsck.k9.R; import com.fsck.k9.activity.ColorPickerDialog; @@ -93,6 +94,7 @@ public class Prefs extends K9PreferenceActivity { private static final String PREFERENCE_BACKGROUND_AS_UNREAD_INDICATOR = "messagelist_background_as_unread_indicator"; private static final String PREFERENCE_THREADED_VIEW = "threaded_view"; private static final String PREFERENCE_FOLDERLIST_WRAP_NAME = "folderlist_wrap_folder_name"; + private static final String PREFERENCE_SPLITVIEW_MODE = "splitview_mode"; private static final int ACTIVITY_CHOOSE_FOLDER = 1; @@ -139,6 +141,7 @@ public class Prefs extends K9PreferenceActivity { private CheckBoxPreference mBatchButtonsUnselect; private CheckBoxPreference mBackgroundAsUnreadIndicator; private CheckBoxPreference mThreadedView; + private ListPreference mSplitViewMode; public static void actionPrefs(Context context) { @@ -396,7 +399,7 @@ public class Prefs extends K9PreferenceActivity { } }; }); - + mWrapFolderNames = (CheckBoxPreference)findPreference(PREFERENCE_FOLDERLIST_WRAP_NAME); mWrapFolderNames.setChecked(K9.wrapFolderNames()); @@ -425,6 +428,10 @@ public class Prefs extends K9PreferenceActivity { mBatchButtonsArchive.setEnabled(false); mBatchButtonsArchive.setSummary(R.string.global_settings_archive_disabled_reason); } + + mSplitViewMode = (ListPreference) findPreference(PREFERENCE_SPLITVIEW_MODE); + initListPreference(mSplitViewMode, K9.getSplitViewMode().name(), + mSplitViewMode.getEntries(), mSplitViewMode.getEntryValues()); } private void saveSettings() { @@ -487,6 +494,7 @@ public class Prefs extends K9PreferenceActivity { K9.setBatchButtonsFlag(mBatchButtonsFlag.isChecked()); K9.setBatchButtonsUnselect(mBatchButtonsUnselect.isChecked()); + K9.setSplitViewMode(SplitViewMode.valueOf(mSplitViewMode.getValue())); K9.setAttachmentDefaultPath(mAttachmentPathPreference.getSummary().toString()); boolean needsRefresh = K9.setBackgroundOps(mBackgroundOps.getValue()); K9.setUseGalleryBugWorkaround(mUseGalleryBugWorkaround.isChecked()); diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index 8fb83f3bf..3b28b9f26 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -18,6 +18,7 @@ import com.fsck.k9.Account; import com.fsck.k9.FontSizes; import com.fsck.k9.K9; import com.fsck.k9.K9.NotificationHideSubject; +import com.fsck.k9.K9.SplitViewMode; import com.fsck.k9.R; import com.fsck.k9.Account.SortType; import com.fsck.k9.helper.DateFormatter; @@ -228,6 +229,9 @@ public class GlobalSettings { s.put("threadedView", Settings.versions( new V(20, new BooleanSetting(true)) )); + s.put("splitViewMode", Settings.versions( + new V(23, new EnumSetting(SplitViewMode.class, SplitViewMode.WHEN_IN_LANDSCAPE)) + )); SETTINGS = Collections.unmodifiableMap(s); diff --git a/src/com/fsck/k9/preferences/Settings.java b/src/com/fsck/k9/preferences/Settings.java index 39431cb28..a5e2cfb04 100644 --- a/src/com/fsck/k9/preferences/Settings.java +++ b/src/com/fsck/k9/preferences/Settings.java @@ -35,7 +35,7 @@ public class Settings { * * @see SettingsExporter */ - public static final int VERSION = 22; + public static final int VERSION = 23; public static Map validate(int version, Map> settings,