本文整理汇总了Java中android.support.design.widget.TextInputLayout.setErrorEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java TextInputLayout.setErrorEnabled方法的具体用法?Java TextInputLayout.setErrorEnabled怎么用?Java TextInputLayout.setErrorEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.TextInputLayout
的用法示例。
在下文中一共展示了TextInputLayout.setErrorEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkEmail
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean checkEmail(EditText emailEditText, TextInputLayout emailInputLayout) {
if (emailEditText.getText().toString().trim().isEmpty()) {
emailInputLayout.setErrorEnabled(true);
emailInputLayout.setError(getString(R.string.error_no_email));
if (emailEditText.requestFocus()) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
return false;
} else {
if (android.util.Patterns.EMAIL_ADDRESS.matcher(emailEditText.getText().toString()).matches()) {
emailInputLayout.setErrorEnabled(false);
} else {
emailInputLayout.setErrorEnabled(true);
emailInputLayout.setError(getString(R.string.error_no_email));
if (emailEditText.requestFocus()) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
return false;
}
}
return true;
}
示例2: checkDocument
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean checkDocument(EditText editText, TextInputLayout textInputLayout) {
if (editText.getText().toString().trim().isEmpty()) {
textInputLayout.setErrorEnabled(true);
textInputLayout.setError(getString(R.string.error_no_dni));
if (editText.requestFocus()) {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
return false;
} else {
textInputLayout.setErrorEnabled(false);
}
return true;
}
示例3: checkNoEmpty
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean checkNoEmpty(EditText editText, TextInputLayout textInputLayout) {
if (editText.getText().toString().trim().isEmpty()) {
setErrorStyle(editText, textInputLayout, R.string.error_no_password);
return false;
} else {
textInputLayout.setErrorEnabled(false);
}
return true;
}
示例4: setError
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public static void setError(TextView textView, String errorMessage) {
TextInputLayout textInputLayout = getTextInputLayout(textView);
if (textInputLayout != null) {
textInputLayout.setErrorEnabled(!TextUtils.isEmpty(errorMessage));
textInputLayout.setError(errorMessage);
} else {
textView.setError(errorMessage);
}
}
示例5: disableAllFields
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void disableAllFields() {
TextInputLayout allFields[] = {pinInputLayout, cvvInputLayout, cardNumber, expiryInputLayout};
for (TextInputLayout field : allFields) {
field.setEnabled(false);
field.setErrorEnabled(false);
}
Arrays.fill(allFields, null);
}
示例6: textInputErrorTwinkle
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public static void textInputErrorTwinkle(TextInputLayout il, String str) {
String error = (String) il.getError();
if (TextUtils.isEmpty(error)) {
error = TextUtils.isEmpty(str) ? "!" : str;
}
il.setErrorEnabled(false);
il.setError(error);
il.setErrorEnabled(true);
}
示例7: checkValid
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public boolean checkValid(final EditText email, final String message, final TextInputLayout til){
if(email != null) {
String check = email.getText().toString().trim();
if(til != null){
til.setErrorEnabled(false);
if (!emailValidation(check)) {
til.setErrorEnabled(true);
til.setError(message);
} else {
til.setError(null);
til.setErrorEnabled(false);
}
}else {
if (!emailValidation(check)) {
email.setError(message);
} else {
email.setError(null);
}
}
return emailValidation(check);
}else{
throw new NullPointerException("Validator : Field is null");
}
}
示例8: validateInputs
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean validateInputs() {
boolean valid = true;
// Validates title (required field, ensure title is given.)
TextInputLayout titleWrapper = getView().findViewById(R.id.edit_title_wrapper);
TextInputEditText title = getView().findViewById(R.id.edit_title);
if (title.getText().toString().isEmpty()) {
titleWrapper.setErrorEnabled(true);
titleWrapper.setError("This field is required.");
title.requestFocus();
myActivity.hideSoftKeyboard(false);
valid = false;
} else {
titleWrapper.setError(null);
titleWrapper.setErrorEnabled(false);
}
// Validates due_date (must be later than now.)
TextInputLayout timeWrapper = getView().findViewById(R.id.edit_time_wrapper);
TextInputEditText time = getView().findViewById(R.id.edit_time);
long date_time = myCalendar.getTimeInMillis();
long current_date_time = System.currentTimeMillis();
if (date_time < current_date_time){
timeWrapper.setErrorEnabled(true);
timeWrapper.setError("Please select a time later than now");
time.requestFocus();
valid = false;
} else {
time.setError(null);
timeWrapper.setErrorEnabled(false);
}
return valid;
}
示例9: isInputEditTextFilled
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
/**
* method to check InputEditText filled .
*
* @param textInputEditText
* @param textInputLayout
* @param message
* @return
*/
public boolean isInputEditTextFilled(TextInputEditText textInputEditText, TextInputLayout textInputLayout, String message) {
String value = textInputEditText.getText().toString().trim();
if (value.isEmpty()) {
textInputLayout.setError(message);
hideKeyboardFrom(textInputEditText);
return false;
} else {
textInputLayout.setErrorEnabled(false);
}
return true;
}
示例10: isInputEditTextEmail
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
/**
* method to check InputEditText has valid email .
*
* @param textInputEditText
* @param textInputLayout
* @param message
* @return
*/
public boolean isInputEditTextEmail(TextInputEditText textInputEditText, TextInputLayout textInputLayout, String message) {
String value = textInputEditText.getText().toString().trim();
if (value.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(value).matches()) {
textInputLayout.setError(message);
hideKeyboardFrom(textInputEditText);
return false;
} else {
textInputLayout.setErrorEnabled(false);
}
return true;
}
示例11: isInputEditTextMatches
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public boolean isInputEditTextMatches(TextInputEditText textInputEditText1, TextInputEditText textInputEditText2, TextInputLayout textInputLayout, String message) {
String value1 = textInputEditText1.getText().toString().trim();
String value2 = textInputEditText2.getText().toString().trim();
if (!value1.contentEquals(value2)) {
textInputLayout.setError(message);
hideKeyboardFrom(textInputEditText2);
return false;
} else {
textInputLayout.setErrorEnabled(false);
}
return true;
}
示例12: disableAllFields
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void disableAllFields() {
TextInputLayout allFields[] = {pinInputLayout, cvvInputLayout, cardNumber, expiryInputLayout};
for (TextInputLayout field : allFields) {
field.setEnabled(false);
field.setErrorEnabled(false);
}
Arrays.fill(allFields, null);
}
示例13: setError
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private static void setError(TextInputLayout textInputLayout, String message) {
if (TextUtils.isEmpty(message)) {
textInputLayout.setError(null);
textInputLayout.setErrorEnabled(false);
} else {
textInputLayout.setError(message);
textInputLayout.setErrorEnabled(true);
}
}
示例14: validateAccount
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean validateAccount() {
TextInputLayout accountInputLayout = (TextInputLayout) fragmentView.findViewById(R.id.account_input_layout);
EditText accountEditText = (EditText) fragmentView
.findViewById(R.id.account_edittext);
String accountText = accountEditText.getText().toString();
if (TextUtils.isEmpty(accountText)) {
accountInputLayout.setError(getString(R.string.account_empty_error_message));
requestFocus(accountEditText);
return false;
} else {
accountInputLayout.setErrorEnabled(false);
}
return true;
}
示例15: validatePassword
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean validatePassword() {
TextInputLayout passwordInputLayout = (TextInputLayout) fragmentView.findViewById(R.id.password_input_layout);
EditText passwordEditText = (EditText) fragmentView
.findViewById(R.id.password_edittext);
String passwordText = passwordEditText.getText().toString();
if (TextUtils.isEmpty(passwordText)) {
passwordInputLayout.setError(getString(R.string.password_empty_error_message));
requestFocus(passwordEditText);
return false;
} else {
passwordInputLayout.setErrorEnabled(false);
}
return true;
}