From a32b875587cd4203afbe49cef29529bd72a8bab2 Mon Sep 17 00:00:00 2001 From: Alan Evans Date: Wed, 14 Aug 2019 10:00:03 -0400 Subject: [PATCH] Support disabled animations for accessibility. --- .../components/webrtc/WebRtcAnswerDeclineButton.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/org/thoughtcrime/securesms/components/webrtc/WebRtcAnswerDeclineButton.java b/src/org/thoughtcrime/securesms/components/webrtc/WebRtcAnswerDeclineButton.java index ef37d0ef59..f0f0fe5737 100644 --- a/src/org/thoughtcrime/securesms/components/webrtc/WebRtcAnswerDeclineButton.java +++ b/src/org/thoughtcrime/securesms/components/webrtc/WebRtcAnswerDeclineButton.java @@ -7,6 +7,7 @@ import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Color; import android.os.Build; +import android.provider.Settings; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -263,6 +264,8 @@ public final class WebRtcAnswerDeclineButton extends LinearLayout implements Acc } private void animateElements(int delay) { + if (areAnimationsDisabled()) return; + ObjectAnimator fabUp = getUpAnimation(answer); ObjectAnimator fabDown = getDownAnimation(answer); ObjectAnimator fabShake = getShakeAnimation(answer); @@ -297,6 +300,11 @@ public final class WebRtcAnswerDeclineButton extends LinearLayout implements Acc animatorSet.start(); } + private boolean areAnimationsDisabled() { + return Settings.Global.getFloat(getContext().getContentResolver(), + Settings.Global.ANIMATOR_DURATION_SCALE, 1) == 0f; + } + private void resetElements() { animating = false; complete = false;