mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Prevent multi animators setting property concurrently
It crashes on Android 5.0 (API 21) platform. Fix topjohnwu#5793
This commit is contained in:
parent
8a73a16029
commit
3219d945f5
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user