mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Add black background to Dark Theme
This commit is contained in:
parent
7c6e565367
commit
c5aaaec7e3
@ -975,6 +975,10 @@ public class GBApplication extends Application {
|
||||
&& (umm.getNightMode() == UiModeManager.MODE_NIGHT_YES));
|
||||
}
|
||||
|
||||
public static boolean isAmoledBlackEnabled() {
|
||||
return prefs.getBoolean("pref_key_theme_amoled_black", false);
|
||||
}
|
||||
|
||||
public static int getTextColor(Context context) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
|
@ -71,9 +71,15 @@ public abstract class AbstractGBActivity extends AppCompatActivity implements GB
|
||||
public static void init(GBActivity activity, int flags) {
|
||||
if (GBApplication.isDarkThemeEnabled()) {
|
||||
if ((flags & NO_ACTIONBAR) != 0) {
|
||||
activity.setTheme(R.style.GadgetbridgeThemeDark_NoActionBar);
|
||||
if (GBApplication.isAmoledBlackEnabled())
|
||||
activity.setTheme(R.style.GadgetbridgeThemeBlack_NoActionBar);
|
||||
else
|
||||
activity.setTheme(R.style.GadgetbridgeThemeDark_NoActionBar);
|
||||
} else {
|
||||
activity.setTheme(R.style.GadgetbridgeThemeDark);
|
||||
if (GBApplication.isAmoledBlackEnabled())
|
||||
activity.setTheme(R.style.GadgetbridgeThemeBlack);
|
||||
else
|
||||
activity.setTheme(R.style.GadgetbridgeThemeDark);
|
||||
}
|
||||
} else {
|
||||
if ((flags & NO_ACTIONBAR) != 0) {
|
||||
|
@ -203,6 +203,8 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
pref = findPreference("language");
|
||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
@ -393,6 +395,27 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||
audioPlayer.setEntries(newEntries);
|
||||
audioPlayer.setEntryValues(newValues);
|
||||
audioPlayer.setDefaultValue(newValues[0]);
|
||||
|
||||
final Preference theme = (ListPreference) findPreference("pref_key_theme");
|
||||
final Preference amoled_black = findPreference("pref_key_theme_amoled_black");
|
||||
|
||||
String selectedTheme = prefs.getString("pref_key_theme", SettingsActivity.this.getString(R.string.pref_theme_value_system));
|
||||
if (selectedTheme.equals("light"))
|
||||
amoled_black.setEnabled(false);
|
||||
else
|
||||
amoled_black.setEnabled(true);
|
||||
|
||||
theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||
final String val = newVal.toString();
|
||||
if (val.equals("light"))
|
||||
amoled_black.setEnabled(false);
|
||||
else
|
||||
amoled_black.setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,6 +14,7 @@
|
||||
<color name="secondarytext" type="color">#ff808080</color>
|
||||
<color name="tertiarytext_light" type="color">#ffd0d0d0</color>
|
||||
<color name="tertiarytext_dark" type="color">#ff606060</color>
|
||||
<color name="tertiarytext_black" type="color">#000000</color>
|
||||
|
||||
<color name="divider" type="color">#1f000000</color>
|
||||
|
||||
|
@ -111,6 +111,7 @@
|
||||
<string name="pref_theme_light">Light</string>
|
||||
<string name="pref_theme_dark">Dark</string>
|
||||
<string name="pref_theme_system">System</string>
|
||||
<string name="pref_theme_black_background">Use black background in Dark Theme</string>
|
||||
<string name="pref_title_language">Language</string>
|
||||
<string name="pref_title_minimize_priority">Hide the Gadgetbridge notification</string>
|
||||
<string name="pref_summary_minimize_priority_off">The icon in the status bar and the notification in the lockscreen are shown</string>
|
||||
|
@ -47,6 +47,30 @@
|
||||
|
||||
</style>
|
||||
|
||||
<!-- black theme -->
|
||||
<style name="GadgetbridgeThemeBlack" parent="Theme.AppCompat">
|
||||
<item name="textColorPrimary">@color/primarytext_dark</item>
|
||||
<item name="textColorSecondary">@color/secondarytext</item>
|
||||
<item name="textColorTertiary">@color/tertiarytext_dark</item>
|
||||
<item name="android:windowBackground">@android:color/black</item>
|
||||
|
||||
<item name="colorPrimary">@color/primary_dark</item>
|
||||
<item name="colorPrimaryDark">@color/primarydark_dark</item>
|
||||
<item name="colorAccent">@color/accent</item>
|
||||
|
||||
<item name="android:buttonStyle">@style/ButtonDark</item>
|
||||
<item name="buttonStyle">@style/ButtonDark</item>
|
||||
|
||||
<item name="chart_deep_sleep">@color/chart_deep_sleep_dark</item>
|
||||
<item name="chart_light_sleep">@color/chart_light_sleep_dark</item>
|
||||
<item name="chart_activity">@color/chart_activity_dark</item>
|
||||
<item name="chart_not_worn">@color/chart_not_worn_dark</item>
|
||||
<item name="alternate_row_background">@color/alternate_row_background_dark</item>
|
||||
<item name="sports_activity_summary_background">@color/alternate_row_background_dark</item>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<style name="ButtonDark" parent="Widget.AppCompat.Button.Colored">
|
||||
<item name="android:textColor">@color/btn_dark</item>
|
||||
</style>
|
||||
@ -56,6 +80,12 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="GadgetbridgeThemeBlack.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="GadgetbridgeTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="GadgetbridgeTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
@ -31,13 +31,21 @@
|
||||
android:key="audio_player"
|
||||
android:title="@string/pref_title_audio_player"
|
||||
android:summary="%s" />
|
||||
<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" />
|
||||
|
||||
<PreferenceScreen android:title="@string/pref_title_theme">
|
||||
<ListPreference
|
||||
android:defaultValue="@string/pref_theme_value_light"
|
||||
android:entries="@array/pref_theme_options"
|
||||
android:entryValues="@array/pref_theme_values"
|
||||
android:key="pref_key_theme"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_theme" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_key_theme_amoled_black"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_theme_black_background" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="language_category"
|
||||
|
Loading…
Reference in New Issue
Block a user