Java 类android.support.design.widget.TextInputLayout 实例源码

项目:AdaptiveTableLayout    文件:EditItemDialog.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    //noinspection ConstantConditions
    getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    View view = inflater.inflate(R.layout.dialog_edit_item, container, false);

    mTilValue = (TextInputLayout) view.findViewById(R.id.tilValue);
    mEtValue = (TextInputEditText) view.findViewById(R.id.etValue);

    view.findViewById(R.id.bPositive).setOnClickListener(this);
    view.findViewById(R.id.bNegative).setOnClickListener(this);

    return view;
}
项目:android-banklink    文件:MainActivity.java   
private Map<String, String> gatherFormData() {
  final ViewGroup formContainer = this.formContainer;
  final int childCount = formContainer.getChildCount();
  final ArrayMap<String, String> formData = new ArrayMap<>(childCount);
  for (int i = 0; i < childCount; i++) {
    final View child = formContainer.getChildAt(i);
    final PacketParameter param = (PacketParameter) child.getTag();
    if (child instanceof TextInputLayout) {
      final EditText input = ((TextInputLayout) child).getEditText();
      if (input != null) {
        formData.put(param.id(), input.getText().toString());
      }
    }
  }
  final Packet selectedPacket = Packet.fromSelection(packetSelection.getSelectedItemPosition());
  formData.put(PACKET_ID_KEY, Integer.toString(selectedPacket.packetId));
  formData.put(DATETIME_KEY, DATE_FORMAT.format(new Date()));
  return formData;
}
项目:GSB-2017-Android    文件:AjouteSupplierActivity.java   
private void setupViews() {
        textInput_nom      = (TextInputLayout) findViewById(R.id.textInput_supname);
        textInput_email    = (TextInputLayout) findViewById(R.id.textInput_email);
        textInput_addresse = (TextInputLayout) findViewById(R.id.textInput_SupAdresse);
        textInput_mobile   = (TextInputLayout) findViewById(R.id.textInput_mobile);
        textInput_tel      = (TextInputLayout) findViewById(R.id.textInput_telephone);
        Button button_ajouter = (Button) findViewById(R.id.button_ajouter);
        button_ajouter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(!checkFields())
                    Toast.makeText(AjouteSupplierActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
                else
                    addSupplier();
            }
        });
}
项目:GSB-2017-Android    文件:RegisterActivity.java   
private void setupViews() {
    textInput_Code_user     = (TextInputLayout) findViewById(R.id.textInput_Code_user);
    textInput_FullName      = (TextInputLayout) findViewById(R.id.textInput_FullName);
    textInput_TelUsr        = (TextInputLayout) findViewById(R.id.textInput_TelUsr);
    textInput_AdrUsr        = (TextInputLayout) findViewById(R.id.textInput_AdrUsr);
    textView_Password1      = (TextInputLayout) findViewById(R.id.textView_Password1);
    textView_Password2      = (TextInputLayout) findViewById(R.id.textView_Password2);
    spinner_branch          = (Spinner) findViewById(R.id.spinner_branch);

    Button button_register = (Button) findViewById(R.id.button_ajouter);

    button_register.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(!checkFields())
                Toast.makeText(RegisterActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
            else
                Register();
        }
    });
}
项目:MusicX-music-player    文件:TextColorTagProcessor.java   
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    final TextView tv = (TextView) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;

    if (mHintMode)
        result.adjustAlpha(0.5f);

    final ColorStateList sl = getTextSelector(result.getColor(), view, false);
    if (mLinkMode) {
        tv.setLinkTextColor(sl);
    } else if (mHintMode) {
        tv.setHintTextColor(sl);
        // Sets parent TextInputLayout hint color
        if (view.getParent() != null && view.getParent() instanceof TextInputLayout) {
            final TextInputLayout til = (TextInputLayout) view.getParent();
            TextInputLayoutUtil.setHint(til, result.getColor());
        }
    } else {
        tv.setTextColor(sl);
    }
}
项目:fussroll    文件:RegisterActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);

    editText = (EditText) findViewById(R.id.editText);
    spinner = (Spinner) findViewById(R.id.spinner);
    textInputLayout = (TextInputLayout) findViewById(R.id.textInputLayout);

    ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this, R.array.countries, R.layout.spinner_layout);
    arrayAdapter.setDropDownViewResource(R.layout.spinner_layout);
    spinner.setAdapter(arrayAdapter);

    AppCompatButton appCompatButton = (AppCompatButton) findViewById(R.id.button);
    appCompatButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            register();
        }
    });

}
项目:africastalking-android    文件:CardTextInputLayout.java   
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
项目:africastalking-android    文件:PinTextInputLayout.java   
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
项目:africastalking-android    文件:BankTextInputLayout.java   
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
项目:Sistema-de-Comercializacion-Negocios-Jhordan    文件:ResetPasswordDialog.java   
private void initViews(View v) {

        mEtEmail = (EditText) v.findViewById(R.id.et_email);
        mEtToken = (EditText) v.findViewById(R.id.et_token);
        mEtPassword = (EditText) v.findViewById(R.id.et_password);
        mBtResetPassword = (Button) v.findViewById(R.id.btn_reset_password);
        mProgressBar = (ProgressBar) v.findViewById(R.id.progress);
        mTvMessage = (TextView) v.findViewById(R.id.tv_message);
        mTiEmail = (TextInputLayout) v.findViewById(R.id.ti_email);
        mTiToken = (TextInputLayout) v.findViewById(R.id.ti_token);
        mTiPassword = (TextInputLayout) v.findViewById(R.id.ti_password);

        mBtResetPassword.setOnClickListener(view -> {
            if (isInit) resetPasswordInit();
            else resetPasswordFinish();
        });
    }
