当前位置: 首页>>代码示例>>Java>>正文


Java TextInputLayout.setErrorEnabled方法代码示例

本文整理汇总了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;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:23,代码来源:LoginActivity.java

示例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;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:14,代码来源:LoginActivity.java

示例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;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:10,代码来源:ProfileActivity.java

示例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);
    }
}
 
开发者ID:Ilhasoft,项目名称:data-binding-validator,代码行数:10,代码来源:EditTextHandler.java

示例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);
}
 
开发者ID:aksalj,项目名称:africastalking-android,代码行数:9,代码来源:Cuhn.java

示例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);
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:11,代码来源:TextInputHelper.java

示例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");
        }

    }
 
开发者ID:harpzzz,项目名称:Android-Validator,代码行数:36,代码来源:EmailTest.java

示例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;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:35,代码来源:ToduleAddFragment.java

示例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;
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:21,代码来源:InputValidation.java

示例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;
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:20,代码来源:InputValidation.java

示例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;
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:13,代码来源:InputValidation.java

示例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);

}
 
开发者ID:KingsMentor,项目名称:Luhn,代码行数:10,代码来源:Luhn.java

示例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);
    }
}
 
开发者ID:zillachan,项目名称:ValidZilla,代码行数:10,代码来源:ValiZilla.java

示例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;
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:15,代码来源:AccountSettingFragment.java

示例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;
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:15,代码来源:AccountSettingFragment.java


注:本文中的android.support.design.widget.TextInputLayout.setErrorEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。