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

Commit 750cf17e authored by Mady Mellor's avatar Mady Mellor
Browse files

Update width of expanded view to match new spec

And remove something unused.

Test: manual - expand bubble on large screen, note that
               size of expanded view is ~72% of screen
             - check that it's the full width on phone
Bug: 193910391
Change-Id: I4c2060d84db10b5b0d8f30e2530c743d6045486e
parent 2d886505
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@
         should also be updated. -->
    <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>
    <dimen name="bubble_expanded_view_phone_landscape_overflow_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 -->
+14 −7
Original line number Diff line number Diff line
@@ -65,7 +65,8 @@ public class BubblePositioner {
    public static final float FLYOUT_MAX_WIDTH_PERCENT_LARGE_SCREEN = 0.3f;
    /** The max percent of screen width to use for the flyout on phone. */
    public static final float FLYOUT_MAX_WIDTH_PERCENT = 0.6f;

    /** The percent of screen width that should be used for the expanded view on a large screen. **/
    public static final float EXPANDED_VIEW_LARGE_SCREEN_WIDTH_PERCENT = 0.72f;

    private Context mContext;
    private WindowManager mWindowManager;
@@ -78,7 +79,8 @@ public class BubblePositioner {

    private int mBubbleSize;
    private int mSpacingBetweenBubbles;
    private int mExpandedViewLargeScreenWidth;
    private float mExpandedViewLargeScreenWidth;
    private int mOverflowWidth;
    private int mExpandedViewPadding;
    private int mPointerMargin;
    private int mPointerWidth;
@@ -166,9 +168,11 @@ public class BubblePositioner {
        mBubbleSize = res.getDimensionPixelSize(R.dimen.bubble_size);
        mSpacingBetweenBubbles = res.getDimensionPixelSize(R.dimen.bubble_spacing);
        mDefaultMaxBubbles = res.getInteger(R.integer.bubbles_max_rendered);

        mExpandedViewLargeScreenWidth = res.getDimensionPixelSize(
                R.dimen.bubble_expanded_view_tablet_width);
        mExpandedViewLargeScreenWidth = bounds.width() * EXPANDED_VIEW_LARGE_SCREEN_WIDTH_PERCENT;
        mOverflowWidth = mIsLargeScreen
                ? (int) mExpandedViewLargeScreenWidth
                : res.getDimensionPixelSize(
                        R.dimen.bubble_expanded_view_phone_landscape_overflow_width);
        mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
        mPointerWidth = res.getDimensionPixelSize(R.dimen.bubble_pointer_width);
        mPointerHeight = res.getDimensionPixelSize(R.dimen.bubble_pointer_height);
@@ -299,16 +303,19 @@ public class BubblePositioner {
        int leftPadding = mInsets.left + mExpandedViewPadding;
        int rightPadding = mInsets.right + mExpandedViewPadding;
        final boolean isLargeOrOverflow = mIsLargeScreen || isOverflow;
        final float expandedViewWidth = isOverflow
                ? mOverflowWidth
                : mExpandedViewLargeScreenWidth;
        if (showBubblesVertically()) {
            if (!onLeft) {
                rightPadding += mBubbleSize - mPointerHeight;
                leftPadding += isLargeOrOverflow
                        ? (mPositionRect.width() - rightPadding - mExpandedViewLargeScreenWidth)
                        ? (mPositionRect.width() - rightPadding - expandedViewWidth)
                        : 0;
            } else {
                leftPadding += mBubbleSize - mPointerHeight;
                rightPadding += isLargeOrOverflow
                        ? (mPositionRect.width() - leftPadding - mExpandedViewLargeScreenWidth)
                        ? (mPositionRect.width() - leftPadding - expandedViewWidth)
                        : 0;
            }
        }
+0 −3
Original line number Diff line number Diff line
@@ -64,9 +64,6 @@ public class ExpandedAnimationController
    /** Stiffness for the expand/collapse path-following animation. */
    private static final int EXPAND_COLLAPSE_ANIM_STIFFNESS = 1000;

    /** What percentage of the screen to use when centering the bubbles in landscape. */
    private static final float CENTER_BUBBLES_LANDSCAPE_PERCENT = 0.66f;

    /**
     * Velocity required to dismiss an individual bubble without dragging it into the dismiss
     * target.