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
|
||||
)
|
||||
}
|
||||
Settings.getInstance(this).shouldUseAutoBatteryTheme -> {
|
||||
android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.P &&
|
||||
Settings.getInstance(this).shouldUseAutoBatteryTheme -> {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
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.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
)
|
||||
|
|
|
@ -42,22 +42,21 @@ class ThemeFragment : PreferenceFragmentCompat() {
|
|||
|
||||
private fun setupRadioGroups() {
|
||||
radioLightTheme.addToRadioGroup(radioDarkTheme)
|
||||
radioLightTheme.addToRadioGroup(radioAutoBatteryTheme)
|
||||
|
||||
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) {
|
||||
radioLightTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||
radioDarkTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||
radioAutoBatteryTheme.addToRadioGroup(radioFollowDeviceTheme)
|
||||
|
||||
radioFollowDeviceTheme.addToRadioGroup(radioDarkTheme)
|
||||
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/. -->
|
||||
<resources>
|
||||
<bool name="API28">true</bool>
|
||||
<bool name="underAPI28">false</bool>
|
||||
</resources>
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
<resources>
|
||||
<bool name="theme_is_light">true</bool>
|
||||
<bool name="API28">false</bool>
|
||||
<bool name="underAPI28">true</bool>
|
||||
</resources>
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
<org.mozilla.fenix.settings.RadioButtonPreference
|
||||
android:defaultValue="false"
|
||||
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
|
||||
android:defaultValue="false"
|
||||
|
|
Loading…
Reference in New Issue