Java Code Examples for android.view.inputmethod.EditorInfo#TYPE_MASK_CLASS

The following examples show how to use android.view.inputmethod.EditorInfo#TYPE_MASK_CLASS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PinView.java    From PinView with Apache License 2.0 5 votes vote down vote up
private static boolean isPasswordInputType(int inputType) {
    final int variation =
            inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);
    return variation
            == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)
            || variation
            == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD)
            || variation
            == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);
}
 
Example 2
Source File: OtpView.java    From android-otpview-pinview with MIT License 5 votes vote down vote up
private static boolean isPasswordInputType(int inputType) {
  final int variation =
      inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION);
  return variation
      == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)
      || variation
      == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD)
      || variation
      == (EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_VARIATION_PASSWORD);
}
 
Example 3
Source File: IMEService.java    From Puff-Android with MIT License 5 votes vote down vote up
@Override
public void onStartInput(EditorInfo attribute, boolean restarting) {
    super.onStartInput(attribute, restarting);
    switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
        default:
            break;
    }
    currentKeyboard.setIMEOptions(getResources(), attribute.imeOptions);
}
 
Example 4
Source File: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
void startExtractingText(boolean inputChanged) {
    final ExtractEditText eet = mExtractEditText;
    if (eet != null && getCurrentInputStarted()
            && isFullscreenMode()) {
        mExtractedToken++;
        ExtractedTextRequest req = new ExtractedTextRequest();
        req.token = mExtractedToken;
        req.flags = InputConnection.GET_TEXT_WITH_STYLES;
        req.hintMaxLines = 10;
        req.hintMaxChars = 10000;
        InputConnection ic = getCurrentInputConnection();
        mExtractedText = ic == null? null
                : ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
        if (mExtractedText == null || ic == null) {
            Log.e(TAG, "Unexpected null in startExtractingText : mExtractedText = "
                    + mExtractedText + ", input connection = " + ic);
        }
        final EditorInfo ei = getCurrentInputEditorInfo();
        
        try {
            eet.startInternalChanges();
            onUpdateExtractingVisibility(ei);
            onUpdateExtractingViews(ei);
            int inputType = ei.inputType;
            if ((inputType&EditorInfo.TYPE_MASK_CLASS)
                    == EditorInfo.TYPE_CLASS_TEXT) {
                if ((inputType&EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0) {
                    inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
                }
            }
            eet.setInputType(inputType);
            eet.setHint(ei.hintText);
            if (mExtractedText != null) {
                eet.setEnabled(true);
                eet.setExtractedText(mExtractedText);
            } else {
                eet.setEnabled(false);
                eet.setText("");
            }
        } finally {
            eet.finishInternalChanges();
        }
        
        if (inputChanged) {
            onExtractingInputChanged(ei);
        }
    }
}