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

Commit 6247cf8a authored by Jonathan Miranda's avatar Jonathan Miranda Committed by Automerger Merge Worker
Browse files

Merge "Folder preview polish." into sc-dev am: 65c20f4a

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14912724

Change-Id: I7f9abd7f390c7bec329b8600faa051d162e68d1d
parents e908dbba 65c20f4a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -6,9 +6,9 @@ public class ClippedFolderIconLayoutRule {
    private static final int MIN_NUM_ITEMS_IN_PREVIEW = 2;

    private static final float MIN_SCALE = 0.44f;
    private static final float MAX_SCALE = 0.54f;
    private static final float MAX_RADIUS_DILATION = 0.10f;
    private static final float ITEM_RADIUS_SCALE_FACTOR = 1.2f;
    private static final float MAX_SCALE = 0.51f;
    private static final float MAX_RADIUS_DILATION = 0.1f;
    private static final float ITEM_RADIUS_SCALE_FACTOR = 1.15f;

    public static final int EXIT_INDEX = -2;
    public static final int ENTER_INDEX = -3;
+1 −1
Original line number Diff line number Diff line
@@ -743,7 +743,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        }

        mContent.completePendingPageChanges();
        mContent.snapToPageImmediately(pageNo);
        mContent.setCurrentPage(pageNo);

        // This is set to true in close(), but isn't reset to false until onDropCompleted(). This
        // leads to an inconsistent state if you drag out of the folder and drag back in without
+30 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.launcher3.folder;

import static android.view.View.ALPHA;

import static com.android.launcher3.BubbleTextView.TEXT_ALPHA_PROPERTY;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
@@ -57,6 +59,7 @@ import java.util.List;
public class FolderAnimationManager {

    private static final int FOLDER_NAME_ALPHA_DURATION = 32;
    private static final int LARGE_FOLDER_FOOTER_DURATION = 128;

    private Folder mFolder;
    private FolderPagedView mContent;
@@ -214,7 +217,22 @@ public class FolderAnimationManager {
        play(a, getAnimator(mFolder, View.TRANSLATION_Y, yDistance, 0f));
        play(a, getAnimator(mFolder.mContent, SCALE_PROPERTY, initialScale, finalScale));
        play(a, getAnimator(mFolder.mFooter, SCALE_PROPERTY, initialScale, finalScale));
        play(a, mFolderIcon.mFolderName.createTextAlphaAnimator(!mIsOpening));

        final int footerAlphaDuration;
        final int footerStartDelay;
        if (isLargeFolder()) {
            if (mIsOpening) {
                footerAlphaDuration = LARGE_FOLDER_FOOTER_DURATION;
                footerStartDelay = mDuration - footerAlphaDuration;
            } else {
                footerAlphaDuration = 0;
                footerStartDelay = 0;
            }
        } else {
            footerStartDelay = 0;
            footerAlphaDuration = mDuration;
        }
        play(a, getAnimator(mFolder.mFooter, ALPHA, 0, 1f), footerStartDelay, footerAlphaDuration);

        // Create reveal animator for the folder background
        play(a, getShape().createRevealAnimator(
@@ -225,9 +243,13 @@ public class FolderAnimationManager {
                + mDeviceProfile.folderCellWidthPx * 2;
        int height = mContent.getPaddingTop() + mDeviceProfile.folderCellLayoutBorderSpacingPx
                + mDeviceProfile.folderCellHeightPx * 2;
        Rect startRect2 = new Rect(0, 0, width, height);
        int page = mIsOpening ? mContent.getCurrentPage() : mContent.getDestinationPage();
        int left = mContent.getPaddingLeft() + page * mContent.getWidth();
        Rect contentStart = new Rect(left, 0, left + width, height);
        Rect contentEnd = new Rect(endRect.left + left, endRect.top, endRect.right + left,
                endRect.bottom);
        play(a, getShape().createRevealAnimator(
                mFolder.getContent(), startRect2, endRect, finalRadius, !mIsOpening));
                mFolder.getContent(), contentStart, contentEnd, finalRadius, !mIsOpening));


        // Fade in the folder name, as the text can overlap the icons when grid size is small.
@@ -420,8 +442,12 @@ public class FolderAnimationManager {
        as.play(a);
    }

    private boolean isLargeFolder() {
        return mFolder.getItemCount() > MAX_NUM_ITEMS_IN_PREVIEW;
    }

    private TimeInterpolator getPreviewItemInterpolator() {
        if (mFolder.getItemCount() > MAX_NUM_ITEMS_IN_PREVIEW) {
        if (isLargeFolder()) {
            // With larger folders, we want the preview items to reach their final positions faster
            // (when opening) and later (when closing) so that they appear aligned with the rest of
            // the folder items when they are both visible.
+1 −0
Original line number Diff line number Diff line
@@ -627,6 +627,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
        if (!mForceHideDot && ((mDotInfo != null && mDotInfo.hasDot()) || mDotScale > 0)) {
            Rect iconBounds = mDotParams.iconBounds;
            BubbleTextView.getIconBounds(this, iconBounds, mActivity.getDeviceProfile().iconSizePx);
            iconBounds.offset(0, mBackground.paddingY);
            float iconScale = (float) mBackground.previewSize / iconBounds.width();
            Utilities.scaleRectAboutCenter(iconBounds, iconScale);

+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ class FolderPreviewItemAnim {
            int duration, final Runnable onCompleteRunnable) {
        mItemManager = itemManager;
        mParams = params;
        mParams.index = index1;

        mItemManager.computePreviewItemDrawingParams(index1, items1, sTmpParams);
        finalState = new float[] {sTmpParams.scale, sTmpParams.transX, sTmpParams.transY};
Loading