summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lyn Han <lynhan@google.com> 2019-05-23 11:01:41 -0700
committer Lyn Han <lynhan@google.com> 2019-05-23 11:28:48 -0700
commit9a2f5cfcfcb6cc937b2da3b1ae426c72a435eac7 (patch)
treea11907348599d61af16da1249d4a1df6db9e68f1
parent99885212fa371bca69da74416b18886f5fee8795 (diff)
Use pointer width from res before getWidth is ready
Fix bug where the first time that bubble stack expands -mPointerView.getWidth() returns 0 while mPointerView is being created -setPointerPosition adjusts pointer position by 0 -pointer points to right of center Also -replace mPointerView.getHeight() with mPointerHeight -remove unused getExpandedSize() Bug: 131849856 Test: manual Change-Id: I433cf7755152e49c2f8a2fd3df0b70c6dd079b57
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java18
1 files changed, 5 insertions, 13 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 6add4a483103..cbe6c99bfb0b 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -350,14 +350,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
return true;
}
- /**
- * @return total height that the expanded view occupies.
- */
- int getExpandedSize() {
- return mBubbleHeight + mPointerView.getHeight() + mPointerMargin
- + mSettingsIconHeight;
- }
-
void updateHeight() {
if (usingActivityView()) {
Notification.BubbleMetadata data = mEntry.getBubbleMetadata();
@@ -379,8 +371,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
}
desiredHeight = desiredPx > 0 ? desiredPx : mMinHeight;
}
- int max = mStackView.getMaxExpandedHeight() - mSettingsIconHeight
- - mPointerView.getHeight() - mPointerMargin;
+ int max = mStackView.getMaxExpandedHeight() - mSettingsIconHeight - mPointerHeight
+ - mPointerMargin;
float height = Math.min(desiredHeight, max);
height = Math.max(height, mMinHeight);
LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams();
@@ -444,9 +436,9 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
* Set the x position that the tip of the triangle should point to.
*/
public void setPointerPosition(float x) {
- // Adjust for the pointer size
- x -= (mPointerView.getWidth() / 2f);
- mPointerView.setTranslationX(x);
+ float halfPointerWidth = mPointerWidth / 2f;
+ float pointerLeft = x - halfPointerWidth;
+ mPointerView.setTranslationX(pointerLeft);
mPointerView.setVisibility(VISIBLE);
}