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

Commit bb53cce0 authored by Mady Mellor's avatar Mady Mellor
Browse files

Update sizes for the bubble avatar

* Update sizes of badge & bubble; also simplify some of the sizing
  code, we can do it with just the overall size
* Simplified things, instead of the inner / outer sizes just use
  the overall size

Test: visual - create a bubble and look at the size of the bubble and
               badge
      visual - have some bubbles, change display size, create a new
               bubble & verify that all of the sizes are the same
Bug: 183657577
Change-Id: Ibd8609a8737bb0a57519fa70fba17138bb69b379
parent e1d07010
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/bubble_view"
        android:layout_gravity="center"
        android:layout_width="@dimen/individual_bubble_size"
        android:layout_height="@dimen/individual_bubble_size"/>
        android:layout_width="@dimen/bubble_size"
        android:layout_height="@dimen/bubble_size"/>

    <TextView
        android:id="@+id/bubble_view_name"
+9 −7
Original line number Diff line number Diff line
@@ -101,12 +101,12 @@
    <dimen name="bubble_flyout_avatar_message_space">6dp</dimen>
    <!-- Padding between status bar and bubbles when displayed in expanded state -->
    <dimen name="bubble_padding_top">16dp</dimen>
    <!-- Max amount of space between bubbles when expanded. -->
    <dimen name="bubble_max_spacing">8dp</dimen>
    <!-- Size of individual bubbles. -->
    <dimen name="individual_bubble_size">60dp</dimen>
    <!-- Size of bubble bitmap. -->
    <dimen name="bubble_bitmap_size">52dp</dimen>
    <!-- Space between bubbles when expanded. -->
    <dimen name="bubble_spacing">8dp</dimen>
    <!-- Size of the bubble. -->
    <dimen name="bubble_size">60dp</dimen>
    <!-- Size of the badge shown on the bubble. -->
    <dimen name="bubble_badge_size">24dp</dimen>
    <!-- Extra padding added to the touchable rect for bubbles so they are easier to grab. -->
    <dimen name="bubble_touch_padding">12dp</dimen>
    <!-- Size of the circle around the bubbles when they're in the dismiss target. -->
@@ -120,6 +120,8 @@
    <dimen name="bubble_expanded_default_height">180dp</dimen>
    <!-- On large screens the width of the expanded view is restricted to this size. -->
    <dimen name="bubble_expanded_view_tablet_width">412dp</dimen>
    <!-- Inset to apply to the icon in the overflow button. -->
    <dimen name="bubble_overflow_icon_inset">30dp</dimen>
    <!-- Default (and minimum) height of bubble overflow -->
    <dimen name="bubble_overflow_height">480dp</dimen>
    <!-- Bubble overflow padding when there are no bubbles  -->
@@ -154,7 +156,7 @@
    <!-- Interior padding of the message bubble -->
    <dimen name="bubble_message_padding">4dp</dimen>
    <!-- Offset between bubbles in their stacked position. -->
    <dimen name="bubble_stack_offset">10dp</dimen>
    <dimen name="bubble_stack_offset">12dp</dimen>
    <!-- Offset between stack y and animation y for bubble swap. -->
    <dimen name="bubble_swap_animation_offset">15dp</dimen>
    <!-- How far offscreen the bubble stack rests. There's some padding around the bubble so
+2 −2
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ public class BadgedImageView extends ImageView {

        Path iconPath = PathParser.createPathFromPathData(
                getResources().getString(com.android.internal.R.string.config_icon_mask));
        mDotRenderer = new DotRenderer(mPositioner.getBubbleBitmapSize(),
        mDotRenderer = new DotRenderer(mPositioner.getBubbleSize(),
                iconPath, DEFAULT_PATH_SIZE);
    }

@@ -192,7 +192,7 @@ public class BadgedImageView extends ImageView {
     * @param iconPath The new icon path to use when calculating dot position.
     */
    void drawDot(Path iconPath) {
        mDotRenderer = new DotRenderer(mPositioner.getBubbleBitmapSize(),
        mDotRenderer = new DotRenderer(mPositioner.getBubbleSize(),
                iconPath, DEFAULT_PATH_SIZE);
        invalidate();
    }
+6 −1
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;

import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.launcher3.icons.IconNormalizer;
import com.android.wm.shell.R;
import com.android.wm.shell.TaskView;
import com.android.wm.shell.common.AlphaOptimizedButton;
@@ -726,9 +727,13 @@ public class BubbleExpandedView extends LinearLayout {
        setPadding((int) paddingLeft, (int) paddingTop, (int) paddingRight, 0);

        final float expandedViewY = mPositioner.getExpandedViewY();
        // TODO: I don't understand why it works but it does - why normalized in portrait
        //  & not in landscape? Am I missing ~2dp in the portrait expandedViewY calculation?
        final float normalizedSize = IconNormalizer.getNormalizedCircleSize(
                mPositioner.getBubbleSize());
        final float bubbleCenter = showVertically
                ? bubblePosition + (mPositioner.getBubbleSize() / 2f) - expandedViewY
                : bubblePosition + (mPositioner.getBubbleBitmapSize() / 2f) - mPointerWidth;
                : bubblePosition + (normalizedSize / 2f) - mPointerWidth;
        // Post because we need the width of the view
        post(() -> {
            float pointerY;
+1 −3
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ public class BubbleFlyoutView extends FrameLayout {
    private final int mFlyoutSpaceFromBubble;
    private final int mPointerSize;
    private int mBubbleSize;
    private int mBubbleBitmapSize;

    private final int mFlyoutElevation;
    private final int mBubbleElevation;
@@ -337,10 +336,9 @@ public class BubbleFlyoutView extends FrameLayout {
            boolean hideDot,
            BubblePositioner positioner)  {

        mBubbleBitmapSize = positioner.getBubbleBitmapSize();
        mBubbleSize = positioner.getBubbleSize();

        mOriginalDotSize = SIZE_PERCENTAGE * mBubbleBitmapSize;
        mOriginalDotSize = SIZE_PERCENTAGE * mBubbleSize;
        mNewDotRadius = (DOT_SCALE * mOriginalDotSize) / 2f;
        mNewDotSize = mNewDotRadius * 2f;

Loading