Eliminate summary for dark theme since it has only a bool value

This commit is contained in:
stefan-niedermann 2019-02-09 19:22:18 +01:00
parent 465ee9294b
commit 41054d5b7e
3 changed files with 3 additions and 10 deletions

View file

@ -1,11 +1,9 @@
package it.niedermann.owncloud.notes.android.fragment;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.preference.SwitchPreference;
import android.util.Log;
import android.widget.Toast;
@ -28,11 +26,7 @@ public class PreferencesFragment extends PreferenceFragment {
return true;
});
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
final SwitchPreference themePref = (SwitchPreference) findPreference(getString(R.string.pref_key_theme));
themePref.setSummary(sp.getBoolean(getString(R.string.pref_key_theme), false) ?
getString(R.string.pref_value_theme_dark) : getString(R.string.pref_value_theme_light));
themePref.setOnPreferenceChangeListener((Preference preference, Object newValue) -> {
Boolean darkTheme = (Boolean) newValue;
Notes.setAppTheme(darkTheme);

View file

@ -54,9 +54,9 @@
<string name="settings_submit">Connect</string>
<string name="settings_submitting">Connecting &#8230;</string>
<string name="settings_note_mode">Display mode for notes</string>
<string name="settings_theme_title">Theme</string>
<string name="settings_theme_title">Dark theme</string>
<string name="settings_font_title">Monospace font</string>
<string name="settings_theme_wifi_only">Sync only on Wi-Fi</string>
<string name="settings_wifi_only">Sync only on Wi-Fi</string>
<string name="settings_cert_category">Manage certificates</string>
<string name="settings_cert_trust_system">Trust system certificates</string>
<string name="settings_cert_trust_system_on">System and user-added CAs will be trusted (recommended)</string>

View file

@ -22,13 +22,12 @@
android:defaultValue="@string/pref_value_wifi_and_mobile"
android:icon="@drawable/ic_sync_black_24dp"
android:key="@string/pref_key_wifi_only"
android:title="@string/settings_theme_wifi_only" />
android:title="@string/settings_wifi_only" />
<SwitchPreference
android:defaultValue="@string/pref_value_theme_light"
android:icon="@drawable/ic_brightness_2_grey_24dp"
android:key="@string/pref_key_theme"
android:summary="%s"
android:title="@string/settings_theme_title" />
<SwitchPreference