private static boolean isPostalAddress(TextView view) { int inputType = view.getInputType(); return inputType == InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS; }
private static boolean isPhoneNumber(TextView view) { int inputType = view.getInputType(); return inputType == InputType.TYPE_CLASS_PHONE; }
private static boolean isPersonName(TextView view) { int inputType = view.getInputType(); return inputType == InputType.TYPE_TEXT_VARIATION_PERSON_NAME; }
private static boolean isPassword(TextView view) { int inputType = view.getInputType(); if (inputType == InputType.TYPE_TEXT_VARIATION_PASSWORD) { return true; } TransformationMethod method = view.getTransformationMethod(); return method instanceof PasswordTransformationMethod; }
private static boolean isEmail(TextView view) { int inputType = view.getInputType(); if (inputType == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) { return true; } String text = ViewHierarchy.getTextOfView(view); if (text == null || text.length() == 0) { return false; } return android.util.Patterns.EMAIL_ADDRESS.matcher(text).matches(); }
public S hasInputType(int type) { isNotNull(); int actualType = actual.getInputType(); assertThat(actualType) // .overridingErrorMessage("Expected input type <%s> but was <%s>.", type, actualType) // .isEqualTo(type); return myself; }
private boolean isSingleLine(TextView textView) { boolean singleLine; try { singleLine = Reflect.on(textView).get("mSingleLine"); } catch (Exception e) { singleLine = (textView.getInputType() & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0; } return singleLine; }
@Test public void testGetInputType() throws Exception { assertThat(textView.getInputType()).isNotEqualTo(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); textView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); assertThat(textView.getInputType()).isEqualTo(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); }
/*** * @param textView textview * @return 是否是单行 */ public static boolean isSingleLine(TextView textView) { if (textView == null) return false; if (textView instanceof BaseTextView) { return ((BaseTextView) textView).isSingleLine(); } if (textView == null) { return false; } int type = textView.getInputType(); return (type & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) == EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE; }
/*** * @param textView textview * @return 是否是单行 */ public static boolean isSingleLine(TextView textView) { if (textView == null) return false; if (textView instanceof BaseTextView) { return ((BaseTextView) textView).isSingleLine(); } if (textView == null) { return false; } int type = textView.getInputType(); return (type & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) == EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE; }
public S hasInputType(int type) { isNotNull(); int actualType = actual.getInputType(); assertThat(actualType) // .overridingErrorMessage("Expected input type <%s> but was <%s>.", type, actualType) // .isEqualTo(type); return myself; }
private boolean isSingleLine(TextView textView) { boolean singleLine; try { singleLine = Reflect.on(textView).get("mSingleLine"); } catch (Exception e) { singleLine = (textView.getInputType() & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0; } return singleLine; }
private boolean isSingleLine(TextView textView) { boolean singleLine; try { singleLine = Reflect.on(textView).get("mSingleLine"); } catch (Exception e) { singleLine = (textView.getInputType() & EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE) != 0; } return singleLine; }
public boolean isPassword() { return (view instanceof TextView) && isPasswordInputType(((TextView) view).getInputType()); }
values.put("AutoLinkMask", translator.linkMask(tv.getAutoLinkMask())); values.put("Ellipsize", String.valueOf(tv.getEllipsize())); values.put("InputType", translator.inputType(tv.getInputType())); values.put("TextScaleX", tv.getTextScaleX()); values.put("CompoundDrawablePadding", tv.getCompoundDrawablePadding());
if(txtValue.getInputType()==InputType.TYPE_NULL){ txtValue.setInputType(InputType.TYPE_CLASS_TEXT); txtValue.invalidate();