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

Commit 0465b4d7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Show IME suggestions while tapping on Folder EditText" into ub-launcher3-master

parents bc2424d7 9c05d2db
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -324,14 +324,12 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
    public void startEditingFolderName() {
        post(() -> {
            if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
                if (isEmpty(mFolderName.getText())) {
                ofNullable(mInfo)
                        .map(info -> info.suggestedFolderNames)
                        .map(folderNames -> (FolderNameInfo[]) folderNames
                                .getParcelableArrayExtra(FolderInfo.EXTRA_FOLDER_SUGGESTIONS))
                        .ifPresent(nameInfos -> showLabelSuggestion(nameInfos, false));
            }
            }
            mFolderName.setHint("");
            mIsEditingName = true;
        });
@@ -485,19 +483,24 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
                nameInfos[1].getLabel());

        if (shouldOpen) {
            // update the primary suggestion if the folder name is empty.
            if (isEmpty(mFolderName.getText())) {
                CharSequence firstLabel = nameInfos[0] == null ? "" : nameInfos[0].getLabel();
                if (!isEmpty(firstLabel)) {
                    mFolderName.setHint("");
                    mFolderName.setText(firstLabel);
                }
            }
            if (animate) {
                animateOpen(mInfo.contents, 0, true);
            }
            mFolderName.showKeyboard();
            mFolderName.displayCompletions(
                    asList(nameInfos).subList(1, nameInfos.length).stream()
                    asList(nameInfos).subList(0, nameInfos.length).stream()
                            .filter(Objects::nonNull)
                            .map(s -> s.getLabel().toString())
                            .filter(s -> !s.isEmpty())
                            .filter(s -> !s.equalsIgnoreCase(mFolderName.getText().toString()))
                            .collect(Collectors.toList()));
        }
    }