mirror of
https://github.com/mediathekview/zapp.git
synced 2024-09-19 20:02:17 +02:00
Fix dynamic color not applied on some devices #429
This commit is contained in:
parent
ace4d0508d
commit
0c6045b24f
@ -7,7 +7,7 @@ import android.os.Build
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.PreferenceManager
|
||||
import de.christinecoenen.code.zapp.R
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
@ -61,17 +61,8 @@ class SettingsRepository(context: Context) {
|
||||
val downloadToSdCard: Boolean
|
||||
get() = preferences.getBoolean(context.getString(R.string.pref_key_download_to_sd_card), true)
|
||||
|
||||
var dynamicColors: Boolean
|
||||
val dynamicColors: Boolean
|
||||
get() = preferences.getBoolean(context.getString(R.string.pref_key_dynamic_colors), false)
|
||||
@SuppressLint("ApplySharedPref")
|
||||
set(enabled) {
|
||||
// "commit" instead of "apply" is fine here, because we need to restart the app
|
||||
// after setting this preference. Doing it synchroniously is the only way to save
|
||||
// the setting across the app restart.
|
||||
preferences.edit()
|
||||
.putBoolean(context.getString(R.string.pref_key_dynamic_colors), enabled)
|
||||
.commit()
|
||||
}
|
||||
|
||||
val uiMode: Int
|
||||
get() {
|
||||
|
@ -13,6 +13,8 @@ import com.google.android.material.color.DynamicColors
|
||||
import com.jakewharton.processphoenix.ProcessPhoenix
|
||||
import de.christinecoenen.code.zapp.app.settings.helper.ShortcutPreference
|
||||
import de.christinecoenen.code.zapp.app.settings.repository.SettingsRepository
|
||||
import java.util.Timer
|
||||
import kotlin.concurrent.schedule
|
||||
|
||||
class PreferenceFragmentHelper(
|
||||
private val preferenceFragment: PreferenceFragmentCompat,
|
||||
@ -38,7 +40,11 @@ class PreferenceFragmentHelper(
|
||||
private var channelSelectionClickListener: OnPreferenceClickListener? = null
|
||||
|
||||
private val dynamicColorChangeListener = Preference.OnPreferenceChangeListener { _, _ ->
|
||||
ProcessPhoenix.triggerRebirth(preferenceFragment.requireContext())
|
||||
// Delay to wait for pereferences to be persisted (on very fast devices)
|
||||
// before killing the app - there is no listener that fires *after* persisting.
|
||||
Timer().schedule(200) {
|
||||
ProcessPhoenix.triggerRebirth(preferenceFragment.requireContext())
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
# v-next
|
||||
* Dynamische Farben wurden auf manchen Geräten nicht übernommen
|
||||
|
||||
# 8.5.0
|
||||
* Einstellungen zu Android-TV-version hinzugefügt
|
||||
* Angeschnittener Text im Vorspulen-Button gefixt
|
||||
|
Loading…
Reference in New Issue
Block a user