mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Add option for AMOLED night mode
This commit is contained in:
@@ -202,8 +202,17 @@ public abstract class UIHelper
|
||||
switch(getCurrentTheme())
|
||||
{
|
||||
case THEME_DARK:
|
||||
activity.setTheme(R.style.AppBaseThemeDark);
|
||||
{
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
boolean pureBlackEnabled = prefs.getBoolean("pref_pure_black", false);
|
||||
|
||||
if(pureBlackEnabled)
|
||||
activity.setTheme(R.style.AppBaseThemeDark_PureBlack);
|
||||
else
|
||||
activity.setTheme(R.style.AppBaseThemeDark);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case THEME_LIGHT:
|
||||
default:
|
||||
|
||||
@@ -157,4 +157,7 @@
|
||||
<string name="troubleshooting">Troubleshooting</string>
|
||||
<string name="help_translate">Help translate this app</string>
|
||||
<string name="night_mode">Night mode</string>
|
||||
<string name="use_pure_black">Pure black for night mode</string>
|
||||
<string name="pure_black_description">Use pure black instead of grey backgrounds in night mode . Reduces battery usage in phones with AMOLED display.</string>
|
||||
<string name="interface_preferences">Interface</string>
|
||||
</resources>
|
||||
@@ -21,8 +21,8 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="behaviorCategory"
|
||||
android:title="@string/behavior">
|
||||
android:key="interfaceCategory"
|
||||
android:title="@string/interface_preferences">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
@@ -30,6 +30,18 @@
|
||||
android:summary="@string/pref_toggle_description"
|
||||
android:title="@string/pref_toggle_title"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="pref_pure_black"
|
||||
android:summary="@string/pure_black_description"
|
||||
android:title="@string/use_pure_black"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="reminderCategory"
|
||||
android:title="@string/reminder">
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="@string/snooze_interval_default"
|
||||
android:dialogTitle="@string/snooze_interval"
|
||||
|
||||
Reference in New Issue
Block a user