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

Commit f8b70112 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias Committed by Android (Google) Code Review
Browse files

Merge "Make the workspace popup menu items statically ordered." into ub-launcher3-master

parents 00524e7b 1b17d6be
Loading
Loading
Loading
Loading
+38 −20
Original line number Diff line number Diff line
@@ -151,13 +151,34 @@ public abstract class ArrowPopup<T extends BaseDraggingActivity> extends Abstrac
     * @param viewsToFlip number of views from the top to to flip in case of reverse order
     */
    protected void reorderAndShow(int viewsToFlip) {
        setupForDisplay();
        boolean reverseOrder = mIsAboveIcon;
        if (reverseOrder) {
            reverseOrder(viewsToFlip);
        }
        onInflationComplete(reverseOrder);
        addArrow();
        animateOpen();
    }

    /**
     * Shows the popup at the desired location.
     */
    protected void show() {
        setupForDisplay();
        onInflationComplete(false);
        addArrow();
        animateOpen();
    }

    private void setupForDisplay() {
        setVisibility(View.INVISIBLE);
        mIsOpen = true;
        getPopupContainer().addView(this);
        orientAboutObject();
    }

        boolean reverseOrder = mIsAboveIcon;
        if (reverseOrder) {
    private void reverseOrder(int viewsToFlip) {
        int count = getChildCount();
        ArrayList<View> allViews = new ArrayList<>(count);
        for (int i = 0; i < count; i++) {
@@ -174,9 +195,8 @@ public abstract class ArrowPopup<T extends BaseDraggingActivity> extends Abstrac

        orientAboutObject();
    }
        onInflationComplete(reverseOrder);

        // Add the arrow.
    private void addArrow() {
        final Resources res = getResources();
        final int arrowCenterOffset = res.getDimensionPixelSize(isAlignedWithStart()
                ? R.dimen.popup_arrow_horizontal_center_start
@@ -214,8 +234,6 @@ public abstract class ArrowPopup<T extends BaseDraggingActivity> extends Abstrac

        mArrow.setPivotX(arrowLp.width / 2);
        mArrow.setPivotY(mIsAboveIcon ? arrowLp.height : 0);

        animateOpen();
    }

    protected boolean isAlignedWithStart() {
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ public class OptionsPopupView extends ArrowPopup
            view.setOnLongClickListener(popup);
            popup.mItemMap.put(view, item);
        }
        popup.reorderAndShow(popup.getChildCount());
        popup.show();
    }

    @VisibleForTesting