kopia lustrzana https://github.com/ryukoposting/Signal-Android
Utilize areAnimatorsEnabled on API levels that support it.
rodzic
89fca76327
commit
4d94d9d968
|
@ -1,11 +1,17 @@
|
||||||
package org.thoughtcrime.securesms.util
|
package org.thoughtcrime.securesms.util
|
||||||
|
|
||||||
|
import android.animation.ValueAnimator
|
||||||
import android.content.ContentResolver
|
import android.content.ContentResolver
|
||||||
|
import android.os.Build
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
|
|
||||||
fun ContentResolver.areSystemAnimationsDisabled(): Boolean {
|
fun ContentResolver.areSystemAnimationsDisabled(): Boolean {
|
||||||
|
return if (Build.VERSION.SDK_INT >= 26) {
|
||||||
|
!ValueAnimator.areAnimatorsEnabled()
|
||||||
|
} else {
|
||||||
val durationScale = Settings.System.getFloat(this, Settings.Global.ANIMATOR_DURATION_SCALE)
|
val durationScale = Settings.System.getFloat(this, Settings.Global.ANIMATOR_DURATION_SCALE)
|
||||||
val transitionScale = Settings.System.getFloat(this, Settings.Global.TRANSITION_ANIMATION_SCALE)
|
val transitionScale = Settings.System.getFloat(this, Settings.Global.TRANSITION_ANIMATION_SCALE)
|
||||||
|
|
||||||
return !(durationScale > 0f && transitionScale > 0f)
|
!(durationScale > 0f && transitionScale > 0f)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue