From cae1c040ecac20651eb976b8f61fb6459687dd02 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 9 Oct 2016 14:14:58 +0200 Subject: [PATCH] add an option for showing hidden folders --- .../com/simplemobiletools/gallery/Config.java | 8 ++++++ .../simplemobiletools/gallery/Constants.java | 3 +- .../gallery/activities/SettingsActivity.java | 12 ++++++++ app/src/main/res/layout/activity_settings.xml | 28 +++++++++++++++++++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pt-rPT/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 11 files changed, 57 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/Config.java b/app/src/main/java/com/simplemobiletools/gallery/Config.java index 6806cfd19..650f6342a 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Config.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Config.java @@ -63,6 +63,14 @@ public class Config { mPrefs.edit().putInt(Constants.DIRECTORY_SORT_ORDER, order).apply(); } + public boolean getShowHiddenFolders() { + return mPrefs.getBoolean(Constants.SHOW_HIDDEN_FOLDERS, false); + } + + public void setShowHiddenFolders(boolean showHiddenFolders) { + mPrefs.edit().putBoolean(Constants.SHOW_HIDDEN_FOLDERS, showHiddenFolders).apply(); + } + public void addHiddenDirectory(String path) { final Set hiddenFolders = getHiddenFolders(); hiddenFolders.add(path); diff --git a/app/src/main/java/com/simplemobiletools/gallery/Constants.java b/app/src/main/java/com/simplemobiletools/gallery/Constants.java index eb18fb5a9..2cd5c35a6 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/Constants.java +++ b/app/src/main/java/com/simplemobiletools/gallery/Constants.java @@ -15,7 +15,8 @@ public class Constants { 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"; - public static final String HIDDEN_FOLDERS = "hidden_foldersy"; + public static final String HIDDEN_FOLDERS = "hidden_folders"; + public static final String SHOW_HIDDEN_FOLDERS = "show_hidden_folders"; // sorting public static final int SORT_BY_NAME = 1; 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 66f1335f8..7f4655dbc 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java @@ -14,6 +14,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; + @BindView(R.id.settings_show_hidden_folders) SwitchCompat mShowHiddenFoldersSwitch; private static Config mConfig; @@ -26,6 +27,7 @@ public class SettingsActivity extends SimpleActivity { setupDarkTheme(); setupSameSorting(); + setupShowHiddenFolders(); } private void setupDarkTheme() { @@ -36,6 +38,10 @@ public class SettingsActivity extends SimpleActivity { mSameSortingSwitch.setChecked(mConfig.getIsSameSorting()); } + private void setupShowHiddenFolders() { + mShowHiddenFoldersSwitch.setChecked(mConfig.getShowHiddenFolders()); + } + @OnClick(R.id.settings_dark_theme_holder) public void handleDarkTheme() { mDarkThemeSwitch.setChecked(!mDarkThemeSwitch.isChecked()); @@ -49,6 +55,12 @@ public class SettingsActivity extends SimpleActivity { mConfig.setIsSameSorting(mSameSortingSwitch.isChecked()); } + @OnClick(R.id.settings_show_hidden_folders_holder) + public void handleShowHiddenFolders() { + mShowHiddenFoldersSwitch.setChecked(!mShowHiddenFoldersSwitch.isChecked()); + mConfig.setShowHiddenFolders(mShowHiddenFoldersSwitch.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 7d10a0eb1..ae26ba795 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -66,5 +66,33 @@ android:clickable="false"/> + + + + + + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 789d701d8..2f9398378 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -79,6 +79,7 @@ Einstellungen Dunkles Thema Selbe Sortierung für Dateien und Ordner + Show hidden folders Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke. diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 59fd5d8e1..f1215934e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -79,6 +79,7 @@ Ajustes Tema oscuro Ordenar del mismo modo los archivos y las carpetas + Show hidden folders Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5440dd3ed..5f73f4cc5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -79,6 +79,7 @@ Impostazioni Tema scuro Same sorting for files and folders + Show hidden 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 cd8ffcde7..6dfcbb62e 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -79,6 +79,7 @@ 設定 ダークテーマ Same sorting for files and folders + Show hidden folders このアプリは、私の人生を容易にするために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。 diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index e060bd5b6..70590722b 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -79,6 +79,7 @@ Definições Tema escuro A mesma ordenação para ficheiros e pastas + Show hidden folders Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado. diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index dfd47bcba..03ed5c35f 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -79,6 +79,7 @@ Inställningar Mörkt tema Same sorting for files and folders + Show hidden 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 046e57f4a..491934761 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -80,6 +80,7 @@ Settings Dark theme Same sorting for files and folders + Show hidden folders This app uses the following third party libraries to make my life easier. Thank you.