Ejemplo n.º 1
0
 @CalledByNative
 private void focusedNodeChanged(boolean isEditable) {
   Log.d(TAG, "focusedNodeChanged: isEditable [%b]", isEditable);
   if (mTextInputType != TextInputType.NONE && mInputConnection != null && isEditable) {
     restartInput();
   }
 }
Ejemplo n.º 2
0
 /** Call this when keyboard configuration has changed. */
 public void onKeyboardConfigurationChanged() {
   Log.d(TAG, "onKeyboardConfigurationChanged: mTextInputType [%d]", mTextInputType);
   if (mTextInputType != TextInputType.NONE) {
     restartInput();
     // By default, we show soft keyboard on keyboard changes. This is useful
     // when the user switches from hardware keyboard to software keyboard.
     // TODO(changwan): check if we can skip this for hardware keyboard configurations.
     showSoftKeyboard();
   }
 }
Ejemplo n.º 3
0
 /** Hide soft keyboard. */
 private void hideKeyboard() {
   Log.d(TAG, "hideKeyboard");
   View view = mViewEmbedder.getAttachedView();
   if (mInputMethodManagerWrapper.isActive(view)) {
     // NOTE: we should not set ResultReceiver here. Otherwise, IMM will own ContentViewCore
     // and ImeAdapter even after input method goes away and result gets received.
     mInputMethodManagerWrapper.hideSoftInputFromWindow(view.getWindowToken(), 0, null);
   }
   // Detach input connection by returning null from onCreateInputConnection().
   if (mTextInputType == TextInputType.NONE && mInputConnection != null) {
     restartInput();
   }
 }
Ejemplo n.º 4
0
  /**
   * Shows or hides the keyboard based on passed parameters.
   *
   * @param textInputType Text input type for the currently focused field in renderer.
   * @param textInputFlags Text input flags.
   * @param showIfNeeded Whether the keyboard should be shown if it is currently hidden.
   */
  public void updateKeyboardVisibility(
      int textInputType, int textInputFlags, boolean showIfNeeded) {
    Log.d(
        TAG,
        "updateKeyboardVisibility: type [%d->%d], flags [%d], show [%b], ",
        mTextInputType,
        textInputType,
        textInputFlags,
        showIfNeeded);
    mTextInputFlags = textInputFlags;
    if (mTextInputType != textInputType) {
      mTextInputType = textInputType;
      // No need to restart if we are going to hide anyways.
      if (textInputType != TextInputType.NONE) restartInput();
    }

    // There is no API for us to get notified of user's dismissal of keyboard.
    // Therefore, we should try to show keyboard even when text input type hasn't changed.
    if (textInputType != TextInputType.NONE) {
      if (showIfNeeded) showSoftKeyboard();
    } else {
      hideKeyboard();
    }
  }
Ejemplo n.º 5
0
 @CalledByNative
 private void cancelComposition() {
   Log.d(TAG, "cancelComposition");
   if (mInputConnection != null) restartInput();
 }