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
diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java
index 8ff030e..8eab3e3 100644
--- a/src/com/android/launcher3/ExtendedEditText.java
+++ b/src/com/android/launcher3/ExtendedEditText.java
@@ -90,14 +90,23 @@
/**
* 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() {