List of usage examples for android.text InputType TYPE_CLASS_NUMBER
int TYPE_CLASS_NUMBER
To view the source code for android.text InputType TYPE_CLASS_NUMBER.
Click Source Link
From source file:Main.java
/** Returns true if number keyboard is preferred by EditorInfo.inputType. */ public static boolean isNumberKeyboardPreferred(int inputType) { int typeClass = inputType & InputType.TYPE_MASK_CLASS; // As of API Level 21, following condition equals to "typeClass != InputType.TYPE_CLASS_TEXT". // However type-class might be added in future so safer expression is employed here. return typeClass == InputType.TYPE_CLASS_DATETIME || typeClass == InputType.TYPE_CLASS_NUMBER || typeClass == InputType.TYPE_CLASS_PHONE; }
From source file:Main.java
public static List<String> mapTextViewInputTypes(int inputType) { List<String> inputTypes = new ArrayList<String>(); if (inputTypeHasTrait(inputType, InputType.TYPE_TEXT_VARIATION_PASSWORD) || inputTypeHasTrait(inputType, InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD)) { inputTypes.add("password"); }//w w w. j a v a 2s . c o m if (inputTypeHasTrait(inputType, InputType.TYPE_CLASS_NUMBER)) { inputTypes.add("numeric"); } inputTypes.add(String.valueOf(inputType)); return inputTypes; }
From source file:org.mitre.svmp.auth.module.SecurityTokenModule.java
public View generateUI(Context context) { // create the token input EditText input = new EditText(context); input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD); input.setHint("Security Token"); return input; }
From source file:com.checktipsplitter.wizard.model.FreeTextPage.java
@Override public boolean isCompleted() { if (inputType == (InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL) || inputType == InputType.TYPE_CLASS_NUMBER) { return !TextUtils.isEmpty(mData.getString(DATA_KEY)) && Float.valueOf(mData.getString(DATA_KEY)) > 0; }/*from ww w .java 2 s .c o m*/ return !TextUtils.isEmpty( mData.getString(DATA_KEY) != null ? mData.getString(DATA_KEY).trim() : mData.getString(DATA_KEY)); }
From source file:org.deviceconnect.android.deviceplugin.hitoe.fragment.dialog.PinCodeDialogFragment.java
@NonNull @Override// w w w .j ava 2 s. c o m public Dialog onCreateDialog(final Bundle savedInstanceState) { if (mDialog != null) { return mDialog; } LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = inflater.inflate(R.layout.dialog_hitoe_pin, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.dialog_title_pin_input)); final EditText pinEdit = (EditText) layout.findViewById(R.id.input_pin); pinEdit.setInputType(InputType.TYPE_CLASS_NUMBER); builder.setView(layout); builder.setPositiveButton(R.string.hitoe_setting_dialog_positive, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialogInterface, final int i) { String pinString = pinEdit.getText().toString(); if (mListener != null) { mListener.onPinCode(pinString); } } }); builder.setNegativeButton("Cancel", null); mDialog = builder.create(); return mDialog; }
From source file:com.softminds.matrixcalculator.dialog_activity.CustomValueFiller.java
@Override protected void onCreate(Bundle savedInstanceState) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); boolean isDark = preferences.getBoolean("DARK_THEME_KEY", false); if (isDark)//from w w w . j a va 2s. c o m setTheme(R.style.AppThemeDarkDialog); else setTheme(R.style.AppThemeDialog); super.onCreate(savedInstanceState); setContentView(R.layout.custom_filler_value); final EditText editText = findViewById(R.id.CustomValue); if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DECIMAL_USE", true)) { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL); } else { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); } if (isDark) editText.setTextColor(ContextCompat.getColor(this, R.color.white)); Button button = findViewById(R.id.ConfirmCustomFill); Button exit = findViewById(R.id.CancelCustomFill); button.setAllCaps(true); exit.setAllCaps(true); button.setHeight(50); exit.setHeight(50); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (editText.getText().toString().isEmpty()) Toast.makeText(getApplication(), R.string.NoValue, Toast.LENGTH_SHORT).show(); else { Intent intent = new Intent(); intent.putExtra(Key, Float.parseFloat(editText.getText().toString())); setResult(2, intent); finish(); } } }); exit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); }
From source file:com.liato.bankdroid.banking.banks.BlekingeTrafiken.java
public BlekingeTrafiken(Context context) { super(context); super.TAG = TAG; super.NAME = NAME; super.NAME_SHORT = NAME_SHORT; super.BANKTYPE_ID = BANKTYPE_ID; super.URL = URL; super.INPUT_TYPE_USERNAME = InputType.TYPE_CLASS_NUMBER; super.INPUT_HINT_USERNAME = "XXXXXXXXXX"; super.INPUT_TITLETEXT_USERNAME = R.string.card_number; super.INPUT_HIDDEN_PASSWORD = true; }
From source file:com.ws.wsme.openapi.WBInviteAPIActivity.java
/** * @see {@link Activity#onCreate}//from ww w . j a va2s. c om */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.ws.wsme.R.layout.activity_open_api_invite); mEditText = (EditText) findViewById(com.ws.wsme.R.id.friend_uid); mEditText.setInputType(InputType.TYPE_CLASS_NUMBER); mEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { mInviteButton.setEnabled(!(0 == count)); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); // mInviteButton = (Button) findViewById(com.ws.wsme.R.id.invite_button); mInviteButton.setEnabled(false); mInviteButton.setOnClickListener(this); }
From source file:com.savvywits.wethepeople.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mReceiver = new RESTReceiver(new Handler()); mReceiver.setReceiver(this); mData = (EditText) findViewById(R.id.zipcode); // This makes a nice ten-key pad mData.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_CLASS_NUMBER); Button submitButton = (Button) findViewById(R.id.submit); submitButton.setOnClickListener(this); }
From source file:cn.com.jinyinmao.app.openapi.WBInviteAPIActivity.java
/** * @see {@link Activity#onCreate}// w ww . j a va 2s . com */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_open_api_invite); mEditText = (EditText) findViewById(R.id.friend_uid); mEditText.setInputType(InputType.TYPE_CLASS_NUMBER); mEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { mInviteButton.setEnabled(!(0 == count)); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); // mInviteButton = (Button) findViewById(R.id.invite_button); mInviteButton.setEnabled(false); mInviteButton.setOnClickListener(this); }