light theme

This commit is contained in:
Josia Pietsch 2024-11-26 01:03:59 +01:00
parent b09c6a52b2
commit 68fa4190f3
Signed by: jrpie
GPG key ID: E70B571D66986A2D
15 changed files with 63 additions and 11 deletions

View file

@ -40,6 +40,7 @@ import eu.jonahbauer.android.preference.annotations.serializer.PreferenceSeriali
@Preference(name = "color_theme", type = ColorTheme.class, defaultValue = "DEFAULT"),
@Preference(name = "background", type = Background.class, defaultValue = "DIM"),
@Preference(name = "font", type = Font.class, defaultValue = "HACK"),
@Preference(name = "text_shadow", type = boolean.class, defaultValue = "false"),
@Preference(name = "monochrome_icons", type = boolean.class, defaultValue = "false"),
}),
@PreferenceGroup(name = "clock", prefix = "settings_clock_", suffix = "_key", value = {

View file

@ -419,7 +419,7 @@ fun resetPreferences(context: Context) {
LauncherPreferences.internal().versionCode(PREFERENCE_VERSION)
LauncherPreferences.apps().hidden(
LauncherPreferences.apps().hidden().also {
LauncherPreferences.apps().hidden()?.also {
it.add(
DetailedAppInfo.fromAppInfo(
AppInfo(

View file

@ -4,12 +4,17 @@ import android.content.res.Resources
import de.jrpie.android.launcher.R
@Suppress("unused")
enum class ColorTheme(val id: Int) {
DEFAULT(R.style.colorThemeDefault),
DARK(R.style.colorThemeDark),
enum class ColorTheme(private val id: Int, private val shadowId: Int) {
DEFAULT(R.style.colorThemeDefault, R.style.textShadow),
DARK(R.style.colorThemeDark, R.style.textShadow),
LIGHT(R.style.colorThemeLight, R.style.textShadowLight),
;
fun applyToTheme(theme: Resources.Theme) {
fun applyToTheme(theme: Resources.Theme, shadow: Boolean) {
theme.applyStyle(id, true)
if (shadow) {
theme.applyStyle(shadowId, true)
}
}
}

View file

@ -162,6 +162,11 @@ class HomeActivity : UIObject, AppCompatActivity(),
val mTheme = modifyTheme(super.getTheme())
mTheme.applyStyle(R.style.backgroundWallpaper, true)
LauncherPreferences.clock().font().applyToTheme(mTheme)
LauncherPreferences.theme().colorTheme().applyToTheme(
mTheme,
LauncherPreferences.theme().textShadow()
)
return mTheme
}

View file

@ -5,6 +5,7 @@ import android.content.pm.ActivityInfo
import android.content.res.Resources
import android.view.Window
import android.view.WindowManager
import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.preferences.LauncherPreferences
/**
@ -53,7 +54,10 @@ interface UIObject {
}
fun modifyTheme(theme: Resources.Theme): Resources.Theme {
LauncherPreferences.theme().colorTheme().applyToTheme(theme)
LauncherPreferences.theme().colorTheme().applyToTheme(
theme,
LauncherPreferences.theme().textShadow()
)
LauncherPreferences.theme().background().applyToTheme(theme)
LauncherPreferences.theme().font().applyToTheme(theme)

View file

@ -1,4 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="?android:textColor" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">
<path android:fillColor="?android:textColor" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>

View file

@ -88,7 +88,7 @@
<string-array name="settings_theme_color_theme_items">
<item>Standard</item>
<item>Dunkel</item>
<!--<item>Hell</item>-->
<item>Hell</item>
</string-array>
<string name="settings_theme_wallpaper">Hintergrund auswählen</string>
<string name="settings_launcher_change_wallpaper">Hintergrund ändern</string>

View file

@ -59,6 +59,7 @@
<string-array name="settings_theme_color_theme_items">
<item>Normal</item>
<item>Oscuro</item>
<item>Luminoso</item>
</string-array>
<string name="settings_theme_wallpaper">Seleccionar fondo de pantalla</string>
<string name="settings_launcher_change_wallpaper">Cambiar fondo de pantalla</string>

View file

@ -51,6 +51,7 @@
<string-array name="settings_theme_color_theme_items">
<item>Défaut</item>
<item>Noir</item>
<item>Lumière</item>
</string-array>
<string name="settings_theme_wallpaper">Choisir un fond d\'écran</string>
<string name="settings_launcher_change_wallpaper">Changer le fond d\'écran</string>

View file

@ -58,6 +58,7 @@
<string-array name="settings_theme_color_theme_items">
<item>Padrão</item>
<item>Escuro</item>
<item>Luz</item>
</string-array>
<string name="settings_clock_time_visible">Mostrar Horário</string>
<string name="settings_clock_date_visible">Mostrar Data</string>

View file

@ -9,7 +9,7 @@
<color name="darkTheme_text_color">#fff</color>
<color name="lightTheme_background_color">#fff</color>
<color name="lightTheme_accent_color">#5555ff</color>
<color name="lightTheme_accent_color">#9999ff</color>
<color name="lightTheme_text_color">#000</color>
</resources>

View file

@ -51,8 +51,9 @@
<string-array name="settings_theme_color_theme_values" translatable="false">
<item>DEFAULT</item>
<item>DARK</item>
<!--<item>light</item>-->
<item>LIGHT</item>
</string-array>
<string name="settings_theme_text_shadow_key" translatable="false">theme.text_shadow</string>
<string name="settings_theme_background_key" translatable="false">theme.background</string>
<string-array name="settings_theme_background_values" translatable="false">
<item>TRANSPARENT</item>

View file

@ -90,8 +90,10 @@
<string-array name="settings_theme_color_theme_items">
<item>Default</item>
<item>Dark</item>
<!--<item>Light</item>-->
<item>Light</item>
</string-array>
<string name="settings_theme_text_shadow">Text shadow</string>
<string name="settings_theme_background">Background (app list and setting)</string>
<string-array name="settings_theme_background_items">
<item>Transparent</item>

View file

@ -34,6 +34,7 @@
<item name="android:colorBackground">@color/darkTheme_background_color</item>
<item name="android:textColor">@color/darkTheme_text_color</item>
</style>
<style name="colorThemeDefault">
<item name="colorPrimary">@color/finnmglasTheme_background_color</item>
<item name="colorPrimaryDark">@color/finnmglasTheme_background_color</item>
@ -50,6 +51,17 @@
<item name="android:textColor">@color/lightTheme_text_color</item>
</style>
<style name="textShadow">
<item name="android:shadowColor">#000</item>
<item name="android:shadowDx">0</item>
<item name="android:shadowDy">0</item>
<item name="android:shadowRadius">2</item>
</style>
<style name="textShadowLight" parent="textShadow">
<item name="android:shadowColor">#aaa</item>
</style>
<style name="backgroundWallpaper">
<item name="android:statusBarColor">@android:color/transparent</item>
@ -84,6 +96,19 @@
<item name="android:fontFamily">serif</item>
</style>
<style name="textColorWhite">
<item name="android:textColor">@color/finnmglasTheme_text_color</item>
</style>
<style name="textColorWhiteAndShadow">
<item name="android:textColor">@color/finnmglasTheme_text_color</item>
</style>
<style name="textColorBlack">
<item name="android:textColor">#000</item>
</style>

View file

@ -29,6 +29,12 @@
android:entries="@array/settings_theme_font_items"
android:summary="%s"
android:defaultValue="HACK"/>
<SwitchPreference
android:key="@string/settings_theme_text_shadow_key"
android:title="@string/settings_theme_text_shadow"
android:defaultValue="false" />
<DropDownPreference
android:key="@string/settings_theme_background_key"
android:title="@string/settings_theme_background"