set default background to dim as blur is quite CPU-intensive

This commit is contained in:
Josia Pietsch 2024-09-12 17:53:22 +02:00
parent 1e1b89c0b7
commit 435250d704
Signed by: jrpie
GPG key ID: E70B571D66986A2D
4 changed files with 7 additions and 6 deletions

View file

@ -26,7 +26,7 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
@PreferenceGroup(name = "theme", prefix = "settings_theme_", suffix = "_key", value = {
@Preference(name = "wallpaper", type = void.class),
@Preference(name = "color_theme", type = ColorTheme.class, defaultValue = "DEFAULT"),
@Preference(name = "background", type = Background.class, defaultValue = "BLUR"),
@Preference(name = "background", type = Background.class, defaultValue = "DIM"),
@Preference(name = "font", type = Font.class, defaultValue = "HACK"),
@Preference(name = "monochrome_icons", type = boolean.class, defaultValue = "false"),
}),

View file

@ -387,13 +387,13 @@ fun migratePreferencesToNewVersion(context: Context) {
"finn" -> {
LauncherPreferences.theme().colorTheme(ColorTheme.DEFAULT)
LauncherPreferences.theme().monochromeIcons(false)
LauncherPreferences.theme().background(Background.BLUR)
LauncherPreferences.theme().background(Background.DIM)
}
"dark" -> {
LauncherPreferences.theme().colorTheme(ColorTheme.DARK)
LauncherPreferences.theme().monochromeIcons(true)
LauncherPreferences.theme().background(Background.BLUR)
LauncherPreferences.theme().background(Background.DIM)
}
}

View file

@ -19,14 +19,15 @@ enum class Background(val id: Int, val dim: Boolean = false, val blur: Boolean =
fun applyToWindow(window: Window) {
val layoutParams: WindowManager.LayoutParams = window.attributes
var dimAmount = 0.5f
// TODO: add a setting to change this?
var dimAmount = 0.7f
var dim = this.dim
var blur = this.blur
// replace blur by more intense dim on old devices
if (blur && Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
blur = false
dimAmount += 0.3f
dimAmount += 0.1f
}
if (dim) {

View file

@ -35,7 +35,7 @@
android:summary="%s"
android:entries="@array/settings_theme_background_items"
android:entryValues="@array/settings_theme_background_values"
android:defaultValue="BLUR"/>
android:defaultValue="DIM"/>
<SwitchPreference
android:key="@string/settings_theme_monochrome_icons_key"
android:title="@string/settings_theme_monochrome_icons"