diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt index 5b347fe81..501348612 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/base/ThemeManager.kt @@ -3,6 +3,7 @@ package io.github.wulkanowy.ui.base import android.content.pm.PackageManager.GET_ACTIVITIES import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate +import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES import io.github.wulkanowy.R @@ -22,8 +23,12 @@ class ThemeManager @Inject constructor(private val preferencesRepository: Prefer fun applyDefaultTheme() { AppCompatDelegate.setDefaultNightMode( - if (preferencesRepository.appTheme == "light") MODE_NIGHT_NO - else MODE_NIGHT_YES + when (val theme = preferencesRepository.appTheme) { + "light" -> MODE_NIGHT_NO + "dark", "black" -> MODE_NIGHT_YES + "system" -> MODE_NIGHT_FOLLOW_SYSTEM + else -> throw IllegalArgumentException("Wrong theme: $theme") + } ) } diff --git a/app/src/main/res/values-pl-v29/preferences_values.xml b/app/src/main/res/values-pl-v29/preferences_values.xml new file mode 100644 index 000000000..57f208044 --- /dev/null +++ b/app/src/main/res/values-pl-v29/preferences_values.xml @@ -0,0 +1,9 @@ + + + + Motyw systemu + Jasny + Ciemny + Czarny (AMOLED) + + diff --git a/app/src/main/res/values-pl/preferences_values.xml b/app/src/main/res/values-pl/preferences_values.xml index 868ead4d9..e4c30eb05 100644 --- a/app/src/main/res/values-pl/preferences_values.xml +++ b/app/src/main/res/values-pl/preferences_values.xml @@ -1,5 +1,5 @@ - + 15 minut 30 minut @@ -10,7 +10,7 @@ 24 godziny - + Jasny Ciemny Czarny (AMOLED) diff --git a/app/src/main/res/values-v29/preferences_defaults.xml b/app/src/main/res/values-v29/preferences_defaults.xml new file mode 100644 index 000000000..bb573d664 --- /dev/null +++ b/app/src/main/res/values-v29/preferences_defaults.xml @@ -0,0 +1,4 @@ + + + system + diff --git a/app/src/main/res/values-v29/preferences_values.xml b/app/src/main/res/values-v29/preferences_values.xml new file mode 100644 index 000000000..f27c1c69c --- /dev/null +++ b/app/src/main/res/values-v29/preferences_values.xml @@ -0,0 +1,15 @@ + + + + System theme + Light + Dark + Black (AMOLED) + + + system + light + dark + black + + diff --git a/app/src/main/res/values/preferences_values.xml b/app/src/main/res/values/preferences_values.xml index 97396baad..289f14f34 100644 --- a/app/src/main/res/values/preferences_values.xml +++ b/app/src/main/res/values/preferences_values.xml @@ -1,5 +1,5 @@ - + @string/grade_title @string/attendance_title @@ -13,12 +13,12 @@ 3 - + Light Dark Black (AMOLED) - + light dark black