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

Commit 74fd4908 authored by Federico Baron's avatar Federico Baron Committed by Android (Google) Code Review
Browse files

Merge "Fix bug where folder with 1 icon can exist" into 24D1-dev

parents 2edebc10 b41c826c
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1039,6 +1039,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    public void onDropCompleted(final View target, final DragObject d,
    public void onDropCompleted(final View target, final DragObject d,
            final boolean success) {
            final boolean success) {
        if (success) {
        if (success) {
            if (getItemCount() <= 1) {
                mDeleteFolderOnDropCompleted = true;
            }
            if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
            if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
                replaceFolderWithFinalItem();
                replaceFolderWithFinalItem();
            }
            }
+15 −0
Original line number Original line Diff line number Diff line
@@ -96,6 +96,21 @@ public class TaplDragTest extends AbstractLauncherUiTest {
                MAPS_APP_NAME);
                MAPS_APP_NAME);
    }
    }


    /**
     * Adds two icons to the Workspace and combines them into a folder, then makes sure we are able
     * to remove an icon from the folder and that the folder ceases to exist since it only has one
     * icon left.
     */
    @Test
    public void testDragOutOfFolder() {
        final HomeAppIcon playStoreIcon = createShortcutIfNotExist(STORE_APP_NAME, 0, 1);
        final HomeAppIcon photosIcon = createShortcutInCenterIfNotExist(PHOTOS_APP_NAME);
        FolderIcon folderIcon = photosIcon.dragToIcon(playStoreIcon);
        Folder folder = folderIcon.open();
        folder.getAppIcon(STORE_APP_NAME).internalDragToWorkspace(false, false);
        assertNotNull(mLauncher.getWorkspace().tryGetWorkspaceAppIcon(STORE_APP_NAME));
        assertNotNull(mLauncher.getWorkspace().tryGetWorkspaceAppIcon(PHOTOS_APP_NAME));
    }


    /** Drags a shortcut from a long press menu into the workspace.
    /** Drags a shortcut from a long press menu into the workspace.
     * 1. Open all apps and wait for load complete.
     * 1. Open all apps and wait for load complete.