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

Commit f62255e3 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Fix popup container alignment issues" into ub-launcher3-master

parents 9328a512 efacffa0
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -199,10 +199,6 @@
    <dimen name="popup_arrow_horizontal_center_start">28dp</dimen>
    <!-- popup_padding_end + deep_shortcut_drag_handle_size / 2 -->
    <dimen name="popup_arrow_horizontal_center_end">24dp</dimen>
    <!-- popup_arrow_center_start - popup_arrow_width / 2-->
    <dimen name="popup_arrow_horizontal_offset_start">23dp</dimen>
    <!-- popup_arrow_center_end - popup_arrow_width / 2-->
    <dimen name="popup_arrow_horizontal_offset_end">19dp</dimen>
    <dimen name="popup_arrow_corner_radius">2dp</dimen>
    <!-- popup_padding_start + icon_size + 10dp -->
    <dimen name="deep_shortcuts_text_padding_start">56dp</dimen>
+8 −10
Original line number Diff line number Diff line
@@ -341,15 +341,17 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
        updateDividers();

        // Add the arrow.
        final int arrowHorizontalOffset = getResources().getDimensionPixelSize(isAlignedWithStart()
                ? R.dimen.popup_arrow_horizontal_offset_start
                : R.dimen.popup_arrow_horizontal_offset_end);
        final Resources res = getResources();
        final int arrowCenterOffset = res.getDimensionPixelSize(isAlignedWithStart()
                ? R.dimen.popup_arrow_horizontal_center_start
                : R.dimen.popup_arrow_horizontal_center_end);
        final int halfArrowWidth = res.getDimensionPixelSize(R.dimen.popup_arrow_width) / 2;
        mLauncher.getDragLayer().addView(mArrow);
        DragLayer.LayoutParams arrowLp = (DragLayer.LayoutParams) mArrow.getLayoutParams();
        if (mIsLeftAligned) {
            mArrow.setX(getX() + arrowHorizontalOffset);
            mArrow.setX(getX() + arrowCenterOffset - halfArrowWidth);
        } else {
            mArrow.setX(getX() + getMeasuredWidth() - arrowHorizontalOffset);
            mArrow.setX(getX() + getMeasuredWidth() - arrowCenterOffset - halfArrowWidth);
        }

        if (Gravity.isVertical(mGravity)) {
@@ -435,9 +437,6 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra
            x = rightAlignedX;
        }
        mIsLeftAligned = x == leftAlignedX;
        if (mIsRtl) {
            x -= dragLayer.getWidth() - width;
        }

        // Offset x so that the arrow and shortcut icons are center-aligned with the original icon.
        int iconWidth = mOriginalIcon.getWidth()
@@ -529,8 +528,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra

        // enforce contained is within screen
        DragLayer dragLayer = mLauncher.getDragLayer();
        if (getTranslationX() + l < 0 ||
                getTranslationX() + r > dragLayer.getWidth()) {
        if (getTranslationX() + l < 0 || getTranslationX() + r > dragLayer.getWidth()) {
            // If we are still off screen, center horizontally too.
            mGravity |= Gravity.CENTER_HORIZONTAL;
        }