android.view.inputmethod.InputMethodManager#restartInput ( )源码实例Demo

下面列出了android.view.inputmethod.InputMethodManager#restartInput ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Emoji   文件: EmojiPopup.java
private void showAtBottomPending() {
  isPendingOpen = true;
  final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

  if (Utils.shouldOverrideRegularCondition(context, editText)) {
    editText.setImeOptions(editText.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    if (inputMethodManager != null) {
      inputMethodManager.restartInput(editText);
    }
  }

  if (inputMethodManager != null) {
    emojiResultReceiver.setReceiver(this);
    inputMethodManager.showSoftInput(editText, InputMethodManager.RESULT_UNCHANGED_SHOWN, emojiResultReceiver);
  }
}
 
源代码2 项目: Emoji   文件: EmojiPopup.java
public void dismiss() {
  popupWindow.dismiss();
  variantPopup.dismiss();
  recentEmoji.persist();
  variantEmoji.persist();

  emojiResultReceiver.setReceiver(null);

  if (originalImeOptions != -1) {
    editText.setImeOptions(originalImeOptions);
    final InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);

    if (inputMethodManager != null) {
      inputMethodManager.restartInput(editText);
    }

    if (SDK_INT >= O) {
      final AutofillManager autofillManager = context.getSystemService(AutofillManager.class);
      if (autofillManager != null) {
        autofillManager.cancel();
      }
    }
  }
}
 
源代码3 项目: CodeEditor   文件: FreeScrollingTextField.java
public void stopTextComposing() {
    InputMethodManager im = (InputMethodManager) getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    // This is an overkill way to inform the InputMethod that the caret
    // might have changed position and it should re-evaluate the
    // caps mode to use.
    im.restartInput(FreeScrollingTextField.this);

    if (_inputConnection != null && _inputConnection.isComposingStarted()) {
        _inputConnection.resetComposingState();
    }
}
 
源代码4 项目: CodeEditor   文件: FreeScrollingTextField.java
public void stopTextComposing() {
    InputMethodManager im = (InputMethodManager) getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    // This is an overkill way to inform the InputMethod that the caret
    // might have changed position and it should re-evaluate the
    // caps mode to use.
    im.restartInput(FreeScrollingTextField.this);

    if (_inputConnection != null && _inputConnection.isComposingStarted()) {
        _inputConnection.resetComposingState();
    }
}
 
源代码5 项目: android-chromium   文件: ContentViewCore.java
/**
 * @see View#onConfigurationChanged(Configuration)
 */
@SuppressWarnings("javadoc")
public void onConfigurationChanged(Configuration newConfig) {
    TraceEvent.begin();

    if (newConfig.keyboard != Configuration.KEYBOARD_NOKEYS) {
        mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore),
                ImeAdapter.getTextInputTypeNone(),
                AdapterInputConnection.INVALID_SELECTION,
                AdapterInputConnection.INVALID_SELECTION);
        InputMethodManager manager = (InputMethodManager)
                getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        manager.restartInput(mContainerView);
    }
    mContainerViewInternals.super_onConfigurationChanged(newConfig);
    // Make sure the size is up to date in JavaScript's window.onorientationchanged.
    mContainerView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            mContainerView.removeOnLayoutChangeListener(this);
            sendOrientationChangeEvent();
        }
    });
    // To request layout has side effect, but it seems OK as it only happen in
    // onConfigurationChange and layout has to be changed in most case.
    mContainerView.requestLayout();
    TraceEvent.end();
}
 
源代码6 项目: android-chromium   文件: ContentViewCore.java
/**
 * @see View#onConfigurationChanged(Configuration)
 */
@SuppressWarnings("javadoc")
public void onConfigurationChanged(Configuration newConfig) {
    TraceEvent.begin();

    if (newConfig.keyboard != Configuration.KEYBOARD_NOKEYS) {
        mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore),
                ImeAdapter.getTextInputTypeNone(),
                AdapterInputConnection.INVALID_SELECTION,
                AdapterInputConnection.INVALID_SELECTION);
        InputMethodManager manager = (InputMethodManager)
                getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        manager.restartInput(mContainerView);
    }
    mContainerViewInternals.super_onConfigurationChanged(newConfig);
    // Make sure the size is up to date in JavaScript's window.onorientationchanged.
    mContainerView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                int oldLeft, int oldTop, int oldRight, int oldBottom) {
            mContainerView.removeOnLayoutChangeListener(this);
            sendOrientationChangeEvent();
        }
    });
    // To request layout has side effect, but it seems OK as it only happen in
    // onConfigurationChange and layout has to be changed in most case.
    mContainerView.requestLayout();
    TraceEvent.end();
}
 
源代码7 项目: Spyglass   文件: MentionsEditText.java
private void restartInput() {
    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
        imm.restartInput(this);
    }
}