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

Commit a3b88549 authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Refine way to trigger the keyboard for a controlled insets animation." into main

parents cd016b5a 6ab61069
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -90,14 +90,23 @@ public class ExtendedEditText extends EditText {
    /**
     * Synchronously shows the soft input method.
     *
     * @param shouldFocus whether this EditText should also request focus.
     * @return true if the keyboard is shown correctly and focus is given to this view (if
     *     applicable).
     * @return true if the keyboard is shown correctly and focus is given to this view.
     */
    public boolean showKeyboard(boolean shouldFocus) {
    public boolean showKeyboard() {
        onKeyboardShown();
        boolean focusResult = !shouldFocus || requestFocus();
        return focusResult && showSoftInputInternal();
        return requestFocus() && showSoftInputInternal();
    }

    /**
     * Requests the framework to show the keyboard in order to ensure that an already registered
     * controlled keyboard animation is triggered correctly.
     * Must NEVER be called in any other case than to trigger a pre-registered controlled animation.
     */
    public void requestShowKeyboardForControlledAnimation() {
        // We don't log the keyboard state, as that must happen only after the controlled animation
        // has completed.
        // We also must not request focus, as this triggers unwanted side effects.
        showSoftInputInternal();
    }

    public void hideKeyboard() {
+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ public class AllAppsSearchBarController
     * Focuses the search field to handle key events.
     */
    public void focusSearchField() {
        mInput.showKeyboard(true /* shouldFocus */);
        mInput.showKeyboard();
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -536,7 +536,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
                    mFolderName.selectAll();
                }
            }
            mFolderName.showKeyboard(true /* shouldFocus */);
            mFolderName.showKeyboard();
            mFolderName.displayCompletions(
                    Stream.of(mInfo.suggestedFolderNames.getLabels())
                            .filter(Objects::nonNull)