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

Commit 6ab61069 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Refine way to trigger the keyboard for a controlled insets animation.

Before we did it as normal just without requesting focus. However, we
also need to not log the new state, as this must happen only after the
controlled animation has completed (or been cancelled).

Bug: 309756056
Flag: NA
Test: manual
Change-Id: I7f1564d2b29d91c9fdb0afce586fe5cc1148bac0
parent a20e964c
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)