1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 10:05:49 +01:00

allow to switch to dark theme im settings

This commit is contained in:
Andreas Shimokawa 2016-04-14 16:15:58 +02:00
parent 367aced03d
commit f76a1ba16f
4 changed files with 24 additions and 7 deletions

View File

@ -195,11 +195,7 @@ public class GBApplication extends Application {
public static void releaseDB() {
dbLock.unlock();
}
public static boolean isRunningOnKitkatOrLater() {
return VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
}
public static boolean isRunningLollipopOrLater() {
return VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}
@ -299,7 +295,7 @@ public class GBApplication extends Application {
editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION));
break;
}
editor.commit();
editor.apply();
}
public static LimitedQueue getIDSenderLookup() {
@ -307,6 +303,6 @@ public class GBApplication extends Application {
}
public static boolean isDarkThemeEnabled() {
return false;
return sharedPrefs.getString("pref_key_theme", context.getString(R.string.pref_theme_value_light)).equals(context.getString(R.string.pref_theme_value_dark));
}
}

View File

@ -1,5 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_theme_options">
<item>@string/pref_theme_light</item>
<item>@string/pref_theme_dark</item>
</string-array>
<string-array name="pref_theme_values">
<item>@string/pref_theme_value_light</item>
<item>@string/pref_theme_value_dark</item>
</string-array>
<string name="pref_theme_value_light" translatable="false">light</string>
<string name="pref_theme_value_dark" translatable="false">dark</string>
<string-array name="notification_mode">
<item>@string/always</item>
<item>@string/when_screen_off</item>

View File

@ -39,6 +39,9 @@
<string name="pref_header_datetime">Date and Time</string>
<string name="pref_title_datetime_syctimeonconnect">Sync time</string>
<string name="pref_summary_datetime_syctimeonconnect">Sync time to device when connecting and when time or timezone changes on Android</string>
<string name="pref_title_theme">Theme</string>
<string name="pref_theme_light">Light</string>
<string name="pref_theme_dark">Dark</string>
<string name="pref_header_notifications">Notifications</string>
<string name="pref_title_notifications_repetitions">Repetitions</string>

View File

@ -11,6 +11,13 @@
android:defaultValue="default"
android:key="audio_player"
android:title="@string/pref_title_audo_player" />
<ListPreference
android:key="pref_key_theme"
android:title="@string/pref_title_theme"
android:entries="@array/pref_theme_options"
android:entryValues="@array/pref_theme_values"
android:defaultValue="@string/pref_theme_value_light"
android:summary="%s" />
</PreferenceCategory>
<PreferenceCategory
android:key="pref_key_datetime"