Prevent canceled hide animation from hiding quick attachment buttons.

This commit is contained in:
Cody Henthorne
2026-08-12 13:13:38 -04:00
parent 4e84182822
commit 5d7a84da95
@@ -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);
}