mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-14 01:03:28 +01:00
Prevent canceled hide animation from hiding quick attachment buttons.
This commit is contained in:
@@ -12,6 +12,9 @@ import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
|
||||
|
||||
public class HidingLinearLayout extends LinearLayout {
|
||||
|
||||
/** Tracks whether the most recent request was to hide, so that a canceled hide animation cannot later apply {@link #GONE}. */
|
||||
private boolean hiding;
|
||||
|
||||
public HidingLinearLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -27,6 +30,8 @@ public class HidingLinearLayout extends LinearLayout {
|
||||
public void hide(boolean shouldAnimate) {
|
||||
if (!isEnabled() || getVisibility() == GONE) return;
|
||||
|
||||
hiding = true;
|
||||
|
||||
if (!shouldAnimate) {
|
||||
setVisibility(GONE);
|
||||
return;
|
||||
@@ -48,7 +53,9 @@ public class HidingLinearLayout extends LinearLayout {
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
setVisibility(GONE);
|
||||
if (hiding) {
|
||||
setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -58,7 +65,9 @@ public class HidingLinearLayout extends LinearLayout {
|
||||
public void show() {
|
||||
if (!isEnabled()) return;
|
||||
|
||||
hiding = false;
|
||||
clearAnimation();
|
||||
|
||||
if (getVisibility() == VISIBLE) return;
|
||||
|
||||
setVisibility(VISIBLE);
|
||||
@@ -78,6 +87,7 @@ public class HidingLinearLayout extends LinearLayout {
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
hiding = true;
|
||||
setVisibility(GONE);
|
||||
setEnabled(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user