Don't open the Folder and IME when Folder is created.
Bug: 153751859
Change-Id: I8169d0890a43b614b293ca29f504e19c532b90ee
(cherry picked from commit 09066ffeb2)
This commit is contained in:
committed by
Hyunyoung Song
parent
a359556bff
commit
86932724e7
@@ -331,7 +331,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
.map(info -> info.suggestedFolderNames)
|
||||
.map(folderNames -> (FolderNameInfo[]) folderNames
|
||||
.getParcelableArrayExtra(FolderInfo.EXTRA_FOLDER_SUGGESTIONS))
|
||||
.ifPresent(nameInfos -> showLabelSuggestion(nameInfos, false));
|
||||
.ifPresent(nameInfos -> showLabelSuggestions(nameInfos));
|
||||
}
|
||||
mFolderName.setHint("");
|
||||
mIsEditingName = true;
|
||||
@@ -457,24 +457,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show suggested folder title in FolderEditText, push InputMethodManager suggestions and save
|
||||
* the suggestedFolderNames.
|
||||
*/
|
||||
public void showSuggestedTitle(FolderNameInfo[] nameInfos) {
|
||||
if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
|
||||
if (isEmpty(mFolderName.getText().toString())
|
||||
&& !mInfo.hasOption(FLAG_MANUAL_FOLDER_NAME)) {
|
||||
showLabelSuggestion(nameInfos, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show suggested folder title in FolderEditText if the first suggestion is non-empty, push
|
||||
* InputMethodManager suggestions.
|
||||
* rest of the suggestions to InputMethodManager.
|
||||
*/
|
||||
private void showLabelSuggestion(FolderNameInfo[] nameInfos, boolean animate) {
|
||||
private void showLabelSuggestions(FolderNameInfo[] nameInfos) {
|
||||
if (nameInfos == null) {
|
||||
return;
|
||||
}
|
||||
@@ -494,9 +482,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
|
||||
mFolderName.setText(firstLabel);
|
||||
}
|
||||
}
|
||||
if (animate) {
|
||||
animateOpen(mInfo.contents, 0, true);
|
||||
}
|
||||
mFolderName.showKeyboard();
|
||||
mFolderName.displayCompletions(
|
||||
asList(nameInfos).subList(0, nameInfos.length).stream()
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.launcher3.folder;
|
||||
|
||||
import static android.text.TextUtils.isEmpty;
|
||||
|
||||
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
|
||||
import static com.android.launcher3.folder.PreviewItemManager.INITIAL_ITEM_ANIMATION_DURATION;
|
||||
|
||||
@@ -418,11 +420,33 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel
|
||||
postDelayed(() -> {
|
||||
mPreviewItemManager.hidePreviewItem(finalIndex, false);
|
||||
mFolder.showItem(item);
|
||||
setLabelSuggestion(nameInfos);
|
||||
invalidate();
|
||||
mFolder.showSuggestedTitle(nameInfos);
|
||||
}, DROP_IN_ANIMATION_DURATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the suggested folder name.
|
||||
*/
|
||||
public void setLabelSuggestion(FolderNameInfo[] nameInfos) {
|
||||
if (!FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
|
||||
return;
|
||||
}
|
||||
if (!isEmpty(mFolderName.getText().toString())
|
||||
|| mInfo.hasOption(FolderInfo.FLAG_MANUAL_FOLDER_NAME)) {
|
||||
return;
|
||||
}
|
||||
if (nameInfos == null || nameInfos[0] == null || isEmpty(nameInfos[0].getLabel())) {
|
||||
return;
|
||||
}
|
||||
mInfo.title = nameInfos[0].getLabel();
|
||||
onTitleChanged(mInfo.title);
|
||||
mFolder.mFolderName.setText(mInfo.title);
|
||||
mFolder.mLauncher.getModelWriter().updateItemInDatabase(mInfo);
|
||||
// TODO: Add logging while folder creation.
|
||||
}
|
||||
|
||||
|
||||
public void onDrop(DragObject d, boolean itemReturnedOnFailedDrop) {
|
||||
WorkspaceItemInfo item;
|
||||
if (d.dragInfo instanceof AppInfo) {
|
||||
|
||||
Reference in New Issue
Block a user