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

Commit 1add7b84 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Correct pointer position" into qt-dev

parents 1d116059 6f6b3ae3
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -173,6 +173,7 @@ public class BubbleStackView extends FrameLayout {

    private int mBubbleSize;
    private int mBubblePadding;
    private int mExpandedViewPadding;
    private int mExpandedAnimateXDistance;
    private int mExpandedAnimateYDistance;
    private int mStatusBarHeight;
@@ -317,11 +318,12 @@ public class BubbleStackView extends FrameLayout {

        mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);

        int padding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
        mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding);
        int elevation = res.getDimensionPixelSize(R.dimen.bubble_elevation);

        mStackAnimationController = new StackAnimationController();
        mExpandedAnimationController = new ExpandedAnimationController(mDisplaySize);
        mExpandedAnimationController = new ExpandedAnimationController(
                mDisplaySize, mExpandedViewPadding);
        mSurfaceSynchronizer = synchronizer != null ? synchronizer : DEFAULT_SURFACE_SYNCHRONIZER;

        mBubbleContainer = new PhysicsAnimationLayout(context);
@@ -334,7 +336,8 @@ public class BubbleStackView extends FrameLayout {

        mExpandedViewContainer = new FrameLayout(context);
        mExpandedViewContainer.setElevation(elevation);
        mExpandedViewContainer.setPadding(padding, padding, padding, padding);
        mExpandedViewContainer.setPadding(mExpandedViewPadding, mExpandedViewPadding,
                mExpandedViewPadding, mExpandedViewPadding);
        mExpandedViewContainer.setClipChildren(false);
        addView(mExpandedViewContainer);

@@ -1522,8 +1525,14 @@ public class BubbleStackView extends FrameLayout {
        Bubble expandedBubble = getExpandedBubble();
        if (expandedBubble != null) {
            BubbleView iconView = expandedBubble.iconView;
            float pointerPosition = iconView.getTranslationX() + (iconView.getWidth() / 2f);
            expandedBubble.expandedView.setPointerPosition((int) pointerPosition);
            float bubbleLeft = iconView.getTranslationX();
            float halfBubbleWidth = (iconView.getWidth() / 2f);

            // Bubbles live in expanded view container (x includes expanded view padding).
            // Pointer lives in expanded view, which has padding (x does not include padding).
            // Remove padding when deriving pointer location from bubbles.
            float pointerX = bubbleLeft - mExpandedViewPadding + halfBubbleWidth;
            expandedBubble.expandedView.setPointerPosition((int) pointerX);
        }
    }

+5 −2
Original line number Diff line number Diff line
@@ -78,8 +78,11 @@ public class ExpandedAnimationController
     */
    private boolean mSpringingBubbleToTouch = false;

    public ExpandedAnimationController(Point displaySize) {
    private int mExpandedViewPadding;

    public ExpandedAnimationController(Point displaySize, int expandedViewPadding) {
        mDisplaySize = displaySize;
        mExpandedViewPadding = expandedViewPadding;
    }

    /**
@@ -122,7 +125,7 @@ public class ExpandedAnimationController
                new ChildAnimationConfigurator() {
                    // How much to translate the next bubble, so that it is not overlapping the
                    // previous one.
                    float mTranslateNextBubbleXBy = mBubblePaddingPx;
                    float mTranslateNextBubbleXBy = mExpandedViewPadding + mBubblePaddingPx;

                    @Override
                    public void configureAnimationForChildAtIndex(
+2 −1
Original line number Diff line number Diff line
@@ -45,7 +45,8 @@ public class ExpandedAnimationControllerTest extends PhysicsAnimationLayoutTestC

    @Spy
    private ExpandedAnimationController mExpandedController =
            new ExpandedAnimationController(new Point(500, 1000) /* displaySize */);
            new ExpandedAnimationController(
                new Point(500, 1000) /* displaySize */, 0 /* expandedViewPadding */);
    private int mStackOffset;
    private float mBubblePadding;
    private float mBubbleSize;