add a switch for showing full folder paths

This commit is contained in:
tibbi 2016-09-05 20:47:49 +02:00
parent 7416c22c32
commit 252803eaa6
9 changed files with 54 additions and 2 deletions

View file

@ -37,4 +37,12 @@ public class Config {
public void setShowHidden(boolean show) {
mPrefs.edit().putBoolean(Constants.SHOW_HIDDEN, show).apply();
}
public boolean getShowFullPath() {
return mPrefs.getBoolean(Constants.SHOW_FULL_PATH, false);
}
public void setShowFullPath(boolean show) {
mPrefs.edit().putBoolean(Constants.SHOW_FULL_PATH, show).apply();
}
}

View file

@ -8,4 +8,5 @@ public class Constants {
public static final String IS_FIRST_RUN = "is_first_run";
public static final String IS_DARK_THEME = "is_dark_theme";
public static final String SHOW_HIDDEN = "show_hidden";
public static final String SHOW_FULL_PATH = "show_full_path";
}

View file

@ -14,6 +14,7 @@ import butterknife.OnClick;
public class SettingsActivity extends SimpleActivity {
@BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch;
@BindView(R.id.settings_show_hidden) SwitchCompat mShowHiddenSwitch;
@BindView(R.id.settings_show_full_path) SwitchCompat mShowFullPathSwitch;
private static Config mConfig;
@ -26,6 +27,7 @@ public class SettingsActivity extends SimpleActivity {
setupDarkTheme();
setupShowHidden();
setupShowFullPath();
}
private void setupDarkTheme() {
@ -36,6 +38,10 @@ public class SettingsActivity extends SimpleActivity {
mShowHiddenSwitch.setChecked(mConfig.getShowHidden());
}
private void setupShowFullPath() {
mShowFullPathSwitch.setChecked(mConfig.getShowFullPath());
}
@OnClick(R.id.settings_dark_theme_holder)
public void handleDarkTheme() {
mDarkThemeSwitch.setChecked(!mDarkThemeSwitch.isChecked());
@ -49,6 +55,12 @@ public class SettingsActivity extends SimpleActivity {
mConfig.setShowHidden(mShowHiddenSwitch.isChecked());
}
@OnClick(R.id.settings_show_full_path_holder)
public void handleShowFullPath() {
mShowFullPathSwitch.setChecked(!mShowFullPathSwitch.isChecked());
mConfig.setShowFullPath(mShowFullPathSwitch.isChecked());
}
private void restartActivity() {
TaskStackBuilder.create(getApplicationContext()).addNextIntentWithParentStack(getIntent()).startActivities();
}

View file

@ -16,7 +16,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding"
android:background="?android:attr/selectableItemBackground"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<TextView
@ -42,7 +42,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/settings_padding"
android:background="?android:attr/selectableItemBackground"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<TextView
@ -62,5 +62,31 @@
android:clickable="false"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_full_path_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_full_path_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/settings_padding"
android:text="@string/show_full_path"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/settings_show_full_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@null"
android:clickable="false"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

View file

@ -65,4 +65,5 @@
<string name="settings">Einstellungen</string>
<string name="dark_theme">Dunkles Thema</string>
<string name="show_hidden">Zeige versteckte Dateien und Ordner</string>
<string name="show_full_path">Show full path</string>
</resources>

View file

@ -65,4 +65,5 @@
<string name="settings">Impostazioni</string>
<string name="dark_theme">Tema scuro</string>
<string name="show_hidden">Mostra file e cartelle nascosti</string>
<string name="show_full_path">Show full path</string>
</resources>

View file

@ -65,4 +65,5 @@
<string name="settings">設定</string>
<string name="dark_theme">ダークテーマ</string>
<string name="show_hidden">非表示のファイルとディレクトリーを表示する</string>
<string name="show_full_path">Show full path</string>
</resources>

View file

@ -65,4 +65,5 @@
<string name="settings">Settings</string>
<string name="dark_theme">Mörkt tema</string>
<string name="show_hidden">Visa dolda filer</string>
<string name="show_full_path">Show full path</string>
</resources>

View file

@ -68,4 +68,5 @@
<string name="settings">Settings</string>
<string name="dark_theme">Dark theme</string>
<string name="show_hidden">Show hidden files and directories</string>
<string name="show_full_path">Show full path</string>
</resources>