summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-04-17 16:49:07 -0700
committerCopybara-Service <copybara-piper@google.com>2018-04-17 18:06:19 -0700
commit9e22d509e878c2c2991061c11a2198a6e46e919e (patch)
treebfeb13503fdd296d10b93b78d0e819b09616aa2a /java
parent204130ce0391e8b7f29cfc52b75f0886fe9c01bb (diff)
Don't slide the toolbar up if we've scheduled a runnable to slide it up.
Bug: 78132954 Test: listnr PiperOrigin-RevId: 193279654 Change-Id: I0d6e2e39d2f695b2e7d51ddf8c5abbc689187fbd
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/main/impl/toolbar/MainToolbar.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/java/com/android/dialer/main/impl/toolbar/MainToolbar.java b/java/com/android/dialer/main/impl/toolbar/MainToolbar.java
index 5e5db2c8c..851d7a0b4 100644
--- a/java/com/android/dialer/main/impl/toolbar/MainToolbar.java
+++ b/java/com/android/dialer/main/impl/toolbar/MainToolbar.java
@@ -42,6 +42,7 @@ public final class MainToolbar extends Toolbar implements PopupMenu.OnMenuItemCl
private SearchBarListener listener;
private MainToolbarMenu overflowMenu;
private boolean isSlideUp;
+ private boolean hasGlobalLayoutListener;
public MainToolbar(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -72,9 +73,20 @@ public final class MainToolbar extends Toolbar implements PopupMenu.OnMenuItemCl
/** Slides the toolbar up and off the screen. */
public void slideUp(boolean animate, View container) {
+ if (hasGlobalLayoutListener) {
+ // Return early since we've already scheduled the toolbar to slide up
+ return;
+ }
+
Assert.checkArgument(!isSlideUp);
if (getHeight() == 0) {
- ViewUtil.doOnGlobalLayout(this, view -> slideUp(animate, container));
+ hasGlobalLayoutListener = true;
+ ViewUtil.doOnGlobalLayout(
+ this,
+ view -> {
+ hasGlobalLayoutListener = false;
+ slideUp(animate, container);
+ });
return;
}
isSlideUp = true;