项目:Guanajoven    文件:EditTextValidations.java   
public static boolean compararFechaHora(EditText f1, EditText h1, String fec1, String fec2){
    Log.d("FECHAS", fec1 + "     " + fec2);
    Date d1 = DateUtilities.stringToDate(fec1);
    Date d2 = DateUtilities.stringToDate(fec2);

    if(d2.before(d1)){
        ((TextInputLayout)f1.getParent().getParent()).setErrorEnabled(true);
        ((TextInputLayout)f1.getParent().getParent()).setError("La fecha de fin no puede ser posterior a la de inicio.");
        ((TextInputLayout)h1.getParent().getParent()).setErrorEnabled(true);
        ((TextInputLayout)h1.getParent().getParent()).setError("");
        return false;
    }
    else{
        return true;
    }
}
项目:RunHDU    文件:SunnyRunActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sunny_run);
    usernameText = (TextInputLayout) findViewById(R.id.sunny_run_username_edit_text);
    listTopText = (TextView) findViewById(R.id.sun_list_top_text);
    loginButton = (Button) findViewById(R.id.sunny_run_login_button);
    refreshLayout = (SwipeRefreshLayout) findViewById(R.id.sunny_refresh);
    loginLayout = (LinearLayout) findViewById(R.id.sunny_run_login_layout);
    setToolbar(R.id.sunny_run_toolbar, true);
    refreshLayout.setEnabled(false);

    initRecyclerView();
    checkLogin();

    loginButton.setOnClickListener(v -> {
        //收回输入法
        InputMethodManager imm = (InputMethodManager)
                getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(refreshLayout.getWindowToken(), 0);
        if (checkInput()) {
            prefs.put("sunny_run_username", usernameText.getEditText().getText().toString());
            getData();
        }
    });
}
项目:Android_watch_magpie    文件:AddValueFragment.java   
private void setCancelAction(Button cancelButton, final EditText dateEditText,
                             final EditText timeEditText, final TextInputLayout... textInputLayouts) {
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            for (TextInputLayout textInputLayout : textInputLayouts) {
                textInputLayout.getEditText().setText("");
                textInputLayout.clearFocus();
                // Hide the keyboard
                InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(textInputLayout.getEditText().getWindowToken(), 0);
            }
            dateEditText.setText("");
            timeEditText.setText("");
        }
    });
}
项目:Nird2    文件:SetupActivityTest.java   
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    setupActivity = Robolectric.setupActivity(TestSetupActivity.class);
    nicknameEntryWrapper = (TextInputLayout) setupActivity
            .findViewById(R.id.nickname_entry_wrapper);
    passwordConfirmationWrapper = (TextInputLayout) setupActivity
            .findViewById(R.id.password_confirm_wrapper);
    nicknameEntry =
            (EditText) setupActivity.findViewById(R.id.nickname_entry);
    passwordEntry =
            (EditText) setupActivity.findViewById(R.id.password_entry);
    passwordConfirmation =
            (EditText) setupActivity.findViewById(R.id.password_confirm);
    strengthMeter =
            (StrengthMeter) setupActivity.findViewById(R.id.strength_meter);
    createAccountButton =
            (Button) setupActivity.findViewById(R.id.create_account);
}
项目:Nird2    文件:ChangePasswordActivityTest.java   
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    changePasswordActivity =
            Robolectric.setupActivity(TestChangePasswordActivity.class);
    passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity
            .findViewById(R.id.new_password_confirm_wrapper);
    currentPassword = (EditText) changePasswordActivity
            .findViewById(R.id.current_password_entry);
    newPassword = (EditText) changePasswordActivity
            .findViewById(R.id.new_password_entry);
    newPasswordConfirmation = (EditText) changePasswordActivity
            .findViewById(R.id.new_password_confirm);
    strengthMeter = (StrengthMeter) changePasswordActivity
            .findViewById(R.id.strength_meter);
    changePasswordButton = (Button) changePasswordActivity
            .findViewById(R.id.change_password);
}
项目:Nird2    文件:SetupActivityTest.java   
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    setupActivity = Robolectric.setupActivity(TestSetupActivity.class);
    nicknameEntryWrapper = (TextInputLayout) setupActivity
            .findViewById(R.id.nickname_entry_wrapper);
    passwordConfirmationWrapper = (TextInputLayout) setupActivity
            .findViewById(R.id.password_confirm_wrapper);
    nicknameEntry =
            (EditText) setupActivity.findViewById(R.id.nickname_entry);
    passwordEntry =
            (EditText) setupActivity.findViewById(R.id.password_entry);
    passwordConfirmation =
            (EditText) setupActivity.findViewById(R.id.password_confirm);
    strengthMeter =
            (StrengthMeter) setupActivity.findViewById(R.id.strength_meter);
    createAccountButton =
            (Button) setupActivity.findViewById(R.id.create_account);
}
项目:Nird2    文件:ChangePasswordActivityTest.java   
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    changePasswordActivity =
            Robolectric.setupActivity(TestChangePasswordActivity.class);
    passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity
            .findViewById(R.id.new_password_confirm_wrapper);
    currentPassword = (EditText) changePasswordActivity
            .findViewById(R.id.current_password_entry);
    newPassword = (EditText) changePasswordActivity
            .findViewById(R.id.new_password_entry);
    newPasswordConfirmation = (EditText) changePasswordActivity
            .findViewById(R.id.new_password_confirm);
    strengthMeter = (StrengthMeter) changePasswordActivity
            .findViewById(R.id.strength_meter);
    changePasswordButton = (Button) changePasswordActivity
            .findViewById(R.id.change_password);
}
项目:RestaurantApp    文件:StaffLoginActivity.java   
@Override
public void onClick(View v) {
    TextInputLayout tilUsername = (TextInputLayout) findViewById(R.id.TILUsername);
    TextInputLayout tilPassword = (TextInputLayout) findViewById(R.id.TILPassword);

    final String strUsername = etUsername.getText().toString();
    final String strPassword = etPassword.getText().toString();

    if (v.equals(btnLogin)){
        if (strUsername.equals("")){
            tilUsername.setError("Kullanıcı adı boş olamaz.");
        }else if (strPassword.equals("")){
            tilPassword.setError("Parola adı boş olamaz.");
        }else{

            Request request = new Request(this, url, com.android.volley.Request.Method.POST);
            request.requestVolleyAuth(this,  strUsername,  strPassword);
            progressDialog = new ProgressDialog(this);
            progressDialog.setMessage("Giriş Yapılıyor..");
            progressDialog.show();

        }
    }
}
项目:Luhn    文件:PinTextInputLayout.java   
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
项目:Android_watch_magpie    文件:AddValueFragment.java   
private void removeFocus(TextInputLayout... textInputLayouts) {
    for (TextInputLayout textInputLayout : textInputLayouts) {
        textInputLayout.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    textView.clearFocus();
                    // Hide the keyboard
                    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(textView.getWindowToken(), 0);
                }
                return false;
            }
        });
    }
}
项目:Android-skin-support    文件:SkinMaterialTextInputLayout.java   
public SkinMaterialTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextInputLayout, defStyleAttr, R.style.Widget_Design_TextInputLayout);
    if (a.hasValue(R.styleable.TextInputLayout_android_textColorHint)) {
        mDefaultTextColorResId = mFocusedTextColorResId =
                a.getResourceId(R.styleable.TextInputLayout_android_textColorHint, INVALID_ID);
        applyFocusedTextColorResource();
    }

    int errorTextAppearance = a.getResourceId(R.styleable.TextInputLayout_errorTextAppearance, INVALID_ID);
    loadErrorTextColorResFromAttributes(errorTextAppearance);
    int counterTextAppearance = a.getResourceId(R.styleable.TextInputLayout_counterTextAppearance, INVALID_ID);
    loadCounterTextColorResFromAttributes(counterTextAppearance);
    mPasswordToggleResId = a.getResourceId(R.styleable.TextInputLayout_passwordToggleDrawable, INVALID_ID);
    a.recycle();
}
项目:wisebite_android    文件:CreateRestaurantInfoActivity.java   
/**
 * Initialize form inputs
 */
