Example usage for android.text InputType TYPE_CLASS_TEXT

List of usage examples for android.text InputType TYPE_CLASS_TEXT

Introduction

In this page you can find the example usage for android.text InputType TYPE_CLASS_TEXT.

Prototype

int TYPE_CLASS_TEXT

To view the source code for android.text InputType TYPE_CLASS_TEXT.

Click Source Link

Document

Class for normal text.

Usage

From source file:Main.java

public static void hidePassword(EditText editText) {
    editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    setSeletionEnd(editText);
}

From source file:Main.java

public static void setPassword(EditText et) {
    if (et != null) {
        et.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    }
}

From source file:Main.java

@SuppressLint("InlinedApi")
public static boolean isPasswordField(int inputType) {
    int inputClass = inputType & InputType.TYPE_MASK_CLASS;
    int inputVariation = inputType & InputType.TYPE_MASK_VARIATION;
    return inputClass == InputType.TYPE_CLASS_TEXT
            && (inputVariation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
                    || inputVariation == InputType.TYPE_TEXT_VARIATION_PASSWORD
                    || inputVariation == InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD);
}

From source file:Main.java

/**
 * Adds input filters to supplied edit text to allow only:
 *  A-Z, a-z, 0-9, and special characters (%$!@)
 * @param viewToFilter/*  w w w. java2 s  . c o  m*/
 * @return
 */
public static EditText setNameInputFilters(EditText viewToFilter) {
    viewToFilter.setInputType(InputType.TYPE_CLASS_TEXT);
    viewToFilter.setFilters(new InputFilter[] { new InputFilter.LengthFilter(20) });
    return viewToFilter;
}

From source file:Main.java

private static boolean isWebEditTextInputType(int inputType) {
    return inputType == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT);
}

From source file:Main.java

public static void uppercaseEditText(final EditText editText) {
    editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS
            | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    editText.addTextChangedListener(new TextWatcher() {

        @Override/*from  w  w w  . j av a2s .  co  m*/
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void afterTextChanged(Editable arg0) {
            String s = arg0.toString();
            if (!s.equals(s.toUpperCase().trim())) {
                s = s.toUpperCase().trim();
                editText.setText(s);
                editText.setSelection(s.length());
            }
        }
    });
}

From source file:Main.java

public static NumberKeyListener getCurrencyNumberKeyListener() {
    if (_currencyNumberKeyListener == null) {
        _currencyNumberKeyListener = new NumberKeyListener() {

            @Override//from  www .  ja va2  s .com
            public int getInputType() {
                return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
            }

            @Override
            protected char[] getAcceptedChars() {
                return new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ',' };
            }
        };
    }

    return _currencyNumberKeyListener;
}

From source file:org.mitre.svmp.auth.module.PasswordModule.java

public View generateUI(Context context) {
    // create the password input
    EditText input = new EditText(context);
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    input.setHint("Password");
    return input;
}

From source file:de.fahrgemeinschaft.util.EditTextImageButton.java

public EditTextImageButton(Context context, AttributeSet attrs) {
    super(context, attrs);
    text = (AutoCompletePicker) findViewById(R.id.text);
    text.setThreshold(1);/*from   w w  w  .j a v  a  2s  .co  m*/
    text.setId(ID--);
    text.setHint(getContext().getString(attrs.getAttributeResourceValue(droid, HINT, R.string.app_name)));
    text.setInputType((attrs.getAttributeIntValue(droid, INPUT_TYPE, InputType.TYPE_CLASS_TEXT)));
    text.addTextChangedListener(this);
    Util.fixStreifenhoernchen(text);
    text.setSelectAllOnFocus(true);
    icon.setOnClickListener(this);
}

From source file:org.mitre.svmp.auth.module.PasswordChangeModule.java

public View generateUI(Context context) {
    // create the password change inputs
    input1 = new EditText(context);
    input1.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    input1.setHint("New password");
    input2 = new EditText(context);
    input2.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    input2.setHint("Confirm new password");

    LinearLayout view = new LinearLayout(context);
    view.setOrientation(LinearLayout.VERTICAL);
    view.addView(input1);//from   w  w  w.  j  ava  2  s .  c o  m
    view.addView(input2);

    return view;
}