android.text.method.TextKeyListener.Capitalize Java Examples

The following examples show how to use android.text.method.TextKeyListener.Capitalize. 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 Project: android_9.0.0_r45   Author: lulululbj   File: BaseKeyListener.java    License: Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source Project: android_9.0.0_r45   Author: lulululbj   File: QwertyKeyListener.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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];
}
 
Example #3
Source Project: android_9.0.0_r45   Author: lulululbj   File: QwertyKeyListener.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source Project: android_9.0.0_r45   Author: lulululbj   File: MultiTapKeyListener.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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];
}
 
Example #5
Source Project: android_9.0.0_r45   Author: lulululbj   File: QwertyKeyListener.java    License: Apache License 2.0 4 votes vote down vote up
private QwertyKeyListener(Capitalize cap, boolean autoText, boolean fullKeyboard) {
    mAutoCap = cap;
    mAutoText = autoText;
    mFullKeyboard = fullKeyboard;
}
 
Example #6
Source Project: android_9.0.0_r45   Author: lulululbj   File: QwertyKeyListener.java    License: Apache License 2.0 4 votes vote down vote up
public QwertyKeyListener(Capitalize cap, boolean autoText) {
    this(cap, autoText, false);
}
 
Example #7
Source Project: android_9.0.0_r45   Author: lulululbj   File: MultiTapKeyListener.java    License: Apache License 2.0 4 votes vote down vote up
public MultiTapKeyListener(Capitalize cap,
                           boolean autotext) {
    mCapitalize = cap;
    mAutoText = autotext;
}
 
Example #8
Source Project: commcare-android   Author: dimagi   File: StringWidget.java    License: Apache License 2.0 4 votes vote down vote up
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);
    }
}
 
Example #9
Source Project: BluetoothHidEmu   Author: andraus   File: KeyboardKeyListener.java    License: Apache License 2.0 3 votes vote down vote up
public KeyboardKeyListener(SocketManager socketManager) {
    super();
    
    mTextKeyListener = new TextKeyListener(Capitalize.NONE, false);
    mSocketManager = socketManager;
    
}