private void initializeForm() {
    inputName = (EditText) findViewById(R.id.input_name);
    inputLocation = (EditText) findViewById(R.id.input_location);
    inputPhone = (EditText) findViewById(R.id.input_phone);
    inputDescription = (EditText) findViewById(R.id.input_description);
    inputWebsite = (EditText) findViewById(R.id.input_website);
    inputNumberOfTables = (EditText) findViewById(R.id.input_number_of_tables);

    inputLayoutName = (TextInputLayout) findViewById(R.id.input_layout_name);
    inputLayoutLocation = (TextInputLayout) findViewById(R.id.input_layout_location);
    inputLayoutPhone = (TextInputLayout) findViewById(R.id.input_layout_phone);
    inputLayoutDescription = (TextInputLayout) findViewById(R.id.input_layout_description);
    inputLayoutWebsite = (TextInputLayout) findViewById(R.id.input_layout_website);
    inputLayoutNumberOfTables = (TextInputLayout) findViewById(R.id.input_layout_number_of_tables);

}
项目:HutHelper    文件:CommonDialog.java   
public CommonDialog(Context context) {
    view = LayoutInflater.from(context).inflate(R.layout.dialog_common, null, false);
    tvMessage = (TextView) view.findViewById(R.id.tv_message);
    btOk = (Button) view.findViewById(R.id.bt_ok);
    btCancel = (Button) view.findViewById(R.id.bt_cancel);
    tvTitle = (TextView) view.findViewById(R.id.tv_title);
    tvMessageRoot = (LinearLayout) view.findViewById(R.id.tv_message_root);

    inputArea = (TextInputEditText) view.findViewById(R.id.input_area);
    inputRoot = (TextInputLayout) view.findViewById(R.id.input_root);

    inputRoot.setVisibility(View.GONE);
    tvMessageRoot.setVisibility(View.GONE);
    tvTitle.setVisibility(View.GONE);
    tvMessage.setVisibility(View.GONE);
    btOk.setVisibility(View.GONE);
    btCancel.setVisibility(View.GONE);

    builder = new AlertDialog.Builder(context)
            .setView(view);
}
项目:Android_watch_magpie    文件:AddValueFragment.java   
private SingleValue newSingleValueInstance(TextInputLayout textInputLayout, EditText dateEditText,
                                           EditText timeEditText) {
    String valueString = textInputLayout.getEditText().getText().toString();
    double value = Double.valueOf(valueString);
    long timestamp = convertDateTimeToTimestamp(dateEditText, timeEditText);
    SingleValue singleValue = new SingleValue();
    singleValue.setValue(value);
    singleValue.setTimestamp(timestamp);
    singleValue.setType(type);
    singleValue.setMarked(false);
    return singleValue;
}
项目:RLibrary    文件:ExEditText.java   
/**
 * 返回结果表示是否为空
 */
