Fix bug where folder with 1 icon can exist
Fix: 329357132 Flag: NONE Test: TaplDragTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5645c3ec558e2b0b6d6ae1c51dbaf93803cd51cf) Merged-In: If381ff56e051c89e9f6162f8a44f8df9e2ae5060 Change-Id: If381ff56e051c89e9f6162f8a44f8df9e2ae5060
This commit is contained in:
committed by
Android Build Coastguard Worker
parent
c4abd5c6c9
commit
d44f2ec5df
@@ -1039,6 +1039,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
public void onDropCompleted(final View target, final DragObject d,
|
||||
final boolean success) {
|
||||
if (success) {
|
||||
if (getItemCount() <= 1) {
|
||||
mDeleteFolderOnDropCompleted = true;
|
||||
}
|
||||
if (mDeleteFolderOnDropCompleted && !mItemAddedBackToSelfViaIcon && target != this) {
|
||||
replaceFolderWithFinalItem();
|
||||
}
|
||||
|
||||
@@ -96,6 +96,21 @@ public class TaplDragTest extends AbstractLauncherUiTest {
|
||||
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.
|
||||
* 1. Open all apps and wait for load complete.
|
||||
|
||||
Reference in New Issue
Block a user