Java Code Examples for android.text.InputType#TYPE_CLASS_DATETIME
The following examples show how to use
android.text.InputType#TYPE_CLASS_DATETIME .
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 File: RuleViewModel.java From Jockey with Apache License 2.0 | 6 votes |
@Bindable public String getValueText() { if ((mEnumeratedRule.getInputType() & InputType.TYPE_CLASS_DATETIME) != 0) { long dateAsUnixTimestamp; try { dateAsUnixTimestamp = Long.parseLong(mFactory.getValue()) * 1000; } catch (NumberFormatException e) { dateAsUnixTimestamp = System.currentTimeMillis(); } int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR; Formatter date = DateUtils.formatDateRange(mContext, new Formatter(), dateAsUnixTimestamp, dateAsUnixTimestamp, flags, "UTC"); return date.toString(); } else { return mFactory.getValue(); } }
Example 2
Source File: AEditText.java From Stylish-Widget-for-Android with Apache License 2.0 | 6 votes |
@Override public void setRawInputType(int type) { Log.e(this.getClass().getSimpleName(), "Type : "+type); switch (type) { case InputType.TYPE_DATETIME_VARIATION_TIME|InputType.TYPE_CLASS_DATETIME: setupTimePicker(); break; case InputType.TYPE_DATETIME_VARIATION_DATE|InputType.TYPE_CLASS_DATETIME: setupDatePicker(); break; case InputType.TYPE_CLASS_DATETIME: setupDateTimePicker(); break; default: calendar = null; super.setRawInputType(type); } }
Example 3
Source File: HtmlInput.java From WiFiAfterConnect with Apache License 2.0 | 6 votes |
public int getAndroidInputType () { if (matchType (HtmlInput.TYPE_PASSWORD)) return InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_PASSWORD; else if (matchType (HtmlInput.TYPE_EMAIL)) return InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; else if (matchType (TYPE_TEXT)) return InputType.TYPE_CLASS_TEXT; else if (matchType (TYPE_NUMBER)) return InputType.TYPE_CLASS_NUMBER; else if (matchType (TYPE_TEL)) return InputType.TYPE_CLASS_NUMBER; else if (matchType (TYPE_DATE)) return InputType.TYPE_CLASS_DATETIME|InputType.TYPE_DATETIME_VARIATION_DATE; else if (matchType (TYPE_DATETIME) |matchType (TYPE_DATETIME_LOCAL)) return InputType.TYPE_CLASS_DATETIME; else if (matchType (TYPE_TIME)) return InputType.TYPE_CLASS_DATETIME|InputType.TYPE_DATETIME_VARIATION_TIME; return 0; }
Example 4
Source File: KeyboardLayoutSet.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
private static int getKeyboardMode(final EditorInfo editorInfo) { final int inputType = editorInfo.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: return KeyboardId.MODE_NUMBER; case InputType.TYPE_CLASS_DATETIME: switch (variation) { case InputType.TYPE_DATETIME_VARIATION_DATE: return KeyboardId.MODE_DATE; case InputType.TYPE_DATETIME_VARIATION_TIME: return KeyboardId.MODE_TIME; default: // InputType.TYPE_DATETIME_VARIATION_NORMAL return KeyboardId.MODE_DATETIME; } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: if (InputTypeUtils.isEmailVariation(variation)) { return KeyboardId.MODE_EMAIL; } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { return KeyboardId.MODE_URL; } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) { return KeyboardId.MODE_IM; } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { return KeyboardId.MODE_TEXT; } else { return KeyboardId.MODE_TEXT; } default: return KeyboardId.MODE_TEXT; } }
Example 5
Source File: InputAttributes.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
private static String toInputClassString(final int inputClass) { switch (inputClass) { case InputType.TYPE_CLASS_TEXT: return "TYPE_CLASS_TEXT"; case InputType.TYPE_CLASS_PHONE: return "TYPE_CLASS_PHONE"; case InputType.TYPE_CLASS_NUMBER: return "TYPE_CLASS_NUMBER"; case InputType.TYPE_CLASS_DATETIME: return "TYPE_CLASS_DATETIME"; default: return String.format("unknownInputClass<0x%08x>", inputClass); } }
Example 6
Source File: RuleViewModel.java From Jockey with Apache License 2.0 | 5 votes |
public View.OnClickListener onValueTextClick() { return v -> { if ((mEnumeratedRule.getInputType() & InputType.TYPE_CLASS_DATETIME) != 0) { showDateValueDialog(); } else { showValueDialog(); } }; }
Example 7
Source File: WXInput.java From weex with Apache License 2.0 | 5 votes |
private int getInputType(String type) { int inputType; switch (type) { case WXDomPropConstant.WX_ATTR_INPUT_TYPE_TEXT: inputType = InputType.TYPE_CLASS_TEXT; break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_DATE: inputType = InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_DATE; break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_DATETIME: inputType = InputType.TYPE_CLASS_DATETIME; break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_EMAIL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_PASSWORD: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; getView().setTransformationMethod(PasswordTransformationMethod.getInstance()); break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_TEL: inputType = InputType.TYPE_CLASS_PHONE; break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_TIME: inputType = InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME; break; case WXDomPropConstant.WX_ATTR_INPUT_TYPE_URL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI; break; default: inputType = InputType.TYPE_CLASS_TEXT; } return inputType; }
Example 8
Source File: SubjectBaseActivity.java From Primary with GNU General Public License v3.0 | 5 votes |
private void showSoftKeyboard(final EditText view, ViewGroup keypadarea, String defaultInput) { view.clearFocus(); if (defaultInput != null) { view.setText(defaultInput); view.setSelection(defaultInput.length()); } boolean isnumeric = ((view.getInputType() & InputType.TYPE_CLASS_NUMBER) == InputType.TYPE_CLASS_NUMBER) || ((view.getInputType() & InputType.TYPE_CLASS_DATETIME) == InputType.TYPE_CLASS_DATETIME); int whichkeyboard = Integer.parseInt(appPreferences.getString("keyboard_preference", "1")); int whichkeypad = Integer.parseInt(appPreferences.getString("keypad_preference", "1")); boolean gkeyboardAvail = getResources().getBoolean(R.bool.game_keyboard_available); boolean gkeypadAvail = getResources().getBoolean(R.bool.game_keypad_available); if (isnumeric && gkeypadAvail && whichkeypad == 1 && keypadarea != null) { Keyboard.showNumberpad(this, view, keypadarea, mNumpadkeyMap); } else if (!isnumeric && gkeyboardAvail && whichkeyboard == 1 && keypadarea != null) { Keyboard.showKeyboard(this, view, keypadarea, mKeyboardkeyMap); } else if (whichkeypad == 2 || whichkeyboard == 2 || (isnumeric && !gkeypadAvail) || (!isnumeric && !gkeyboardAvail)) { showSystemKeyboard(view); } }
Example 9
Source File: KeyboardLayoutSet.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 5 votes |
private static int getKeyboardMode(final EditorInfo editorInfo) { final int inputType = editorInfo.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: return KeyboardId.MODE_NUMBER; case InputType.TYPE_CLASS_DATETIME: switch (variation) { case InputType.TYPE_DATETIME_VARIATION_DATE: return KeyboardId.MODE_DATE; case InputType.TYPE_DATETIME_VARIATION_TIME: return KeyboardId.MODE_TIME; default: // InputType.TYPE_DATETIME_VARIATION_NORMAL return KeyboardId.MODE_DATETIME; } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: if (InputTypeUtils.isEmailVariation(variation)) { return KeyboardId.MODE_EMAIL; } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { return KeyboardId.MODE_URL; } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) { return KeyboardId.MODE_IM; } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { return KeyboardId.MODE_TEXT; } else { return KeyboardId.MODE_TEXT; } default: return KeyboardId.MODE_TEXT; } }
Example 10
Source File: TimeKeyListener.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public int getInputType() { if (mNeedsAdvancedInput) { return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL; } else { return InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME; } }
Example 11
Source File: InputAttributes.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 5 votes |
private static String toInputClassString(final int inputClass) { switch (inputClass) { case InputType.TYPE_CLASS_TEXT: return "TYPE_CLASS_TEXT"; case InputType.TYPE_CLASS_PHONE: return "TYPE_CLASS_PHONE"; case InputType.TYPE_CLASS_NUMBER: return "TYPE_CLASS_NUMBER"; case InputType.TYPE_CLASS_DATETIME: return "TYPE_CLASS_DATETIME"; default: return String.format("unknownInputClass<0x%08x>", inputClass); } }
Example 12
Source File: AbstractEditComponent.java From ucar-weex-core with Apache License 2.0 | 5 votes |
private int getInputType(String type) { int inputType; switch (type) { case Constants.Value.TEXT: inputType = InputType.TYPE_CLASS_TEXT; break; case Constants.Value.DATE: inputType = InputType.TYPE_NULL; getHostView().setFocusable(false); break; case Constants.Value.DATETIME: inputType = InputType.TYPE_CLASS_DATETIME; break; case Constants.Value.EMAIL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case Constants.Value.PASSWORD: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; getHostView().setTransformationMethod(PasswordTransformationMethod.getInstance()); break; case Constants.Value.TEL: inputType = InputType.TYPE_CLASS_PHONE; break; case Constants.Value.TIME: inputType = InputType.TYPE_NULL; getHostView().setFocusable(false); break; case Constants.Value.URL: inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI; break; case Constants.Value.NUMBER: inputType = InputType.TYPE_CLASS_NUMBER; break; default: inputType = InputType.TYPE_CLASS_TEXT; } return inputType; }
Example 13
Source File: KeyboardLayoutSet.java From simple-keyboard with Apache License 2.0 | 5 votes |
private static int getKeyboardMode(final EditorInfo editorInfo) { final int inputType = editorInfo.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: return KeyboardId.MODE_NUMBER; case InputType.TYPE_CLASS_DATETIME: switch (variation) { case InputType.TYPE_DATETIME_VARIATION_DATE: return KeyboardId.MODE_DATE; case InputType.TYPE_DATETIME_VARIATION_TIME: return KeyboardId.MODE_TIME; default: // InputType.TYPE_DATETIME_VARIATION_NORMAL return KeyboardId.MODE_DATETIME; } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: if (InputTypeUtils.isEmailVariation(variation)) { return KeyboardId.MODE_EMAIL; } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { return KeyboardId.MODE_URL; } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) { return KeyboardId.MODE_IM; } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { return KeyboardId.MODE_TEXT; } else { return KeyboardId.MODE_TEXT; } default: return KeyboardId.MODE_TEXT; } }
Example 14
Source File: KeyboardLayoutSet.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 5 votes |
private static int getKeyboardMode(final EditorInfo editorInfo) { final int inputType = editorInfo.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: return KeyboardId.MODE_NUMBER; case InputType.TYPE_CLASS_DATETIME: switch (variation) { case InputType.TYPE_DATETIME_VARIATION_DATE: return KeyboardId.MODE_DATE; case InputType.TYPE_DATETIME_VARIATION_TIME: return KeyboardId.MODE_TIME; default: // InputType.TYPE_DATETIME_VARIATION_NORMAL return KeyboardId.MODE_DATETIME; } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: if (InputTypeUtils.isEmailVariation(variation)) { return KeyboardId.MODE_EMAIL; } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { return KeyboardId.MODE_URL; } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) { return KeyboardId.MODE_IM; } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { return KeyboardId.MODE_TEXT; } else { return KeyboardId.MODE_TEXT; } default: return KeyboardId.MODE_TEXT; } }
Example 15
Source File: KeyboardLayoutSet.java From openboard with GNU General Public License v3.0 | 5 votes |
private static int getKeyboardMode(final EditorInfo editorInfo) { final int inputType = editorInfo.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: return KeyboardId.MODE_NUMBER; case InputType.TYPE_CLASS_DATETIME: switch (variation) { case InputType.TYPE_DATETIME_VARIATION_DATE: return KeyboardId.MODE_DATE; case InputType.TYPE_DATETIME_VARIATION_TIME: return KeyboardId.MODE_TIME; default: // InputType.TYPE_DATETIME_VARIATION_NORMAL return KeyboardId.MODE_DATETIME; } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: if (InputTypeUtils.isEmailVariation(variation)) { return KeyboardId.MODE_EMAIL; } else if (variation == InputType.TYPE_TEXT_VARIATION_URI) { return KeyboardId.MODE_URL; } else if (variation == InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE) { return KeyboardId.MODE_IM; } else if (variation == InputType.TYPE_TEXT_VARIATION_FILTER) { return KeyboardId.MODE_TEXT; } else { return KeyboardId.MODE_TEXT; } default: return KeyboardId.MODE_TEXT; } }
Example 16
Source File: InputAttributes.java From openboard with GNU General Public License v3.0 | 5 votes |
private static String toVariationString(final int inputClass, final int variation) { switch (inputClass) { case InputType.TYPE_CLASS_TEXT: return toTextVariationString(variation); case InputType.TYPE_CLASS_NUMBER: return toNumberVariationString(variation); case InputType.TYPE_CLASS_DATETIME: return toDatetimeVariationString(variation); default: return ""; } }
Example 17
Source File: InputAttributes.java From openboard with GNU General Public License v3.0 | 5 votes |
private static String toInputClassString(final int inputClass) { switch (inputClass) { case InputType.TYPE_CLASS_TEXT: return "TYPE_CLASS_TEXT"; case InputType.TYPE_CLASS_PHONE: return "TYPE_CLASS_PHONE"; case InputType.TYPE_CLASS_NUMBER: return "TYPE_CLASS_NUMBER"; case InputType.TYPE_CLASS_DATETIME: return "TYPE_CLASS_DATETIME"; default: return String.format("unknownInputClass<0x%08x>", inputClass); } }
Example 18
Source File: DateTimeKeyListener.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public int getInputType() { if (mNeedsAdvancedInput) { return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL; } else { return InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_NORMAL; } }
Example 19
Source File: InputAttributes.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
private static String toVariationString(final int inputClass, final int variation) { switch (inputClass) { case InputType.TYPE_CLASS_TEXT: return toTextVariationString(variation); case InputType.TYPE_CLASS_NUMBER: return toNumberVariationString(variation); case InputType.TYPE_CLASS_DATETIME: return toDatetimeVariationString(variation); default: return ""; } }
Example 20
Source File: EditableInputView.java From fastnfitness with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected void editDialog(Context context) { if (!mActivateDialog) return; if (mCustomerDialogBuilder != null) { mCustomerDialogBuilder.customerDialogBuilder(this).show(); } else { if ((valueTextView.getInputType() & InputType.TYPE_CLASS_DATETIME) > 0) { Calendar calendar = Calendar.getInstance(); calendar.setTime(DateConverter.localDateStrToDate(getText(), getContext())); int day = calendar.get(Calendar.DAY_OF_MONTH); int month = calendar.get(Calendar.MONTH); int year = calendar.get(Calendar.YEAR); DatePickerDialog datePickerDialog = new DatePickerDialog( getContext(), this, year, month, day); datePickerDialog.show(); } else { final EditText editText = new EditText(context); editText.setText(mTextValue); editText.setGravity(Gravity.CENTER); editText.setInputType(textViewInputType); editText.requestFocus(); LinearLayout linearLayout = new LinearLayout(context.getApplicationContext()); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(editText); final SweetAlertDialog dialog = new SweetAlertDialog(context, SweetAlertDialog.NORMAL_TYPE) .setTitleText(mTitle) .setCancelText(getContext().getString(R.string.global_cancel)) .setHideKeyBoardOnDismiss(true) .setCancelClickListener(sDialog -> { editText.clearFocus(); Keyboard.hide(context, editText); sDialog.dismissWithAnimation();}) .setConfirmClickListener(sDialog -> { editText.clearFocus(); Keyboard.hide(context, editText); setText(editText.getText().toString()); sDialog.dismissWithAnimation(); if (mConfirmClickListener != null) mConfirmClickListener.onTextChanged(EditableInputView.this); }); dialog.setOnDismissListener(sDialog -> { rootView.requestFocus(); InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Activity.INPUT_METHOD_SERVICE); if ( imm !=null) imm.hideSoftInputFromWindow(rootView.getWindowToken(), 0);}); //Keyboard.hide(context, editText);}); dialog.setOnShowListener(sDialog -> { editText.requestFocus(); Keyboard.show(context, editText); }); dialog.setCustomView(linearLayout); dialog.show(); } } }