This commit is contained in:
Bnyro 2022-05-20 00:09:47 +02:00
parent c331981d78
commit 0de1eb98a2
4 changed files with 9 additions and 5 deletions

View File

@ -44,8 +44,8 @@ class SettingsActivity :
overridePendingTransition(50, 50)
}
val view = this.findViewById<View>(android.R.id.content)
view.setAlpha(0F)
view.animate().alpha(1F).setDuration(300)
view.alpha = 0F
view.animate().alpha(1F).duration = 300
setContentView(R.layout.activity_settings)
if (savedInstanceState == null) {

View File

@ -8,6 +8,7 @@ import java.util.*
fun updateAccentColor(context: Context) {
val colorAccent = PreferenceManager.getDefaultSharedPreferences(context).getString("accent_color", "red")
when (colorAccent) {
"my" -> {}
"red" -> context.setTheme(R.style.Theme_Red)
"blue" -> context.setTheme(R.style.Theme_Blue)
"yellow" -> context.setTheme(R.style.Theme_Yellow)
@ -35,10 +36,10 @@ fun updateLanguage(context: Context) {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val languageName = sharedPreferences.getString("language", "sys")
if (languageName != "") {
var locale = if (languageName != "sys" && "$languageName".length < 3 ) {
var locale = if (languageName != "sys" && "$languageName".length < 3) {
Locale(languageName)
} else if ("$languageName".length > 3) {
Locale(languageName?.substring(0,2), languageName?.substring(4,6))
Locale(languageName?.substring(0, 2), languageName?.substring(4, 6))
} else {
Locale.getDefault()
}
@ -49,4 +50,4 @@ fun updateLanguage(context: Context) {
Locale.setDefault(locale)
res.updateConfiguration(conf, dm)
}
}
}

View File

@ -474,6 +474,7 @@
</string-array>
<string-array name="accents">
<item>@string/material_you</item>
<item>@string/color_red</item>
<item>@string/color_blue</item>
<item>@string/color_yellow</item>
@ -482,6 +483,7 @@
</string-array>
<string-array name="accentsValue">
<item>my</item>
<item>red</item>
<item>blue</item>
<item>yellow</item>

View File

@ -108,4 +108,5 @@
<string name="color_green">Green</string>
<string name="color_purple">Purple</string>
<string name="oledTheme">OLED Theme</string>
<string name="material_you">Material You</string>
</resources>