diff options
author | yueg <yueg@google.com> | 2018-01-23 13:04:18 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-23 13:10:54 -0800 |
commit | b52ea741beaf9d852c3dc6797fac52a3351e0dd9 (patch) | |
tree | 180d720c77e5148593d9d6ecc34af94ba0d46b05 | |
parent | c0326e9b6b013321c44f9b1ab1a640d361379774 (diff) |
Bubble bottom action changes.
- Hide bottom action view when bubble move canceled
- Get display height every time when show bottom action view (onConfigurationChanged() won't be called when bubble is not visible)
Test: manual
PiperOrigin-RevId: 182979768
Change-Id: I989422c4ab5866b22c78bffbc82f229842a6dd9e
-rw-r--r-- | java/com/android/newbubble/BottomActionViewController.java | 4 | ||||
-rw-r--r-- | java/com/android/newbubble/NewMoveHandler.java | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/java/com/android/newbubble/BottomActionViewController.java b/java/com/android/newbubble/BottomActionViewController.java index 485d04169..04e0e5fe7 100644 --- a/java/com/android/newbubble/BottomActionViewController.java +++ b/java/com/android/newbubble/BottomActionViewController.java @@ -40,8 +40,8 @@ final class BottomActionViewController { private final Context context; private final WindowManager windowManager; private final int gradientHeight; - private final int bottomActionViewTop; private final int textOffsetSize; + private int bottomActionViewTop; private View bottomActionView; private View dismissView; @@ -55,7 +55,6 @@ final class BottomActionViewController { windowManager = context.getSystemService(WindowManager.class); gradientHeight = context.getResources().getDimensionPixelSize(R.dimen.bubble_bottom_action_view_height); - bottomActionViewTop = context.getResources().getDisplayMetrics().heightPixels - gradientHeight; textOffsetSize = context.getResources().getDimensionPixelSize(R.dimen.bubble_bottom_action_text_offset); } @@ -76,6 +75,7 @@ final class BottomActionViewController { // Add the target to the window // TODO(yueg): use TYPE_NAVIGATION_BAR_PANEL to draw over navigation bar + bottomActionViewTop = context.getResources().getDisplayMetrics().heightPixels - gradientHeight; LayoutParams layoutParams = new LayoutParams( LayoutParams.MATCH_PARENT, diff --git a/java/com/android/newbubble/NewMoveHandler.java b/java/com/android/newbubble/NewMoveHandler.java index c00c10729..12e099c3a 100644 --- a/java/com/android/newbubble/NewMoveHandler.java +++ b/java/com/android/newbubble/NewMoveHandler.java @@ -251,6 +251,14 @@ class NewMoveHandler implements OnTouchListener { } } break; + case MotionEvent.ACTION_CANCEL: + if (isMoving) { + snapX(); + isMoving = false; + bubble.onMoveFinish(); + bottomActionViewController.destroyBottomActionView(); + } + break; default: // fall out } return true; |