diff options
author | Michael W <baddaemon87@gmail.com> | 2022-03-18 20:23:26 +0100 |
---|---|---|
committer | Michael W <baddaemon87@gmail.com> | 2022-04-18 10:03:08 +0200 |
commit | fa6047db25729eebf26826f738d4a4ab2327a512 (patch) | |
tree | e94535bf44d25673adbf26f9262c5a56413f8280 /src/com/android/deskclock/AnimatorUtils.java | |
parent | 23d7064d1abf2feb41d3d1a1812038a26e836181 (diff) |
DeskClock: Remove compatibility to old APIsHEADsugisawa-mr1
* We never build on these, so the code and annotations are useless
Change-Id: I791370b531ecadcbddb63ca04d5c4c51aafe1bc1
Diffstat (limited to 'src/com/android/deskclock/AnimatorUtils.java')
-rw-r--r-- | src/com/android/deskclock/AnimatorUtils.java | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/src/com/android/deskclock/AnimatorUtils.java b/src/com/android/deskclock/AnimatorUtils.java index f78bd1e98..4e90fa81f 100644 --- a/src/com/android/deskclock/AnimatorUtils.java +++ b/src/com/android/deskclock/AnimatorUtils.java @@ -120,45 +120,12 @@ public class AnimatorUtils { @SuppressWarnings("unchecked") public static final TypeEvaluator<Integer> ARGB_EVALUATOR = new ArgbEvaluator(); - private static Method sAnimateValue; - private static boolean sTryAnimateValue = true; - - public static void setAnimatedFraction(ValueAnimator animator, float fraction) { - if (Utils.isLMR1OrLater()) { - animator.setCurrentFraction(fraction); - return; - } - - if (sTryAnimateValue) { - // try to set the animated fraction directly so that it isn't affected by the - // internal animator scale or time (b/17938711) - try { - if (sAnimateValue == null) { - sAnimateValue = ValueAnimator.class - .getDeclaredMethod("animateValue", float.class); - sAnimateValue.setAccessible(true); - } - - sAnimateValue.invoke(animator, fraction); - return; - } catch (NoSuchMethodException | InvocationTargetException - | IllegalAccessException e) { - // something went wrong, don't try that again - LogUtils.e("Unable to use animateValue directly", e); - sTryAnimateValue = false; - } - } - - // if that doesn't work then just fall back to setting the current play time - animator.setCurrentPlayTime(Math.round(fraction * animator.getDuration())); - } - public static void reverse(ValueAnimator... animators) { for (ValueAnimator animator : animators) { final float fraction = animator.getAnimatedFraction(); if (fraction > 0.0f) { animator.reverse(); - setAnimatedFraction(animator, 1.0f - fraction); + animator.setCurrentFraction(1.0f - fraction); } } } |