add an option for showing hidden folders
This commit is contained in:
parent
848fe154be
commit
cae1c040ec
11 changed files with 57 additions and 1 deletions
|
@ -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<String> hiddenFolders = getHiddenFolders();
|
||||
hiddenFolders.add(path);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -66,5 +66,33 @@
|
|||
android:clickable="false"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_hidden_folders_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_padding"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/settings_show_hidden_folders_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="@dimen/settings_padding"
|
||||
android:paddingStart="@dimen/settings_padding"
|
||||
android:text="@string/show_hidden_folders"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/settings_show_hidden_folders"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@null"
|
||||
android:clickable="false"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<string name="settings">Einstellungen</string>
|
||||
<string name="dark_theme">Dunkles Thema</string>
|
||||
<string name="same_sorting">Selbe Sortierung für Dateien und Ordner</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke.</string>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<string name="settings">Ajustes</string>
|
||||
<string name="dark_theme">Tema oscuro</string>
|
||||
<string name="same_sorting">Ordenar del mismo modo los archivos y las carpetas</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias.</string>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<string name="settings">Impostazioni</string>
|
||||
<string name="dark_theme">Tema scuro</string>
|
||||
<string name="same_sorting">Same sorting for files and folders</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie.</string>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<string name="settings">設定</string>
|
||||
<string name="dark_theme">ダークテーマ</string>
|
||||
<string name="same_sorting">Same sorting for files and folders</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">このアプリは、私の人生を容易にするために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。</string>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<string name="settings">Definições</string>
|
||||
<string name="dark_theme">Tema escuro</string>
|
||||
<string name="same_sorting">A mesma ordenação para ficheiros e pastas</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado.</string>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
<string name="settings">Inställningar</string>
|
||||
<string name="dark_theme">Mörkt tema</string>
|
||||
<string name="same_sorting">Same sorting for files and folders</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack.</string>
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
<string name="settings">Settings</string>
|
||||
<string name="dark_theme">Dark theme</string>
|
||||
<string name="same_sorting">Same sorting for files and folders</string>
|
||||
<string name="show_hidden_folders">Show hidden folders</string>
|
||||
|
||||
<!-- License -->
|
||||
<string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string>
|
||||
|
|
Loading…
Reference in a new issue