Loading packages/SystemUI/res/drawable/bubble_flyout.xmldeleted 100644 → 0 +0 −30 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2019 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:bottomLeftRadius="?android:attr/dialogCornerRadius" android:topLeftRadius="?android:attr/dialogCornerRadius" android:bottomRightRadius="?android:attr/dialogCornerRadius" android:topRightRadius="?android:attr/dialogCornerRadius" /> <padding android:left="@dimen/bubble_flyout_pointer_size" android:right="@dimen/bubble_flyout_pointer_size" /> </shape> </item> </layer-list> No newline at end of file packages/SystemUI/res/layout/bubble_flyout.xml +4 −9 Original line number Diff line number Diff line Loading @@ -13,18 +13,13 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/bubble_flyout_pointer_size" android:paddingRight="@dimen/bubble_flyout_pointer_size"> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <FrameLayout android:id="@+id/bubble_flyout" android:id="@+id/bubble_flyout_text_container" android:layout_height="wrap_content" android:layout_width="wrap_content" android:background="@drawable/bubble_flyout" android:clipToPadding="false" android:paddingLeft="@dimen/bubble_flyout_padding_x" android:paddingRight="@dimen/bubble_flyout_padding_x" android:paddingTop="@dimen/bubble_flyout_padding_y" Loading @@ -41,4 +36,4 @@ </FrameLayout> </FrameLayout> No newline at end of file </merge> No newline at end of file packages/SystemUI/src/com/android/systemui/bubbles/BadgeRenderer.java +20 −6 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ package com.android.systemui.bubbles; import static android.graphics.Paint.ANTI_ALIAS_FLAG; import static android.graphics.Paint.FILTER_BITMAP_FLAG; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.util.Log; import com.android.systemui.R; // XXX: Mostly opied from launcher code / can we share? /** * Contains parameters necessary to draw a badge for an icon (e.g. the size of the badge). Loading @@ -32,20 +35,31 @@ public class BadgeRenderer { private static final String TAG = "BadgeRenderer"; // The badge sizes are defined as percentages of the app icon size. /** The badge sizes are defined as percentages of the app icon size. */ private static final float SIZE_PERCENTAGE = 0.38f; // Extra scale down of the dot /** Extra scale down of the dot. */ private static final float DOT_SCALE = 0.6f; private final float mDotCenterOffset; private final float mCircleRadius; private final Paint mCirclePaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG); public BadgeRenderer(int iconSizePx) { mDotCenterOffset = SIZE_PERCENTAGE * iconSizePx; int size = (int) (DOT_SCALE * mDotCenterOffset); mCircleRadius = size / 2f; public BadgeRenderer(Context context) { mDotCenterOffset = getDotCenterOffset(context); mCircleRadius = getDotRadius(mDotCenterOffset); } /** Space between the center of the dot and the top or left of the bubble stack. */ static float getDotCenterOffset(Context context) { final int iconSizePx = context.getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); return SIZE_PERCENTAGE * iconSizePx; } static float getDotRadius(float dotCenterOffset) { int size = (int) (DOT_SCALE * dotCenterOffset); return size / 2f; } /** Loading packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java +5 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class BadgedImageView extends ImageView { int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mIconSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); mDotRenderer = new BadgeRenderer(mIconSize); mDotRenderer = new BadgeRenderer(getContext()); TypedArray ta = context.obtainStyledAttributes( new int[] {android.R.attr.colorBackgroundFloating}); Loading @@ -83,6 +83,10 @@ public class BadgedImageView extends ImageView { invalidate(); } public boolean getDotPosition() { return mOnLeft; } /** * Set whether the dot should show or not. */ Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class Bubble { public void updateDotVisibility() { if (iconView != null) { iconView.updateDotVisibility(); iconView.updateDotVisibility(true /* animate */); } } Loading Loading
packages/SystemUI/res/drawable/bubble_flyout.xmldeleted 100644 → 0 +0 −30 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2019 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:bottomLeftRadius="?android:attr/dialogCornerRadius" android:topLeftRadius="?android:attr/dialogCornerRadius" android:bottomRightRadius="?android:attr/dialogCornerRadius" android:topRightRadius="?android:attr/dialogCornerRadius" /> <padding android:left="@dimen/bubble_flyout_pointer_size" android:right="@dimen/bubble_flyout_pointer_size" /> </shape> </item> </layer-list> No newline at end of file
packages/SystemUI/res/layout/bubble_flyout.xml +4 −9 Original line number Diff line number Diff line Loading @@ -13,18 +13,13 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/bubble_flyout_pointer_size" android:paddingRight="@dimen/bubble_flyout_pointer_size"> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <FrameLayout android:id="@+id/bubble_flyout" android:id="@+id/bubble_flyout_text_container" android:layout_height="wrap_content" android:layout_width="wrap_content" android:background="@drawable/bubble_flyout" android:clipToPadding="false" android:paddingLeft="@dimen/bubble_flyout_padding_x" android:paddingRight="@dimen/bubble_flyout_padding_x" android:paddingTop="@dimen/bubble_flyout_padding_y" Loading @@ -41,4 +36,4 @@ </FrameLayout> </FrameLayout> No newline at end of file </merge> No newline at end of file
packages/SystemUI/src/com/android/systemui/bubbles/BadgeRenderer.java +20 −6 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ package com.android.systemui.bubbles; import static android.graphics.Paint.ANTI_ALIAS_FLAG; import static android.graphics.Paint.FILTER_BITMAP_FLAG; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.util.Log; import com.android.systemui.R; // XXX: Mostly opied from launcher code / can we share? /** * Contains parameters necessary to draw a badge for an icon (e.g. the size of the badge). Loading @@ -32,20 +35,31 @@ public class BadgeRenderer { private static final String TAG = "BadgeRenderer"; // The badge sizes are defined as percentages of the app icon size. /** The badge sizes are defined as percentages of the app icon size. */ private static final float SIZE_PERCENTAGE = 0.38f; // Extra scale down of the dot /** Extra scale down of the dot. */ private static final float DOT_SCALE = 0.6f; private final float mDotCenterOffset; private final float mCircleRadius; private final Paint mCirclePaint = new Paint(ANTI_ALIAS_FLAG | FILTER_BITMAP_FLAG); public BadgeRenderer(int iconSizePx) { mDotCenterOffset = SIZE_PERCENTAGE * iconSizePx; int size = (int) (DOT_SCALE * mDotCenterOffset); mCircleRadius = size / 2f; public BadgeRenderer(Context context) { mDotCenterOffset = getDotCenterOffset(context); mCircleRadius = getDotRadius(mDotCenterOffset); } /** Space between the center of the dot and the top or left of the bubble stack. */ static float getDotCenterOffset(Context context) { final int iconSizePx = context.getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); return SIZE_PERCENTAGE * iconSizePx; } static float getDotRadius(float dotCenterOffset) { int size = (int) (DOT_SCALE * dotCenterOffset); return size / 2f; } /** Loading
packages/SystemUI/src/com/android/systemui/bubbles/BadgedImageView.java +5 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ public class BadgedImageView extends ImageView { int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mIconSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size); mDotRenderer = new BadgeRenderer(mIconSize); mDotRenderer = new BadgeRenderer(getContext()); TypedArray ta = context.obtainStyledAttributes( new int[] {android.R.attr.colorBackgroundFloating}); Loading @@ -83,6 +83,10 @@ public class BadgedImageView extends ImageView { invalidate(); } public boolean getDotPosition() { return mOnLeft; } /** * Set whether the dot should show or not. */ Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +1 −1 Original line number Diff line number Diff line Loading @@ -83,7 +83,7 @@ class Bubble { public void updateDotVisibility() { if (iconView != null) { iconView.updateDotVisibility(); iconView.updateDotVisibility(true /* animate */); } } Loading