public boolean checkEmpty(boolean checkPhone) {
    if (isEmpty()) {
        error();
        requestFocus();
        if (!isSoftKeyboardShow()) {
            if (getParent() instanceof FrameLayout &&
                    getParent().getParent() instanceof TextInputLayout) {
                postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        RSoftInputLayout.showSoftInput(ExEditText.this);
                    }
                }, 200);
            } else {
                RSoftInputLayout.showSoftInput(ExEditText.this);
            }
        }
        return true;
    }
    if (checkPhone) {
        if (isPhone()) {

        } else {
            error();
            requestFocus();
            return true;
        }
    }
    return false;
}
项目:GSB-2017-Android    文件:AjouteBranchActivity.java   
private void setupViews() {
    textInput_nom      = (TextInputLayout) findViewById(R.id.textInput_branch_nom);
    textInput_addresse = (TextInputLayout) findViewById(R.id.textInput_branch_adr);
    textInput_tel      = (TextInputLayout) findViewById(R.id.textInput_Tel);
    Button button_ajouter = (Button) findViewById(R.id.button_ajouter);
    button_ajouter.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(!checkFields())
                Toast.makeText(AjouteBranchActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
            else
                addBranch();
        }
    });
}
项目:data-binding-validator    文件:EditTextHandler.java   
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);
    }
}
项目:Android-skin-support    文件:SkinMaterialTextInputLayout.java   
private TextView getErrorView() {
    try {
        Field errorView = TextInputLayout.class.getDeclaredField("mErrorView");
        errorView.setAccessible(true);
        return (TextView) errorView.get(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
项目:MADBike    文件:LoginActivity.java   
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;
}
项目:SocEltech    文件:QuestionFragment.java   
public void addAnswer(String answer) {
    TextInputLayout textInputLayout = createTextInputLayout();
    EditText editText = createEditText();
    editText.setText(answer);
    textInputLayout.addView(editText);
    inputLayout.addView(textInputLayout);
}
项目:MADBike    文件:ProfileActivity.java   
private boolean checkEquals(EditText newEditText, EditText repeatEditText, TextInputLayout repeatInputLayout) {
    if (newEditText.getText().toString().contentEquals(repeatEditText.getText().toString())) {
        return true;
    } else {
        setErrorStyle(repeatEditText, repeatInputLayout, R.string.error_not_equals);
        return false;
    }
}
项目:MADBike    文件:ProfileActivity.java   
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;
}
项目:Sistema-de-Comercializacion-Negocios-Jhordan    文件:ChangePasswordDialog.java   
private void initViews(View v) {

        mEtOldPassword = (EditText) v.findViewById(R.id.et_old_password);
        mEtNewPassword = (EditText) v.findViewById(R.id.et_new_password);
        mTiOldPassword = (TextInputLayout) v.findViewById(R.id.ti_old_password);
        mTiNewPassword = (TextInputLayout) v.findViewById(R.id.ti_new_password);
        mTvMessage = (TextView) v.findViewById(R.id.tv_message);
        mBtChangePassword = (Button) v.findViewById(R.id.btn_change_password);
        mBtCancel = (Button) v.findViewById(R.id.btn_cancel);
        mProgressBar = (ProgressBar) v.findViewById(R.id.progress);

        mBtChangePassword.setOnClickListener(view -> changePassword());
        mBtCancel.setOnClickListener(view -> dismiss());
    }
项目:AnimatedPieView    文件:PopupSetting.java   
private long getTextLong(TextInputLayout v, long defaultValue) {
    try {
        long value = Long.parseLong(v.getEditText().getText().toString().trim());
        return value;
    } catch (Exception e) {
        return defaultValue;
    }
}
项目:Android-skin-support    文件:SkinMaterialTextInputLayout.java   
private TextView getCounterView() {
    try {
        Field counterView = TextInputLayout.class.getDeclaredField("mCounterView");
        counterView.setAccessible(true);
        return (TextView) counterView.get(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
项目:africastalking-android    文件:Cuhn.java   
private void disableAllFields() {
    TextInputLayout allFields[] = {pinInputLayout, cvvInputLayout, cardNumber, expiryInputLayout};
    for (TextInputLayout field : allFields) {
        field.setEnabled(false);
        field.setErrorEnabled(false);
    }
    Arrays.fill(allFields, null);
}
项目:civify-app    文件:CreateIssueActivity.java   
public void titleButtonListener(View v) {
    EditText title = (EditText) findViewById(R.id.title_input);
    TextInputLayout titleLayout = (TextInputLayout) findViewById(R.id.title_input_layout);
    if (title.getText().length() == 0) {
        titleLayout.setError(getString(R.string.must_insert_issue_title));
    } else {
        title.setError(null);
        mTitle = title.getText().toString();
        nextPage();
    }
}
项目:TextFieldBoxes    文件:TextInputAutoCompleteTextView.java   
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    final InputConnection ic = super.onCreateInputConnection(outAttrs);
    if (ic != null && outAttrs.hintText == null) {
        // If we don't have a hint and our parent is a TextInputLayout, use it's hint for the
        // EditorInfo. This allows us to display a hint in 'extract mode'.
        final ViewParent parent = getParent();
        if (parent instanceof TextInputLayout) {
            outAttrs.hintText = ((TextInputLayout) parent).getHint();
        }
    }
    return ic;
}
项目:MaterialDesignDemo    文件:TextInputLayoutActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_text_input_layout);
    mTextInputLayout = (TextInputLayout) findViewById(R.id.textInputLayout);

    //开启计数
    mTextInputLayout.setCounterEnabled(true);
    mTextInputLayout.setCounterMaxLength(6);

    //定义错误提示
    mTextInputLayout.getEditText().addTextChangedListener(new MyTextWatch(mTextInputLayout, "长度不能超过6个字符"));
}
项目:iSPY    文件:InputValidation.java   
/**
 * 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;
}