chore: cleanup AppThemeHelper and add loading string

This commit is contained in:
2026-03-30 11:34:16 +02:00
parent 47ff40e676
commit 7d63f16c2c
2 changed files with 2 additions and 16 deletions

View File

@@ -1,11 +1,7 @@
package com.michatec.radio.helpers package com.michatec.radio.helpers
import android.content.Context import android.content.Context
import android.content.res.TypedArray
import android.util.Log import android.util.Log
import android.util.TypedValue
import androidx.annotation.AttrRes
import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import com.michatec.radio.Keys import com.michatec.radio.Keys
import com.michatec.radio.R import com.michatec.radio.R
@@ -19,8 +15,6 @@ object AppThemeHelper {
/* Define log tag */ /* Define log tag */
private val TAG: String = AppThemeHelper::class.java.simpleName private val TAG: String = AppThemeHelper::class.java.simpleName
private val sTypedValue = TypedValue()
/* Sets app theme */ /* Sets app theme */
fun setTheme(nightModeState: String) { fun setTheme(nightModeState: String) {
when (nightModeState) { when (nightModeState) {
@@ -62,14 +56,4 @@ object AppThemeHelper {
else -> context.getString(R.string.pref_theme_selection_mode_device_default) else -> context.getString(R.string.pref_theme_selection_mode_device_default)
} }
} }
@ColorInt
fun getColor(context: Context, @AttrRes resource: Int): Int {
val a: TypedArray = context.obtainStyledAttributes(sTypedValue.data, intArrayOf(resource))
val color = a.getColor(0, 0)
a.recycle()
return color
}
} }

View File

@@ -141,5 +141,7 @@
<string name="snackbar_github_update_check_url" translatable="false">https://api.github.com/repos/michatec/Radio/releases/latest</string> <string name="snackbar_github_update_check_url" translatable="false">https://api.github.com/repos/michatec/Radio/releases/latest</string>
<string name="app_name" translatable="false">Radio</string> <string name="app_name" translatable="false">Radio</string>
<string name="icon_launcher" translatable="false">Icon launcher.</string> <string name="icon_launcher" translatable="false">Icon launcher.</string>
<!-- Extras -->
<string name="loading">Loading...</string> <string name="loading">Loading...</string>
</resources> </resources>