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:com.mifos.mifosxdroid.LoginActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); ButterKnife.inject(this); et_port.setInputType(InputType.TYPE_CLASS_NUMBER); if (!PrefManager.getPort().equals("80")) et_port.setText(PrefManager.getPort()); et_domain.setText(PrefManager.getInstanceDomain()); bt_connectionSettings.setOnClickListener(new OnClickListener() { @Override/*www . j a v a 2 s .c o m*/ public void onClick(View view) { ll_connectionSettings .setVisibility(ll_connectionSettings.getVisibility() == VISIBLE ? GONE : VISIBLE); } }); et_domain.addTextChangedListener(urlWatcher); et_port.addTextChangedListener(urlWatcher); urlWatcher.afterTextChanged(null); }
From source file:com.jaspersoft.android.jaspermobile.dialog.TextInputControlDialogFragment.java
@NonNull @Override/* www . j a va 2 s .c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final View customLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_ic_value, null); icValue = (EditText) customLayout.findViewById(R.id.icValue); // allow only numbers if data type is numeric if (mInputControl.getType() == InputControl.Type.singleValueNumber) { icValue.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL); } String icName = mInputControl.getState().getValue(); icValue.setText(icName); icValue.setSelection(icName.length()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(customLayout); builder.setTitle(mInputControl.getLabel()); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String newIcValue = TextInputControlDialogFragment.this.icValue.getText().toString(); if (mDialogListener != null) { ((InputControlValueDialogCallback) mDialogListener).onTextValueEntered(mInputControl, newIcValue); } } }); builder.setNegativeButton(R.string.cancel, null); icValueDialog = builder.create(); icValueDialog.setOnShowListener(this); return icValueDialog; }
From source file:net.i2p.android.wizard.ui.SingleTextFieldFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_wizard_page_single_text_field, container, false); ((TextView) rootView.findViewById(android.R.id.title)).setText(mPage.getTitle()); ((TextView) rootView.findViewById(R.id.wizard_text_field_desc)).setText(mPage.getDesc()); mFieldView = ((TextView) rootView.findViewById(R.id.wizard_text_field)); mFieldView.setHint(mPage.getTitle()); if (mPage.getNumeric()) mFieldView.setInputType(InputType.TYPE_CLASS_NUMBER); if (mPage.getData().getString(Page.SIMPLE_DATA_KEY) != null) mFieldView.setText(mPage.getData().getString(Page.SIMPLE_DATA_KEY)); else if (mPage.getDefault() != null) { mFieldView.setText(mPage.getDefault()); mPage.getData().putString(Page.SIMPLE_DATA_KEY, mPage.getDefault()); }/*from ww w .java 2 s . co m*/ mFeedbackView = (TextView) rootView.findViewById(R.id.wizard_text_field_feedback); return rootView; }
From source file:com.hichinaschool.flashcards.preferences.StepsPreference.java
/** * Update settings to show a numeric keyboard instead of the default keyboard. * <p>/*w w w . j a va 2s.c o m*/ * This method should only be called once from the constructor. */ private void updateSettings() { // Use the number pad but still allow normal text for spaces and decimals. getEditText().setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_CLASS_TEXT); }
From source file:eisene.riskspeedtools.TimerSetupFrag.java
public void timerPausePresentation() { EditText secondET = (EditText) findViewById(R.id.et_timer_second); Button startButton = (Button) findViewById(R.id.btn_timer_play_pause); secondET.setEnabled(true);//from w w w .j a v a 2 s . c o m secondET.setInputType(InputType.TYPE_CLASS_NUMBER); startButton.setText(R.string.timer_play); }
From source file:com.softminds.matrixcalculator.base_fragments.EditFragment.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View V = inflater.inflate(R.layout.fragment_edit, container, false); CardView cardView = V.findViewById(R.id.EditMatrixCard); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext()); String string = sharedPreferences.getString("ELEVATE_AMOUNT", "4"); String string2 = sharedPreferences.getString("CARD_CHANGE_KEY", "#bdbdbd"); cardView.setCardElevation(Integer.parseInt(string)); CardView.LayoutParams params1 = new CardView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); //noinspection ConstantConditions int index = getArguments().getInt("INDEX"); //noinspection ConstantConditions MatrixV2 m = ((GlobalValues) getActivity().getApplication()).GetCompleteList().get(index); GridLayout gridLayout = new GridLayout(getContext()); gridLayout.setRowCount(m.getNumberOfRows()); gridLayout.setColumnCount(m.getNumberOfCols()); for (int i = 0; i < m.getNumberOfRows(); i++) { for (int j = 0; j < m.getNumberOfCols(); j++) { EditText editText = new EditText(getContext()); editText.setId(i * 10 + j);/*from w w w.j av a 2 s. co m*/ editText.setBackgroundColor(Color.parseColor(string2)); editText.setGravity(Gravity.CENTER); if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("DECIMAL_USE", true)) { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); } else { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); } editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(getLength()) }); if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("SMART_FIT_KEY", false)) { editText.setWidth(ConvertTopx(62)); editText.setTextSize(SizeReturner(3, 3, PreferenceManager .getDefaultSharedPreferences(getContext()).getBoolean("EXTRA_SMALL_FONT", false))); } else { editText.setWidth(ConvertTopx(CalculatedWidth(m.getNumberOfCols()))); editText.setTextSize(SizeReturner(m.getNumberOfRows(), m.getNumberOfCols(), PreferenceManager .getDefaultSharedPreferences(getContext()).getBoolean("EXTRA_SMALL_FONT", false))); } editText.setText(SafeSubString(GetText(m.getElementOf(i, j)), getLength())); editText.setSingleLine(); GridLayout.Spec Row = GridLayout.spec(i, 1); GridLayout.Spec Col = GridLayout.spec(j, 1); GridLayout.LayoutParams params = new GridLayout.LayoutParams(Row, Col); params.leftMargin = params.topMargin = params.bottomMargin = params.rightMargin = getResources() .getDimensionPixelOffset(R.dimen.border_width); gridLayout.addView(editText, params); } } gridLayout.setLayoutParams(params1); cardView.addView(gridLayout); RootView = V; return V; }
From source file:com.mifos.mifosxdroid.login.LoginActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActivityComponent().inject(this); setContentView(R.layout.activity_login); ButterKnife.bind(this); mLoginPresenter.attachView(this); et_port.setInputType(InputType.TYPE_CLASS_NUMBER); if (!PrefManager.getPort().equals("80")) et_port.setText(PrefManager.getPort()); et_domain.setText(PrefManager.getInstanceDomain()); bt_connectionSettings.setOnClickListener(new OnClickListener() { @Override/*from w w w.j a v a 2s .com*/ public void onClick(View view) { ll_connectionSettings .setVisibility(ll_connectionSettings.getVisibility() == VISIBLE ? GONE : VISIBLE); } }); et_domain.addTextChangedListener(urlWatcher); et_port.addTextChangedListener(urlWatcher); urlWatcher.afterTextChanged(null); }
From source file:net.alexjf.tmm.fragments.MoneyNodeEditorFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_moneynode_editor, container, false); nameText = (EditText) v.findViewById(R.id.name_text); descriptionText = (EditText) v.findViewById(R.id.description_text); iconSelectorButton = (SelectorButton) v.findViewById(R.id.icon_selector); creationDateButton = (Button) v.findViewById(R.id.creationDate_button); initialBalanceText = (EditText) v.findViewById(R.id.initialBalance_text); currencySpinner = (Spinner) v.findViewById(R.id.currency_spinner); addButton = (Button) v.findViewById(R.id.add_button); initialBalanceText.setRawInputType(InputType.TYPE_CLASS_NUMBER); FragmentManager fm = getFragmentManager(); datePicker = (DatePickerFragment) fm.findFragmentByTag(TAG_DATEPICKER); iconPicker = (IconPickerFragment) fm.findFragmentByTag(TAG_DRAWABLEPICKER); if (datePicker == null) { datePicker = new DatePickerFragment(); }// ww w . j a va 2 s . co m if (iconPicker == null) { iconPicker = new IconPickerFragment(); } datePicker.setListener(this); iconPicker.setListener(this); creationDateButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { try { datePicker.setDate(dateFormat.parse(creationDateButton.getText().toString())); } catch (ParseException e) { } datePicker.show(getFragmentManager(), TAG_DATEPICKER); } }); iconSelectorButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { iconPicker.show(getFragmentManager(), TAG_DRAWABLEPICKER); } }); addButton.setOnClickListener(new OnClickListener() { public void onClick(View view) { if (!validateInputFields()) { return; } String name = nameText.getText().toString().trim(); String description = descriptionText.getText().toString().trim(); Date creationDate; try { creationDate = dateFormat.parse(creationDateButton.getText().toString()); } catch (ParseException e) { creationDate = new Date(); } CurrencyUnit currency = CurrencyUnit .getInstance(currencySpinner.getSelectedItem().toString().trim()); Money initialBalance; try { Calculable calc = new ExpressionBuilder(initialBalanceText.getText().toString()).build(); initialBalance = Money.of(currency, calc.calculate(), RoundingMode.HALF_EVEN); } catch (Exception e) { initialBalance = Money.zero(currency); } if (node == null) { MoneyNode newNode = new MoneyNode(name, description, selectedDrawableName, creationDate, initialBalance, currency); listener.onMoneyNodeCreated(newNode); } else { node.setName(name); node.setIcon(selectedDrawableName); node.setDescription(description); node.setCreationDate(creationDate); node.setInitialBalance(initialBalance); node.setCurrency(currency); listener.onMoneyNodeEdited(node); } } }); if (savedInstanceState != null) { selectedDrawableName = savedInstanceState.getString(KEY_SELECTEDICON); int iconId = DrawableResolver.getInstance().getDrawableId(selectedDrawableName); iconSelectorButton.setDrawableId(iconId); } updateNodeFields(); return v; }
From source file:org.dash.wallet.common.ui.CurrencyAmountView.java
@Override protected void onFinishInflate() { super.onFinishInflate(); final Context context = getContext(); textView = (TextView) getChildAt(0); textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); textView.setHintTextColor(lessSignificantColor); textView.setHorizontalFadingEdgeEnabled(true); textView.setSingleLine();/*from w ww . j a v a 2 s . c o m*/ setValidateAmount(textView instanceof EditText); textView.addTextChangedListener(textViewListener); textView.setOnFocusChangeListener(textViewListener); //For layout preview only. if (isInEditMode()) { textView.setText("0.1"); } contextButton = new View(context) { @Override protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) { setMeasuredDimension(textView.getCompoundPaddingRight(), textView.getMeasuredHeight()); } }; final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); chooseViewParams.gravity = Gravity.RIGHT; contextButton.setLayoutParams(chooseViewParams); this.addView(contextButton); updateAppearance(); }
From source file:uk.ac.horizon.artcodes.fragment.ActionEditDialogFragment.java
@NonNull @Override/*from w w w. j ava2 s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) throws NullPointerException { binding = ActionEditBinding.inflate(getActivity().getLayoutInflater()); binding.newMarkerCode.setFilters(new InputFilter[] { new MarkerFormat() }); String currentKeyboard = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD); Log.i("Keyboard", currentKeyboard); if (currentKeyboard.contains("com.lge.ime")) { binding.newMarkerCode.setKeyListener(DigitsKeyListener.getInstance("0123456789:")); binding.newMarkerCode.setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); } binding.newMarkerCode.addTextChangedListener(new SimpleTextWatcher() { @Override public String getText() { return null; } @Override public void onTextChanged(String value) { if (!value.isEmpty()) { binding.newMarkerCode.setText(""); Action action = getAction(); action.getCodes().add(value); ActionCodeBinding codeBinding = createCodeBinding(binding, action, action.getCodes().size() - 1); codeBinding.editMarkerCode.requestFocus(); } } }); binding.scanButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), ScannerActivity.class); intent.putExtra("experience", "{\"name\":\"Scan Code\"}"); startActivityForResult(intent, SCAN_CODE_REQUEST); } }); final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(binding.getRoot()); final Dialog dialog = builder.create(); binding.deleteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getArguments().containsKey("action")) { dialog.dismiss(); final int index = getArguments().getInt("action"); if (getTargetFragment() instanceof ActionEditListFragment) { ((ActionEditListFragment) getTargetFragment()).getAdapter().deleteAction(index); } else { getExperience().getActions().remove(index); } } } }); binding.doneButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getArguments().containsKey("action")) { updateAction(); // make sure code is sorted if (getAction().getCodes().size() == 1) { // Actions with only 1 code can not be a group or sequence! getAction().setMatch(Action.Match.any); } final int index = getArguments().getInt("action"); if (getTargetFragment() instanceof ActionEditListFragment) { ((ActionEditListFragment) getTargetFragment()).getAdapter().actionUpdated(index); } } dialog.dismiss(); } }); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this.getContext(), R.array.match_type_descriptions, R.layout.match_type_spinner_item); binding.matchSpinner.setAdapter(adapter); binding.matchSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { if (getAction() != null) { switch (i) { case 0: getAction().setMatch(Action.Match.any); break; case 1: getAction().setMatch(Action.Match.all); break; case 2: getAction().setMatch(Action.Match.sequence); break; } } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); if (Feature.get(getContext(), R.bool.feature_combined_markers).isEnabled()) { binding.selectLayout.setVisibility(View.GONE); binding.matchSpinner.setVisibility(View.VISIBLE); } // Upload to artcodes.co.uk feature button: if (Feature.get(getContext(), R.bool.feature_upload_to_artcodes_co_uk).isEnabled()) { binding.uploadToArtcodesCoUkButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { UUID uuid = UUID.randomUUID(); String url = "http://www.artcodes.co.uk/test1234/?file=A" + uuid.toString() + "&source=artcodes-android-app"; getAction().setUrl(url); updateAction(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(url + "&dontCheckForFiles")); startActivity(intent); } }); binding.uploadToArtcodesCoUkButton.setVisibility(View.VISIBLE); } return dialog; }