diff --git a/app/src/main/java/com/simplemobiletools/gallery/Config.java b/app/src/main/java/com/simplemobiletools/gallery/Config.java index 9218d6b0e..cebe037bb 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Config.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Config.java @@ -30,6 +30,14 @@ public class Config { mPrefs.edit().putBoolean(Constants.IS_DARK_THEME, isDarkTheme).apply(); } + public boolean getIsSameSorting() { + return mPrefs.getBoolean(Constants.IS_SAME_SORTING, true); + } + + public void setIsSameSorting(boolean isSameSorting) { + mPrefs.edit().putBoolean(Constants.IS_SAME_SORTING, isSameSorting).apply(); + } + public int getSorting() { return mPrefs.getInt(Constants.SORT_ORDER, Constants.SORT_BY_DATE | Constants.SORT_DESCENDING); } diff --git a/app/src/main/java/com/simplemobiletools/gallery/Constants.java b/app/src/main/java/com/simplemobiletools/gallery/Constants.java index c5a083303..710516b8b 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Constants.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Constants.java @@ -11,6 +11,7 @@ public class Constants { public static final String PREFS_KEY = "Gallery"; public static final String IS_FIRST_RUN = "is_first_run"; public static final String IS_DARK_THEME = "is_dark_theme"; + public static final String IS_SAME_SORTING = "is_same_sorting"; public static final String SORT_ORDER = "sort_order"; public static final String DIRECTORY_SORT_ORDER = "directory_sort_order"; diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java index 8ab9dd9a9..66f1335f8 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java @@ -13,6 +13,7 @@ import butterknife.OnClick; public class SettingsActivity extends SimpleActivity { @BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch; + @BindView(R.id.settings_same_sorting) SwitchCompat mSameSortingSwitch; private static Config mConfig; @@ -24,12 +25,17 @@ public class SettingsActivity extends SimpleActivity { ButterKnife.bind(this); setupDarkTheme(); + setupSameSorting(); } private void setupDarkTheme() { mDarkThemeSwitch.setChecked(mConfig.getIsDarkTheme()); } + private void setupSameSorting() { + mSameSortingSwitch.setChecked(mConfig.getIsSameSorting()); + } + @OnClick(R.id.settings_dark_theme_holder) public void handleDarkTheme() { mDarkThemeSwitch.setChecked(!mDarkThemeSwitch.isChecked()); @@ -37,6 +43,12 @@ public class SettingsActivity extends SimpleActivity { restartActivity(); } + @OnClick(R.id.settings_same_sorting_holder) + public void handleSameSorting() { + mSameSortingSwitch.setChecked(!mSameSortingSwitch.isChecked()); + mConfig.setIsSameSorting(mSameSortingSwitch.isChecked()); + } + private void restartActivity() { TaskStackBuilder.create(getApplicationContext()).addNextIntentWithParentStack(getIntent()).startActivities(); } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 9d993a182..46e91737b 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -36,5 +36,31 @@ android:clickable="false"/> + + + + + + + + diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 0726a6fe3..7c18e9c00 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -54,6 +54,7 @@ Impostazioni Tema scuro + Same sorting for files and folders Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie. diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 70a91a166..0836afd0d 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -54,6 +54,7 @@ 設定 ダークテーマ + Same sorting for files and folders このアプリは、私の人生を容易にするために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。 diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index dc80c592d..8007406df 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -54,6 +54,7 @@ Inställningar Mörkt tema + Same sorting for files and folders Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 04616e069..09a38bfa3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -55,6 +55,7 @@ Settings Dark theme + Same sorting for files and folders This app uses the following third party libraries to make my life easier. Thank you.