From ab021c1302dddedac8bfda5beb2402d7eb74ed0a Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 17 May 2021 17:32:10 -0400 Subject: [PATCH] Restore original preference background after highlight animation (fixes #5094) --- .../eu/kanade/tachiyomi/ui/setting/SettingsController.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt index 6ca3b068ea..cc8740b4a2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsController.kt @@ -11,6 +11,7 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.view.ContextThemeWrapper +import androidx.core.animation.doOnEnd import androidx.core.view.updatePadding import androidx.preference.PreferenceController import androidx.preference.PreferenceGroup @@ -98,6 +99,7 @@ abstract class SettingsController : PreferenceController() { abstract fun setupPreferenceScreen(screen: PreferenceScreen): PreferenceScreen private fun animatePreferenceHighlight(view: View) { + val origBackground = view.background ValueAnimator .ofObject(ArgbEvaluator(), Color.TRANSPARENT, view.context.getResourceColor(R.attr.rippleColor)) .apply { @@ -106,6 +108,10 @@ abstract class SettingsController : PreferenceController() { addUpdateListener { animator -> view.setBackgroundColor(animator.animatedValue as Int) } reverse() } + .doOnEnd { + // Restore original ripple + view.background = origBackground + } } open fun getTitle(): String? {