类android.text.method.TextKeyListener.Capitalize源码实例Demo

下面列出了怎么用android.text.method.TextKeyListener.Capitalize的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: android_9.0.0_r45   文件: BaseKeyListener.java
static int makeTextContentType(Capitalize caps, boolean autoText) {
    int contentType = InputType.TYPE_CLASS_TEXT;
    switch (caps) {
        case CHARACTERS:
            contentType |= InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS;
            break;
        case WORDS:
            contentType |= InputType.TYPE_TEXT_FLAG_CAP_WORDS;
            break;
        case SENTENCES:
            contentType |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
            break;
    }
    if (autoText) {
        contentType |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
    }
    return contentType;
}
 
源代码2 项目: android_9.0.0_r45   文件: QwertyKeyListener.java
/**
 * Returns a new or existing instance with the specified capitalization
 * and correction properties.
 */
public static QwertyKeyListener getInstance(boolean autoText, Capitalize cap) {
    int off = cap.ordinal() * 2 + (autoText ? 1 : 0);

    if (sInstance[off] == null) {
        sInstance[off] = new QwertyKeyListener(cap, autoText);
    }

    return sInstance[off];
}
 
源代码3 项目: android_9.0.0_r45   文件: QwertyKeyListener.java
/**
 * Gets an instance of the listener suitable for use with full keyboards.
 * Disables auto-capitalization, auto-text and long-press initiated on-screen
 * character pickers.
 */
public static QwertyKeyListener getInstanceForFullKeyboard() {
    if (sFullKeyboardInstance == null) {
        sFullKeyboardInstance = new QwertyKeyListener(Capitalize.NONE, false, true);
    }
    return sFullKeyboardInstance;
}
 
源代码4 项目: android_9.0.0_r45   文件: MultiTapKeyListener.java
/**
 * Returns a new or existing instance with the specified capitalization
 * and correction properties.
 */
public static MultiTapKeyListener getInstance(boolean autotext,
                                              Capitalize cap) {
    int off = cap.ordinal() * 2 + (autotext ? 1 : 0);

    if (sInstance[off] == null) {
        sInstance[off] = new MultiTapKeyListener(cap, autotext);
    }

    return sInstance[off];
}
 
源代码5 项目: android_9.0.0_r45   文件: QwertyKeyListener.java
private QwertyKeyListener(Capitalize cap, boolean autoText, boolean fullKeyboard) {
    mAutoCap = cap;
    mAutoText = autoText;
    mFullKeyboard = fullKeyboard;
}
 
源代码6 项目: android_9.0.0_r45   文件: QwertyKeyListener.java
public QwertyKeyListener(Capitalize cap, boolean autoText) {
    this(cap, autoText, false);
}
 
源代码7 项目: android_9.0.0_r45   文件: MultiTapKeyListener.java
public MultiTapKeyListener(Capitalize cap,
                           boolean autotext) {
    mCapitalize = cap;
    mAutoText = autotext;
}
 
源代码8 项目: commcare-android   文件: StringWidget.java
public StringWidget(Context context, FormEntryPrompt prompt, boolean secret, boolean inCompactGroup) {
    super(context, prompt, inCompactGroup);
    mAnswer = (EditText)LayoutInflater.from(getContext()).inflate(getAnswerLayout(), this, false);
    mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontSize);
    mAnswer.setOnClickListener(this);

    mAnswer.addTextChangedListener(this);

    //Let's see if we can figure out a constraint for this string
    try {
        addAnswerFilter(new InputFilter.LengthFilter(guessMaxStringLength(prompt)));
    } catch (UnpivotableExpressionException e) {
        //expected if there isn't a constraint that does this
    }

    this.secret = secret;

    if (!secret) {
        // capitalize the first letter of the sentence
        mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false));
    }
    setTextInputType(mAnswer);

    if (!secret) {
        mAnswer.setSingleLine(false);
    }

    if (prompt != null) {
        mReadOnly = prompt.isReadOnly();
        IAnswerData value = prompt.getAnswerValue();
        if (value != null) {
            mAnswer.setText(value.getDisplayText());
        }

        if (mReadOnly) {
            if (value == null) {
                mAnswer.setText("---");
            }
            mAnswer.setBackgroundDrawable(null);
            mAnswer.setFocusable(false);
            mAnswer.setClickable(false);
        }
    }

    if (isInCompactMode()) {
        addToCompactLayout(mAnswer);
    } else {
        addView(mAnswer);
    }
}
 
源代码9 项目: BluetoothHidEmu   文件: KeyboardKeyListener.java
public KeyboardKeyListener(SocketManager socketManager) {
    super();
    
    mTextKeyListener = new TextKeyListener(Capitalize.NONE, false);
    mSocketManager = socketManager;
    
}
 
 类所在包
 类方法
 同包方法