android.support.design.widget.TextInputLayout.getError()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中android.support.design.widget.TextInputLayout.getError()方法的一些代码示例,展示了TextInputLayout.getError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextInputLayout.getError()方法的具体详情如下:
包路径:android.support.design.widget.TextInputLayout
类名称:TextInputLayout
方法名:getError

TextInputLayout.getError介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public TextInputLayoutAssert hasError(CharSequence error) {
  isNotNull();
  CharSequence actualError = actual.getError();

  assertThat(actualError) //
    .overridingErrorMessage("Expected error '<%s>' but was '<%s>'.", error, actualError) //
    .isEqualTo(error);
  return this;
 }
}

代码示例来源:origin: hidroh/materialistic

@Test
public void testEmptyInput() {
  activity.findViewById(R.id.feedback_button).performClick();
  assertNotNull(((TextInputLayout) activity.findViewById(R.id.textinput_title)).getError());
  assertNotNull(((TextInputLayout) activity.findViewById(R.id.textinput_body)).getError());
  verify(feedbackClient, never()).send(any(), any(), any(FeedbackClient.Callback.class));
  assertThat(activity).isNotFinishing();
  controller.pause().stop().destroy();
}

代码示例来源:origin: RolandMostoha/pin-demo

@Override
public boolean matchesSafely(View view) {
  if (!(view instanceof TextInputLayout)) {
    return false;
  }
  TextInputLayout textInputLayout = (TextInputLayout) view;
  return textInputLayout.getError() != null && textInputLayout.getError().toString().equals(expected);
}

代码示例来源:origin: GrossumUA/TAS_Android_Boilerplate

@Override
  protected boolean matchesSafely(View view) {
    if (!(view instanceof TextInputLayout)) {
      return false;
    }
    CharSequence error = ((TextInputLayout) view).getError();
    if (error == null) {
      return stringMatcher.matches(null);
    }
    String hint = error.toString();
    return stringMatcher.matches(hint);
  }
};

代码示例来源:origin: jbruchanov/AnUitor

@Override
  protected HashMap<String, Object> fillValues(View v, HashMap<String, Object> data, HashMap<String, Object> parentData) {
    super.fillValues(v, data, parentData);

    TextInputLayout view = (TextInputLayout) v;

    data.put("Error", view.getError());
    data.put("Hint", view.getHint());
    data.put("PasswordVisibilityToggleContentDescription", view.getPasswordVisibilityToggleContentDescription());
    data.put("PasswordVisibilityToggleDrawable:", view.getPasswordVisibilityToggleDrawable());
    data.put("Typeface:", view.getTypeface());
    data.put("IsCounterEnabled", view.isCounterEnabled());
    data.put("IsErrorEnabled", view.isErrorEnabled());
    data.put("IsHintAnimationEnabled", view.isHintAnimationEnabled());
    data.put("IsHintEnabled", view.isHintEnabled());
    data.put("IsPasswordVisibilityToggleEnabled", view.isPasswordVisibilityToggleEnabled());

    return data;
  }
}

代码示例来源:origin: bparmentier/WiFiKeyShare

@Override
  public void afterTextChanged(Editable editable) {
    wifiPasswordDialog.getButton(DialogInterface.BUTTON_POSITIVE)
        .setEnabled(editable.length() >= 5);
    if (wifiPasswordWrapper.getError() != null) {
      try {
        if (WifiNetwork.isValidKeyLength(wifiNetwork.getAuthType(),
            editable.toString())) {
          wifiPasswordWrapper.setError(null);
        }
      } catch (final WifiException e) {
        switch (e.getErrorCode()) {
          case WifiException.WEP_KEY_LENGTH_ERROR:
            wifiPasswordWrapper.setError(getString(R.string.error_wep_password_length));
            break;
          case WifiException.WPA_KEY_LENGTH_ERROR:
            wifiPasswordWrapper.setError(getString(R.string.error_wpa_password_length));
            break;
          default:
            wifiPasswordWrapper.setError(e.getMessage());
            break;
        }
      }
    }
  }
});

代码示例来源:origin: braintree/android-card-form

@Test
public void setError_setsErrorWhenParentViewIsATextInputLayout() {
  mView = (CardEditText) Robolectric.setupActivity(TestActivity.class)
      .findViewById(R.id.bt_card_form_card_number);
  mView.setError("Error");
  assertEquals("Error", ((TextInputLayout) mView.getParent().getParent()).getError());
}

相关文章