For #1399 - Only show battery saver theme preference for API <P
parent
203e2e28c5
commit
3ad204712a
|
@ -152,12 +152,14 @@ open class FenixApplication : Application() {
|
||||||
AppCompatDelegate.MODE_NIGHT_YES
|
AppCompatDelegate.MODE_NIGHT_YES
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Settings.getInstance(this).shouldUseAutoBatteryTheme -> {
|
android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.P &&
|
||||||
|
Settings.getInstance(this).shouldUseAutoBatteryTheme -> {
|
||||||
AppCompatDelegate.setDefaultNightMode(
|
AppCompatDelegate.setDefaultNightMode(
|
||||||
AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
|
AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Settings.getInstance(this).shouldFollowDeviceTheme -> {
|
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P &&
|
||||||
|
Settings.getInstance(this).shouldFollowDeviceTheme -> {
|
||||||
AppCompatDelegate.setDefaultNightMode(
|
AppCompatDelegate.setDefaultNightMode(
|
||||||
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||||
)
|
)
|
||||||
|
|
|
@ -42,22 +42,21 @@ class ThemeFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
private fun setupRadioGroups() {
|
private fun setupRadioGroups() {
|
||||||
radioLightTheme.addToRadioGroup(radioDarkTheme)
|
radioLightTheme.addToRadioGroup(radioDarkTheme)
|
||||||
radioLightTheme.addToRadioGroup(radioAutoBatteryTheme)
|
|
||||||
|
|
||||||
radioDarkTheme.addToRadioGroup(radioLightTheme)
|
radioDarkTheme.addToRadioGroup(radioLightTheme)
|
||||||
radioDarkTheme.addToRadioGroup(radioAutoBatteryTheme)
|
|
||||||
|
|
||||||
radioAutoBatteryTheme.addToRadioGroup(radioLightTheme)
|
|
||||||
radioAutoBatteryTheme.addToRadioGroup(radioDarkTheme)
|
|
||||||
|
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) {
|
||||||
radioLightTheme.addToRadioGroup(radioFollowDeviceTheme)
|
radioLightTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||||
radioDarkTheme.addToRadioGroup(radioFollowDeviceTheme)
|
radioDarkTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||||
radioAutoBatteryTheme.addToRadioGroup(radioFollowDeviceTheme)
|
|
||||||
|
|
||||||
radioFollowDeviceTheme.addToRadioGroup(radioDarkTheme)
|
radioFollowDeviceTheme.addToRadioGroup(radioDarkTheme)
|
||||||
radioFollowDeviceTheme.addToRadioGroup(radioLightTheme)
|
radioFollowDeviceTheme.addToRadioGroup(radioLightTheme)
|
||||||
radioFollowDeviceTheme.addToRadioGroup(radioAutoBatteryTheme)
|
} else {
|
||||||
|
radioLightTheme.addToRadioGroup(radioAutoBatteryTheme)
|
||||||
|
radioDarkTheme.addToRadioGroup(radioAutoBatteryTheme)
|
||||||
|
|
||||||
|
radioAutoBatteryTheme.addToRadioGroup(radioLightTheme)
|
||||||
|
radioAutoBatteryTheme.addToRadioGroup(radioDarkTheme)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
<resources>
|
<resources>
|
||||||
<bool name="API28">true</bool>
|
<bool name="API28">true</bool>
|
||||||
|
<bool name="underAPI28">false</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -5,4 +5,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<bool name="theme_is_light">true</bool>
|
<bool name="theme_is_light">true</bool>
|
||||||
<bool name="API28">false</bool>
|
<bool name="API28">false</bool>
|
||||||
|
<bool name="underAPI28">true</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
<org.mozilla.fenix.settings.RadioButtonPreference
|
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/pref_key_auto_battery_theme"
|
android:key="@string/pref_key_auto_battery_theme"
|
||||||
android:title="@string/preference_auto_battery_theme" />
|
android:title="@string/preference_auto_battery_theme"
|
||||||
|
app:isPreferenceVisible="@bool/underAPI28" />
|
||||||
|
|
||||||
<org.mozilla.fenix.settings.RadioButtonPreference
|
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
|
|
Loading…
Reference in New Issue