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

Commit f8962a54 authored by fbaron's avatar fbaron
Browse files

Test Week - Add more coverage for Folder.java

* Refactored Folder class
* 30  methods covered
* Adding more coverage for Folder.java

Bug: 353303621
Test: Not Applicable
Flag: TEST_ONLY
Change-Id: Ibd7ca8c2121ddc71c33f91262b46e593670eadfe
parent 892d3583
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -157,7 +157,8 @@ public class DragLayer extends BaseDragLayer<Launcher> implements LauncherOverla
                        isOverFolderOrSearchBar = isEventOverView(topView, ev) ||
                                isEventOverAccessibleDropTargetBar(ev);
                        if (!isOverFolderOrSearchBar) {
                            sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
                            sendTapOutsideFolderAccessibilityEvent(
                                    currentFolder.getIsEditingName());
                            mHoverPointClosesFolder = true;
                            return true;
                        }
@@ -167,7 +168,8 @@ public class DragLayer extends BaseDragLayer<Launcher> implements LauncherOverla
                        isOverFolderOrSearchBar = isEventOverView(topView, ev) ||
                                isEventOverAccessibleDropTargetBar(ev);
                        if (!isOverFolderOrSearchBar && !mHoverPointClosesFolder) {
                            sendTapOutsideFolderAccessibilityEvent(currentFolder.isEditingName());
                            sendTapOutsideFolderAccessibilityEvent(
                                    currentFolder.getIsEditingName());
                            mHoverPointClosesFolder = true;
                            return true;
                        } else if (!isOverFolderOrSearchBar) {
+286 −84
Original line number Diff line number Diff line
@@ -135,7 +135,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
     * We avoid measuring {@link #mContent} with a 0 width or height, as this
     * results in CellLayout being measured as UNSPECIFIED, which it does not support.
     */
    private static final int MIN_CONTENT_DIMEN = 5;
    @VisibleForTesting
    static final int MIN_CONTENT_DIMEN = 5;

    public static final int STATE_CLOSED = 0;
    public static final int STATE_ANIMATING = 1;
@@ -143,7 +144,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo

    @Retention(RetentionPolicy.SOURCE)
    @IntDef({STATE_CLOSED, STATE_ANIMATING, STATE_OPEN})
    public @interface FolderState {}
    public @interface FolderState {
    }

    /**
     * Time for which the scroll hint is shown before automatically changing page.
@@ -164,7 +166,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    private static final int FOLDER_COLOR_ANIMATION_DURATION = 200;

    private static final int REORDER_DELAY = 250;
    private static final int ON_EXIT_CLOSE_DELAY = 400;
    static final int ON_EXIT_CLOSE_DELAY = 400;
    private static final Rect sTempRect = new Rect();
    private static final int MIN_FOLDERS_FOR_HARDWARE_OPTIMIZATION = 10;

@@ -184,10 +186,10 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
                || itemType == ITEM_TYPE_APP_PAIR;
    }

    private final Alarm mReorderAlarm = new Alarm(Looper.getMainLooper());
    private final Alarm mOnExitAlarm = new Alarm(Looper.getMainLooper());
    private final Alarm mOnScrollHintAlarm = new Alarm(Looper.getMainLooper());
    final Alarm mScrollPauseAlarm = new Alarm(Looper.getMainLooper());
    private Alarm mReorderAlarm = new Alarm(Looper.getMainLooper());
    private Alarm mOnExitAlarm = new Alarm(Looper.getMainLooper());
    private Alarm mOnScrollHintAlarm = new Alarm(Looper.getMainLooper());
    private Alarm mScrollPauseAlarm = new Alarm(Looper.getMainLooper());

    final ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();

@@ -197,7 +199,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    // Folder can be displayed in Launcher's activity or a separate window (e.g. Taskbar).
    // Anything specific to Launcher should use mLauncherDelegate, otherwise should
    // use mActivityContext.
    protected final LauncherDelegate mLauncherDelegate;
    protected LauncherDelegate mLauncherDelegate;
    protected final ActivityContext mActivityContext;

    protected DragController mDragController;
@@ -210,7 +212,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo

    @Thunk
    FolderPagedView mContent;
    public FolderNameEditText mFolderName;
    private FolderNameEditText mFolderName;
    private PageIndicatorDots mPageIndicator;

    protected View mFooter;
@@ -234,10 +236,10 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    private OnFolderStateChangedListener mPriorityOnFolderStateChangedListener;
    @ViewDebug.ExportedProperty(category = "launcher")
    private boolean mRearrangeOnClose = false;
    boolean mItemsInvalidated = false;
    private boolean mItemsInvalidated = false;
    private View mCurrentDragView;
    private boolean mIsExternalDrag;
    private boolean mDragInProgress = false;
    private boolean mIsDragInProgress = false;
    private boolean mDeleteFolderOnDropCompleted = false;
    private boolean mSuppressFolderDeletion = false;
    private boolean mItemAddedBackToSelfViaIcon = false;
@@ -250,7 +252,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    private int mScrollAreaOffset;

    @Thunk
    int mScrollHintDir = SCROLL_NONE;
    private int mScrollHintDir = SCROLL_NONE;
    @Thunk
    int mCurrentScrollDir = SCROLL_NONE;

@@ -315,9 +317,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
                | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
        mFolderName.forceDisableSuggestions(true);
        mFolderName.setPadding(mFolderName.getPaddingLeft(),
                (mFooterHeight - mFolderName.getLineHeight()) / 2,
                (getFooterHeight() - mFolderName.getLineHeight()) / 2,
                mFolderName.getPaddingRight(),
                (mFooterHeight - mFolderName.getLineHeight()) / 2);
                (getFooterHeight() - mFolderName.getLineHeight()) / 2);

        mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this);
        setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback);
@@ -325,19 +327,37 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo

    public boolean onLongClick(View v) {
        // Return if global dragging is not enabled
        if (!mLauncherDelegate.isDraggingEnabled()) return true;
        if (!getIsLauncherDraggingEnabled()) return true;
        return startDrag(v, new DragOptions());
    }

    @VisibleForTesting
    boolean getIsLauncherDraggingEnabled() {
        return mLauncherDelegate.isDraggingEnabled();
    }

    public boolean startDrag(View v, DragOptions options) {
        Object tag = v.getTag();
        if (tag instanceof ItemInfo item) {
            mEmptyCellRank = item.rank;
            mCurrentDragView = v;

            mDragController.addDragListener(this);
            if (options.isAccessibleDrag) {
                mDragController.addDragListener(new AccessibleDragListenerAdapter(
            addDragListener(options);
            callBeginDragShared(v, options);
        }
        return true;
    }

    void callBeginDragShared(View v, DragOptions options) {
        mLauncherDelegate.beginDragShared(v, this, options);
    }

    void addDragListener(DragOptions options) {
        getDragController().addDragListener(this);
        if (!options.isAccessibleDrag) {
            return;
        }
        getDragController().addDragListener(new AccessibleDragListenerAdapter(
                mContent, FolderAccessibilityHelper::new) {
            @Override
            protected void enableAccessibleDrag(boolean enable,
@@ -350,17 +370,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        });
    }

            mLauncherDelegate.beginDragShared(v, this, options);
        }
        return true;
    }

    @Override
    public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
        if (dragObject.dragSource != this) {
            return;
        }

        mContent.removeItem(mCurrentDragView);
        mItemsInvalidated = true;

@@ -369,29 +383,23 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        try (SuppressInfoChanges s = new SuppressInfoChanges()) {
            mInfo.remove(dragObject.dragInfo, true);
        }
        mDragInProgress = true;
        mIsDragInProgress = true;
        mItemAddedBackToSelfViaIcon = false;
    }

    @Override
    public void onDragEnd() {
        if (mIsExternalDrag && mDragInProgress) {
        if (mIsExternalDrag && mIsDragInProgress) {
            completeDragExit();
        }
        mDragInProgress = false;
        mDragController.removeDragListener(this);
    }

    public boolean isEditingName() {
        return mIsEditingName;
        mIsDragInProgress = false;
        getDragController().removeDragListener(this);
    }

    public void startEditingFolderName() {
        post(() -> {
        showLabelSuggestions();
        mFolderName.setHint("");
        mIsEditingName = true;
        });
    }

    @Override
@@ -459,7 +467,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        return mFolderIcon;
    }

    public void setDragController(DragController dragController) {
    DragController getDragController() {
        return mDragController;
    }

    void setDragController(DragController dragController) {
        mDragController = dragController;
    }

@@ -540,7 +552,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
     * Show suggested folder title in FolderEditText if the first suggestion is non-empty, push
     * rest of the suggestions to InputMethodManager.
     */
    private void showLabelSuggestions() {
    void showLabelSuggestions() {
        if (mInfo.suggestedFolderNames == null) {
            return;
        }
@@ -634,11 +646,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
     */
    public void beginExternalDrag() {
        mIsExternalDrag = true;
        mDragInProgress = true;
        mIsDragInProgress = true;

        // Since this folder opened by another controller, it might not get onDrop or
        // onDropComplete. Perform cleanup once drag-n-drop ends.
        mDragController.addDragListener(this);
        getDragController().addDragListener(this);

        ArrayList<ItemInfo> items = new ArrayList<>(mInfo.getContents());
        mEmptyCellRank = items.size();
@@ -662,16 +674,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
     * is played.
     */
    private void animateOpen(List<ItemInfo> items, int pageNo) {
        if (items == null || items.size() <= 1) {
            Log.d(TAG, "Couldn't animate folder open because items is: " + items);
        if (!shouldAnimateOpen(items)) {
            return;
        }

        Folder openFolder = getOpen(mActivityContext);
        if (openFolder != null && openFolder != this) {
            // Close any open folder before opening a folder.
            openFolder.close(true);
        }
        closeOpenFolder(openFolder);

        mContent.bindItems(items);
        centerAboutIcon();
@@ -685,7 +693,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        // There was a one-off crash where the folder had a parent already.
        if (getParent() == null) {
            dragLayer.addView(this);
            mDragController.addDropTarget(this);
            getDragController().addDropTarget(this);
        } else {
            if (FeatureFlags.IS_STUDIO_BUILD) {
                Log.e(TAG, "Opening folder (" + this + ") which already has a parent:"
@@ -734,7 +742,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo

            // Do not update the flag if we are in drag mode. The flag will be updated, when we
            // actually drop the icon.
            final boolean updateAnimationFlag = !mDragInProgress;
            final boolean updateAnimationFlag = !mIsDragInProgress;
            anim.addListener(new AnimatorListenerAdapter() {

                @SuppressLint("InlinedApi")
@@ -768,12 +776,36 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        anim.start();

        // Make sure the folder picks up the last drag move even if the finger doesn't move.
        if (mDragController.isDragging()) {
            mDragController.forceTouchMove();
        if (getDragController().isDragging()) {
            getDragController().forceTouchMove();
        }
        mContent.verifyVisibleHighResIcons(mContent.getNextPage());
    }

    /**
     * Determines whether we should animate the folder opening.
     */
    boolean shouldAnimateOpen(List<ItemInfo> items) {
        if (items == null || items.size() <= 1) {
            Log.d(TAG, "Couldn't animate folder open because items is: " + items);
            return false;
        }
        return true;
    }

    /**
     * If there's a folder already open, we want to close it before opening another one.
     */
    @VisibleForTesting
    boolean closeOpenFolder(Folder openFolder) {
        if (openFolder != null && openFolder != this) {
            // Close any open folder before opening a folder.
            openFolder.close(true);
            return true;
        }
        return false;
    }

    @Override
    protected boolean isOfType(int type) {
        return (type & TYPE_FOLDER) != 0;
@@ -787,7 +819,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
            mCurrentAnimator.cancel();
        }

        if (isEditingName()) {
        if (mIsEditingName) {
            mFolderName.dispatchBackKey();
        }

@@ -871,7 +903,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        if (parent != null) {
            parent.removeView(this);
        }
        mDragController.removeDropTarget(this);
        getDragController().removeDropTarget(this);
        clearFocus();
        if (mFolderIcon != null) {
            mFolderIcon.setVisibility(View.VISIBLE);
@@ -892,12 +924,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
            mRearrangeOnClose = false;
        }
        if (getItemCount() <= 1) {
            if (!mDragInProgress && !mSuppressFolderDeletion) {
            if (!mIsDragInProgress && !mSuppressFolderDeletion) {
                replaceFolderWithFinalItem();
            } else if (mDragInProgress) {
            } else if (mIsDragInProgress) {
                mDeleteFolderOnDropCompleted = true;
            }
        } else if (!mDragInProgress) {
        } else if (!mIsDragInProgress) {
            mContent.unbindItems();
        }
        mSuppressFolderDeletion = false;
@@ -1017,7 +1049,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        }
    }

    private void clearDragInfo() {
    @VisibleForTesting
    void clearDragInfo() {
        mCurrentDragView = null;
        mIsExternalDrag = false;
    }
@@ -1058,7 +1091,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
            if (getItemCount() <= 1) {
                mDeleteFolderOnDropCompleted = true;
            }
            if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
            if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon
                    && target != this) {
                replaceFolderWithFinalItem();
            }
        } else {
@@ -1089,7 +1123,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        }

        mDeleteFolderOnDropCompleted = false;
        mDragInProgress = false;
        mIsDragInProgress = false;
        mItemAddedBackToSelfViaIcon = false;
        mCurrentDragView = null;

@@ -1132,7 +1166,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    }

    public void notifyDrop() {
        if (mDragInProgress) {
        if (mIsDragInProgress) {
            mItemAddedBackToSelfViaIcon = true;
        }
    }
@@ -1175,28 +1209,41 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    }

    protected int getContentAreaHeight() {
        DeviceProfile grid = mActivityContext.getDeviceProfile();
        int maxContentAreaHeight = grid.availableHeightPx - grid.getTotalWorkspacePadding().y
                - mFooterHeight;
        int height = Math.min(maxContentAreaHeight,
        int height = Math.min(getMaxContentAreaHeight(),
                mContent.getDesiredHeight());
        return Math.max(height, MIN_CONTENT_DIMEN);
    }

    private int getContentAreaWidth() {
    @VisibleForTesting
    int getMaxContentAreaHeight() {
        DeviceProfile grid = mActivityContext.getDeviceProfile();
        return grid.availableHeightPx - grid.getTotalWorkspacePadding().y
                - getFooterHeight();
    }

    @VisibleForTesting
    int getContentAreaWidth() {
        return Math.max(mContent.getDesiredWidth(), MIN_CONTENT_DIMEN);
    }

    private int getFolderWidth() {
    @VisibleForTesting
    int getFolderWidth() {
        return getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
    }

    private int getFolderHeight() {
    @VisibleForTesting
    int getFolderHeight() {
        return getFolderHeight(getContentAreaHeight());
    }

    private int getFolderHeight(int contentAreaHeight) {
        return getPaddingTop() + getPaddingBottom() + contentAreaHeight + mFooterHeight;
    @VisibleForTesting
    int getFolderHeight(int contentAreaHeight) {
        return getPaddingTop() + getPaddingBottom() + contentAreaHeight + getFooterHeight();
    }

    @VisibleForTesting
    int getFooterHeight() {
        return mFooterHeight;
    }

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
@@ -1366,7 +1413,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        }

        // Clear the drag info, as it is no longer being dragged.
        mDragInProgress = false;
        mIsDragInProgress = false;

        if (mContent.getPageCount() > 1) {
            // The animation has already been shown while opening the folder.
@@ -1435,7 +1482,8 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        }
    }

    private View getViewForInfo(final ItemInfo item) {
    @VisibleForTesting
    View getViewForInfo(final ItemInfo item) {
        return mContent.iterateOverItems((info, view) -> info == item);
    }

@@ -1493,7 +1541,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
            if (hasFocus) {
                mFromLabelState = mInfo.getFromLabelState();
                mFromTitle = mInfo.title;
                startEditingFolderName();
                post(this::startEditingFolderName);
            } else {
                StatsLogger statsLogger = mStatsLogManager.logger()
                        .withItemInfo(mInfo)
@@ -1626,7 +1674,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    /** Navigation bar back key or hardware input back key has been issued. */
    @Override
    public void onBackInvoked() {
        if (isEditingName()) {
        if (mIsEditingName) {
            mFolderName.dispatchBackKey();
        } else {
            super.onBackInvoked();
@@ -1638,7 +1686,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
            BaseDragLayer dl = (BaseDragLayer) getParent();

            if (isEditingName()) {
            if (mIsEditingName) {
                if (!dl.isEventOverView(mFolderName, ev)) {
                    mFolderName.dispatchBackKey();
                    return true;
@@ -1685,6 +1733,95 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        return mContent;
    }

    @VisibleForTesting
    void setItemAddedBackToSelfViaIcon(boolean value) {
        mItemAddedBackToSelfViaIcon = value;
    }

    @VisibleForTesting
    boolean getItemAddedBackToSelfViaIcon() {
        return mItemAddedBackToSelfViaIcon;
    }

    @VisibleForTesting
    void setIsDragInProgress(boolean value) {
        mIsDragInProgress = value;
    }

    @VisibleForTesting
    boolean getIsDragInProgress() {
        return mIsDragInProgress;
    }

    @VisibleForTesting
    View getCurrentDragView() {
        return mCurrentDragView;
    }

    @VisibleForTesting
    void setCurrentDragView(View view) {
        mCurrentDragView = view;
    }

    @VisibleForTesting
    boolean getItemsInvalidated() {
        return mItemsInvalidated;
    }

    @VisibleForTesting
    void setItemsInvalidated(boolean value) {
        mItemsInvalidated = value;
    }

    @VisibleForTesting
    boolean getIsExternalDrag() {
        return mIsExternalDrag;
    }

    @VisibleForTesting
    void setIsExternalDrag(boolean value) {
        mIsExternalDrag = value;
    }

    public boolean getIsEditingName() {
        return mIsEditingName;
    }

    @VisibleForTesting
    void setIsEditingName(boolean value) {
        mIsEditingName = value;
    }

    @VisibleForTesting
    void setFolderName(FolderNameEditText value) {
        mFolderName = value;
    }

    @VisibleForTesting
    FolderNameEditText getFolderName() {
        return mFolderName;
    }

    @VisibleForTesting
    boolean getIsOpen() {
        return mIsOpen;
    }

    @VisibleForTesting
    void setIsOpen(boolean value) {
        mIsOpen = value;
    }

    @VisibleForTesting
    boolean getRearrangeOnClose() {
        return mRearrangeOnClose;
    }

    @VisibleForTesting
    void setRearrangeOnClose(boolean value) {
        mRearrangeOnClose = value;
    }

    /** Returns the height of the current folder's bottom edge from the bottom of the screen. */
    private int getHeightFromBottom() {
        BaseDragLayer.LayoutParams layoutParams = (BaseDragLayer.LayoutParams) getLayoutParams();
@@ -1695,10 +1832,15 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    }

    @VisibleForTesting
    public boolean getDeleteFolderOnDropCompleted() {
    boolean getDeleteFolderOnDropCompleted() {
        return mDeleteFolderOnDropCompleted;
    }

    @VisibleForTesting
    void setDeleteFolderOnDropCompleted(boolean value) {
        mDeleteFolderOnDropCompleted = value;
    }

    /**
     * Save this listener for the special case of when we update the state and concurrently
     * add another listener to {@link #mOnFolderStateChangedListeners} to avoid a
@@ -1708,7 +1850,13 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        mPriorityOnFolderStateChangedListener = listener;
    }

    private void setState(@FolderState int newState) {
    @VisibleForTesting
    int getState() {
        return mState;
    }

    @VisibleForTesting
    void setState(@FolderState int newState) {
        mState = newState;
        if (mPriorityOnFolderStateChangedListener != null) {
            mPriorityOnFolderStateChangedListener.onFolderStateChanged(mState);
@@ -1720,6 +1868,60 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
        }
    }

    @VisibleForTesting
    Alarm getOnExitAlarm() {
        return mOnExitAlarm;
    }

    @VisibleForTesting
    void setOnExitAlarm(Alarm value) {
        mOnExitAlarm = value;
    }

    @VisibleForTesting
    Alarm getReorderAlarm() {
        return mReorderAlarm;
    }

    @VisibleForTesting
    void setReorderAlarm(Alarm value) {
        mReorderAlarm = value;
    }

    @VisibleForTesting
    Alarm getOnScrollHintAlarm() {
        return mOnScrollHintAlarm;
    }

    @VisibleForTesting
    void setOnScrollHintAlarm(Alarm value) {
        mOnScrollHintAlarm = value;
    }

    @VisibleForTesting
    Alarm getScrollPauseAlarm() {
        return mScrollPauseAlarm;
    }

    @VisibleForTesting
    void setScrollPauseAlarm(Alarm value) {
        mScrollPauseAlarm = value;
    }

    @VisibleForTesting
    int getScrollHintDir() {
        return mScrollHintDir;
    }

    @VisibleForTesting
    void setScrollHintDir(int value) {
        mScrollHintDir = value;
    }

    @VisibleForTesting
    int getScrollAreaOffset() {
        return mScrollAreaOffset;
    }
    /**
     * Adds the provided listener to the running list of Folder listeners
     * {@link #mOnFolderStateChangedListeners}
+3 −3
Original line number Diff line number Diff line
@@ -255,8 +255,8 @@ public class FolderAnimationManager {
                mFolder.getContent(), contentStart, contentEnd, finalRadius, !mIsOpening));

        // Fade in the folder name, as the text can overlap the icons when grid size is small.
        mFolder.mFolderName.setAlpha(mIsOpening ? 0f : 1f);
        play(a, getAnimator(mFolder.mFolderName, View.ALPHA, 0, 1),
        mFolder.getFolderName().setAlpha(mIsOpening ? 0f : 1f);
        play(a, getAnimator(mFolder.getFolderName(), View.ALPHA, 0, 1),
                mIsOpening ? FOLDER_NAME_ALPHA_DURATION : 0,
                mIsOpening ? mDuration - FOLDER_NAME_ALPHA_DURATION : FOLDER_NAME_ALPHA_DURATION);

@@ -317,7 +317,7 @@ public class FolderAnimationManager {
                mFolder.mFooter.setScaleX(1f);
                mFolder.mFooter.setScaleY(1f);
                mFolder.mFooter.setTranslationX(0f);
                mFolder.mFolderName.setAlpha(1f);
                mFolder.getFolderName().setAlpha(1f);

                mFolder.setClipChildren(mFolderClipChildren);
                mFolder.setClipToPadding(mFolderClipToPadding);
+1 −1
Original line number Diff line number Diff line
@@ -458,7 +458,7 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel

        mInfo.setTitle(newTitle, mFolder.mLauncherDelegate.getModelWriter());
        onTitleChanged(mInfo.title);
        mFolder.mFolderName.setText(mInfo.title);
        mFolder.getFolderName().setText(mInfo.title);

        // Logging for folder creation flow
        StatsLogManager.newInstance(getContext()).logger()
+2 −2
Original line number Diff line number Diff line
@@ -361,8 +361,8 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> implements Cli
        // Update footer
        mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE);
        // Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text.
        mFolder.mFolderName.setGravity(getPageCount() > 1 ?
                (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL);
        mFolder.getFolderName().setGravity(getPageCount() > 1
                ? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL);
    }

    public int getDesiredWidth() {
Loading