mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Utilize areAnimatorsEnabled on API levels that support it.
This commit is contained in:
committed by
Greyson Parrelli
parent
89fca76327
commit
4d94d9d968
@@ -1,11 +1,17 @@
|
||||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.ContentResolver
|
||||
import android.os.Build
|
||||
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 if (Build.VERSION.SDK_INT >= 26) {
|
||||
!ValueAnimator.areAnimatorsEnabled()
|
||||
} else {
|
||||
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)
|
||||
!(durationScale > 0f && transitionScale > 0f)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user