diff options
3 files changed, 28 insertions, 29 deletions
diff --git a/packages/SystemUI/res/drawable/bubble_expanded_header_bg.xml b/packages/SystemUI/res/drawable/bubble_expanded_header_bg.xml deleted file mode 100644 index a76b7b1c8f7b..000000000000 --- a/packages/SystemUI/res/drawable/bubble_expanded_header_bg.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2018 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> -<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> - <item> - <shape android:shape="rectangle"> - <solid android:color="?android:attr/colorBackgroundFloating"/> - <corners - android:topLeftRadius="@dimen/corner_size" - android:topRightRadius="@dimen/corner_size"/> - </shape> - </item> -</layer-list>
\ No newline at end of file diff --git a/packages/SystemUI/res/layout/bubble_expanded_view.xml b/packages/SystemUI/res/layout/bubble_expanded_view.xml index a8b1b2e3531f..56a3cd5499e3 100644 --- a/packages/SystemUI/res/layout/bubble_expanded_view.xml +++ b/packages/SystemUI/res/layout/bubble_expanded_view.xml @@ -29,10 +29,9 @@ <FrameLayout android:id="@+id/header_permission_wrapper" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:animateLayoutChanges="true" - android:background="@drawable/bubble_expanded_header_bg"> + android:animateLayoutChanges="true"> <LinearLayout android:id="@+id/header_layout" diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index a67bf46ee0c6..603b3b9766d9 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.Color; 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; @@ -188,6 +189,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mPointerView.setBackground(triangleDrawable); FrameLayout viewWrapper = findViewById(R.id.header_permission_wrapper); + viewWrapper.setBackground(createHeaderPermissionBackground(bgColor)); + LayoutTransition transition = new LayoutTransition(); transition.setDuration(200); @@ -203,6 +206,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList viewWrapper.setLayoutTransition(transition); viewWrapper.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); + mHeaderHeight = getContext().getResources().getDimensionPixelSize( R.dimen.bubble_expanded_header_height); mPermissionHeight = getContext().getResources().getDimensionPixelSize( @@ -242,7 +246,10 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList if (!mShowOnTop) { removeView(mPointerView); if (mUseFooter) { + View divider = findViewById(R.id.divider); + viewWrapper.removeView(divider); removeView(viewWrapper); + addView(divider); addView(viewWrapper); } addView(mPointerView); @@ -250,6 +257,25 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } /** + * 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) { |