Some visual fixes for when header is in footer position + proper radius
* Uses the radius value from the theme
* Applies that to the header / permission viewWrapper based on orientation
of the bubbles
* Also swaps position of the divider when its a footer
Test: manual / visual
- toggle bubbles to show at bottom with a footer and make sure
rounded corners are in right place
Change-Id: Ieb6db4aedfda125ddf590876aa8b0ee0ee7fc473
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index b635033..22e904f 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -39,6 +39,7 @@
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -189,6 +190,8 @@
mPointerView.setBackground(triangleDrawable);
FrameLayout viewWrapper = findViewById(R.id.header_permission_wrapper);
+ viewWrapper.setBackground(createHeaderPermissionBackground(bgColor));
+
LayoutTransition transition = new LayoutTransition();
transition.setDuration(200);
@@ -204,6 +207,7 @@
viewWrapper.setLayoutTransition(transition);
viewWrapper.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
+
mHeaderHeight = getContext().getResources().getDimensionPixelSize(
R.dimen.bubble_expanded_header_height);
mPermissionHeight = getContext().getResources().getDimensionPixelSize(
@@ -243,7 +247,10 @@
if (!mShowOnTop) {
removeView(mPointerView);
if (mUseFooter) {
+ View divider = findViewById(R.id.divider);
+ viewWrapper.removeView(divider);
removeView(viewWrapper);
+ addView(divider);
addView(viewWrapper);
}
addView(mPointerView);
@@ -251,6 +258,25 @@
}
/**
+ * Creates a background with corners rounded based on how the view is configured to display
+ */
+ private Drawable createHeaderPermissionBackground(int bgColor) {
+ TypedArray ta2 = getContext().obtainStyledAttributes(
+ new int[] {android.R.attr.dialogCornerRadius});
+ final float cr = ta2.getDimension(0, 0f);
+ ta2.recycle();
+
+ float[] radii = mUseFooter
+ ? new float[] {0, 0, 0, 0, cr, cr, cr, cr}
+ : new float[] {cr, cr, cr, cr, 0, 0, 0, 0};
+ GradientDrawable chromeBackground = new GradientDrawable();
+ chromeBackground.setShape(GradientDrawable.RECTANGLE);
+ chromeBackground.setCornerRadii(radii);
+ chromeBackground.setColor(bgColor);
+ return chromeBackground;
+ }
+
+ /**
* Sets the listener to notify when a bubble has been blocked.
*/
public void setOnBlockedListener(OnBubbleBlockedListener listener) {