diff --git a/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java b/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java index 4690c46fc..c104554d3 100644 --- a/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java +++ b/app/src/main/java/com/topjohnwu/magisk/widget/ConcealableBottomNavigationView.java @@ -23,6 +23,7 @@ public class ConcealableBottomNavigationView extends BottomNavigationView { }; private boolean isHidden; + private int lastHeight = -1; public ConcealableBottomNavigationView(@NonNull Context context) { this(context, null); @@ -41,6 +42,14 @@ public class ConcealableBottomNavigationView extends BottomNavigationView { } private void recreateAnimator(int height) { + if (lastHeight == height) return; + lastHeight = height; + + // End the current animation before setting a new one + // otherwise it crashes on Android 5.0 + StateListAnimator lastAnimator = getStateListAnimator(); + if (lastAnimator != null) lastAnimator.jumpToCurrentState(); + Animator toHidden = ObjectAnimator.ofFloat(this, "translationY", height); toHidden.setDuration(175); toHidden.setInterpolator(new FastOutLinearInInterpolator());