Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b4f25e3 authored by Lyn Han's avatar Lyn Han
Browse files

Normalized icon bitmap

Extend Launcher's BaseIconFactory to create bubble icon instead of manually creating AdaptiveIconDrawable.

Launcher normalizes circles bigger and squares smaller to account for the visual difference in size.
This results in padding between bubble view and the actual icon.

This change
- increases individual_bubble_size to account for this padding
- preserves the previous value in bubble_icon_bitmap_size
- includes various space / animation adjustments to preserve existing UX
- removes manual shadow drawing from bubble stack view, since it's already provided by Launcher

Bug: 129158983
Test: manual (create bubbles, size and spacing still look good in collapsed and expanded states)
Test: manual (create bubble, flyout open / close animations look good)
Test: atest SystemUITests
Change-Id: Icf63a2be57daff21ec64d2e9ac0eb0cd96af0399
parent 4403658f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ android_library {
        "androidx.lifecycle_lifecycle-extensions",
        "androidx.dynamicanimation_dynamicanimation",
        "androidx-constraintlayout_constraintlayout",
        "iconloader_base",
        "SystemUI-tags",
        "SystemUI-proto",
        "metrics-helper-lib",
+5 −3
Original line number Diff line number Diff line
@@ -1110,7 +1110,9 @@
    <!-- Padding between status bar and bubbles when displayed in expanded state -->
    <dimen name="bubble_padding_top">16dp</dimen>
    <!-- Size of individual bubbles. -->
    <dimen name="individual_bubble_size">52dp</dimen>
    <dimen name="individual_bubble_size">60dp</dimen>
    <!-- Size of bubble icon bitmap. -->
    <dimen name="bubble_icon_bitmap_size">52dp</dimen>
    <!-- Size of the circle around the bubbles when they're in the dismiss target. -->
    <dimen name="bubble_dismiss_encircle_size">56dp</dimen>
    <!-- How much to inset the icon in the circle -->
@@ -1142,9 +1144,9 @@
    <!-- Offset between bubbles in their stacked position. -->
    <dimen name="bubble_stack_offset">5dp</dimen>
    <!-- How far offscreen the bubble stack rests. -->
    <dimen name="bubble_stack_offscreen">5dp</dimen>
    <dimen name="bubble_stack_offscreen">9dp</dimen>
    <!-- How far down the screen the stack starts. -->
    <dimen name="bubble_stack_starting_offset_y">100dp</dimen>
    <dimen name="bubble_stack_starting_offset_y">96dp</dimen>
    <!-- Size of image buttons in the bubble header -->
    <dimen name="bubble_header_icon_size">48dp</dimen>
    <!-- Space between the pointer triangle and the bubble expanded view -->
+3 −3
Original line number Diff line number Diff line
@@ -55,9 +55,9 @@ public class BadgeRenderer {

    /** 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;
        final int iconBitmapSize =
                context.getResources().getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
        return SIZE_PERCENTAGE * iconBitmapSize;
    }

    static float getDotRadius(float dotCenterOffset) {
+4 −3
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ import com.android.systemui.R;
public class BadgedImageView extends ImageView {

    private BadgeRenderer mDotRenderer;
    private int mIconSize;
    private int mIconBitmapSize;

    private Rect mTempBounds = new Rect();
    private Point mTempPoint = new Point();

@@ -56,7 +57,7 @@ public class BadgedImageView extends ImageView {
    public BadgedImageView(Context context, AttributeSet attrs, int defStyleAttr,
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        mIconSize = getResources().getDimensionPixelSize(R.dimen.individual_bubble_size);
        mIconBitmapSize = getResources().getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
        mDotRenderer = new BadgeRenderer(getContext());

        TypedArray ta = context.obtainStyledAttributes(
@@ -69,7 +70,7 @@ public class BadgedImageView extends ImageView {
        super.onDraw(canvas);
        if (mShowUpdateDot) {
            getDrawingRect(mTempBounds);
            mTempPoint.set((getWidth() - mIconSize) / 2, getPaddingTop());
            mTempPoint.set((getWidth() - mIconBitmapSize) / 2, getPaddingTop());
            mDotRenderer.draw(canvas, mUpdateDotColor, mTempBounds, mDotScale, mTempPoint,
                    mOnLeft);
        }
+5 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class BubbleFlyoutView extends FrameLayout {
    private final int mFlyoutSpaceFromBubble;
    private final int mPointerSize;
    private final int mBubbleSize;
    private final int mBubbleIconBitmapSize;
    private final int mFlyoutElevation;
    private final int mBubbleElevation;
    private final int mFloatingBackgroundColor;
@@ -143,7 +144,9 @@ public class BubbleFlyoutView extends FrameLayout {
        mFlyoutPadding = res.getDimensionPixelSize(R.dimen.bubble_flyout_padding_x);
        mFlyoutSpaceFromBubble = res.getDimensionPixelSize(R.dimen.bubble_flyout_space_from_bubble);
        mPointerSize = res.getDimensionPixelSize(R.dimen.bubble_flyout_pointer_size);

        mBubbleSize = res.getDimensionPixelSize(R.dimen.individual_bubble_size);
        mBubbleIconBitmapSize = res.getDimensionPixelSize(R.dimen.bubble_icon_bitmap_size);
        mBubbleElevation = res.getDimensionPixelSize(R.dimen.bubble_elevation);
        mFlyoutElevation = res.getDimensionPixelSize(R.dimen.bubble_flyout_elevation);
        mNewDotOffsetFromBubbleBounds = BadgeRenderer.getDotCenterOffset(context);
@@ -216,7 +219,8 @@ public class BubbleFlyoutView extends FrameLayout {
        post(() -> {
            // Multi line flyouts get top-aligned to the bubble.
            if (mFlyoutText.getLineCount() > 1) {
                setTranslationY(stackPos.y);
                float bubbleIconTopPadding = (mBubbleSize - mBubbleIconBitmapSize) / 2f;
                setTranslationY(stackPos.y + bubbleIconTopPadding);
            } else {
                // Single line flyouts are vertically centered with respect to the bubble.
                setTranslationY(
Loading