mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 04:28:35 +00:00
Fix infinite animation loop when system animations are disabled.
This commit is contained in:
committed by
Greyson Parrelli
parent
2cfa31a9b0
commit
b1d1aee373
@@ -19,6 +19,7 @@ import com.bumptech.glide.request.target.Target
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.blurhash.BlurHash
|
||||
import org.thoughtcrime.securesms.mms.GlideApp
|
||||
import org.thoughtcrime.securesms.util.areSystemAnimationsDisabled
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
|
||||
class StoryFirstTimeNavigationView @JvmOverloads constructor(
|
||||
@@ -118,6 +119,10 @@ class StoryFirstTimeNavigationView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun startLottieAnimations() {
|
||||
if (context.contentResolver.areSystemAnimationsDisabled()) {
|
||||
return
|
||||
}
|
||||
|
||||
isPlayingAnimations = true
|
||||
tapToAdvance.addAnimatorListener(object : AnimatorListenerAdapter() {
|
||||
override fun onAnimationEnd(animation: Animator?) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import android.content.ContentResolver
|
||||
import android.provider.Settings
|
||||
|
||||
fun ContentResolver.areSystemAnimationsDisabled(): Boolean {
|
||||
val durationScale = Settings.System.getFloat(this, Settings.Global.ANIMATOR_DURATION_SCALE)
|
||||
val transitionScale = Settings.System.getFloat(this, Settings.Global.TRANSITION_ANIMATION_SCALE)
|
||||
|
||||
return !(durationScale > 0f && transitionScale > 0f)
|
||||
}
|
||||
Reference in New Issue
Block a user