diff options
author | yueg <yueg@google.com> | 2017-09-01 15:44:58 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-07 15:50:10 +0000 |
commit | 34f1886107825b4495741a034f15e1f1edacf95c (patch) | |
tree | 034a0eda9ce7599f774e9d2afea2e5236c718403 /java/com/android/dialershared | |
parent | ee5bce98231b96bc7f3ecf2d12276571786863f5 (diff) |
Disable action on bubble when hiding, and reable it when showing.
Allowing click or moving bubble when hiding bubble makes no sense. Also, hide()
and swapViewHolders() (called when expand/collapse) may add/remove the same
view to windowManager and cause crash.
Before: https://drive.google.com/a/google.com/file/d/0Bz1rQbdSCWSKRDEyT2JDdk9LVDA
After: https://drive.google.com/a/google.com/file/d/0Bz1rQbdSCWSKUE53aldna0RFVFE
Test: BubbleTest
PiperOrigin-RevId: 167334496
Change-Id: Id7f5ce4bdfa074840c1e9fac981abad59e261c0e
Diffstat (limited to 'java/com/android/dialershared')
-rw-r--r-- | java/com/android/dialershared/bubble/Bubble.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/java/com/android/dialershared/bubble/Bubble.java b/java/com/android/dialershared/bubble/Bubble.java index cd2c9fc57..d24552245 100644 --- a/java/com/android/dialershared/bubble/Bubble.java +++ b/java/com/android/dialershared/bubble/Bubble.java @@ -241,6 +241,7 @@ public class Bubble { viewHolder.getPrimaryButton().setScaleY(0); } + viewHolder.setChildClickable(true); visibility = Visibility.ENTERING; viewHolder .getPrimaryButton() @@ -495,6 +496,9 @@ public class Bubble { return; } + // Make bubble non clickable to prevent further buggy actions + viewHolder.setChildClickable(false); + if (textShowing) { hideAfterText = true; return; @@ -822,6 +826,14 @@ public class Bubble { moveHandler = new MoveHandler(primaryButton, Bubble.this); } + private void setChildClickable(boolean clickable) { + firstButton.setClickable(clickable); + secondButton.setClickable(clickable); + thirdButton.setClickable(clickable); + + primaryButton.setOnTouchListener(clickable ? moveHandler : null); + } + public ViewGroup getRoot() { return root; } |