From 71caff24aa62d695e930f320a88a46817e0a65ee Mon Sep 17 00:00:00 2001 From: Scott Schmitz Date: Mon, 8 Jan 2018 10:18:47 -0500 Subject: [PATCH] Keep animations a consistent duration --- build.gradle | 2 +- gradlew | 0 .../java/com/unnamed/b/atv/view/AndroidTreeView.java | 9 +++++---- 3 files changed, 6 insertions(+), 5 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index ebf706b..e69adc3 100644 --- a/build.gradle +++ b/build.gradle @@ -25,4 +25,4 @@ allprojects { } } -apply plugin: 'android-reporting' \ No newline at end of file +apply plugin: 'android-reporting' diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/library/src/main/java/com/unnamed/b/atv/view/AndroidTreeView.java b/library/src/main/java/com/unnamed/b/atv/view/AndroidTreeView.java index 222a43a..c20ab4b 100644 --- a/library/src/main/java/com/unnamed/b/atv/view/AndroidTreeView.java +++ b/library/src/main/java/com/unnamed/b/atv/view/AndroidTreeView.java @@ -5,6 +5,7 @@ import android.view.ContextThemeWrapper; import android.view.View; import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.Animation; import android.view.animation.Transformation; import android.widget.LinearLayout; @@ -434,8 +435,8 @@ public boolean willChangeBounds() { } }; - // 1dp/ms - a.setDuration((int) (targetHeight / v.getContext().getResources().getDisplayMetrics().density)); + a.setDuration((long) v.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime)); + a.setInterpolator(new AccelerateDecelerateInterpolator()); v.startAnimation(a); } @@ -459,8 +460,8 @@ public boolean willChangeBounds() { } }; - // 1dp/ms - a.setDuration((int) (initialHeight / v.getContext().getResources().getDisplayMetrics().density)); + a.setDuration((long) v.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime)); + a.setInterpolator(new AccelerateDecelerateInterpolator()); v.startAnimation(a); }