android.support.design.widget.TextInputLayout#getEditText ( )源码实例Demo

下面列出了android.support.design.widget.TextInputLayout#getEditText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openshop.io-android   文件: Utils.java
/**
 * Method checks if text input layout exist and contains some value.
 * If layout is empty, then show error value under the textInputLayout.
 *
 * @param textInputLayout textInputFiled for check.
 * @param errorValue      value displayed when ext input is empty.
 * @return true if everything ok.
 */
public static boolean checkTextInputLayoutValueRequirement(TextInputLayout textInputLayout, String errorValue) {
    if (textInputLayout != null && textInputLayout.getEditText() != null) {
        String text = Utils.getTextFromInputLayout(textInputLayout);
        if (text == null || text.isEmpty()) {
            textInputLayout.setErrorEnabled(true);
            textInputLayout.setError(errorValue);
            Timber.d("Input field %s missing text.", textInputLayout.getHint());
            return false;
        } else {
            textInputLayout.setErrorEnabled(false);
            Timber.d("Input field: %s OK.", textInputLayout.getHint());
            return true;
        }
    } else {
        Timber.e(new RuntimeException(), "Checking null input field during order send.");
        return false;
    }
}
 
源代码2 项目: VCL-Android   文件: SavePlaylistDialog.java
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dialog_playlist, container);

    mListView = (ListView) view.findViewById(android.R.id.list);
    mSaveButton = (Button) view.findViewById(R.id.dialog_playlist_save);
    mEmptyView = (TextView) view.findViewById(android.R.id.empty);
    TextInputLayout mLayout = (TextInputLayout)view.findViewById(R.id.dialog_playlist_name);
    mLayout.setHint(getString(R.string.playlist_name_hint));
    mEditText = mLayout.getEditText();
    mListView.setOnItemClickListener(this);
    mSaveButton.setOnClickListener(this);

    mEditText.setOnEditorActionListener(this);
    mListView.setEmptyView(mEmptyView);
    mListView.setAdapter(mAdapter);
    return view;
}
 
源代码3 项目: ForPDA   文件: InsertHelper.java
public void setBody(String title, String value) {
    if (true) {
        this.body = new Pair<>(title, value);
        TextInputLayout inputLayout = (TextInputLayout) inflater.inflate(R.layout.insert_helper_item, null);
        inputLayout.setHint(title);
        TextView textView = (TextView) inputLayout.findViewById(R.id.insert_helper_item_text);
        textView.setText(value);
        bodyLayout = inputLayout.getEditText();
        itemsContainer.addView(inputLayout);
    }

}
 
源代码4 项目: openshop.io-android   文件: Utils.java
/**
 * Check if textInputLayout contains editText view. If so, then set text value to the view.
 *
 * @param textInputLayout wrapper for the editText view where the text value should be set.
 * @param text            text value to display.
 */
public static void setTextToInputLayout(TextInputLayout textInputLayout, String text) {
    if (textInputLayout != null && textInputLayout.getEditText() != null) {
        textInputLayout.getEditText().setText(text);
    } else {
        Timber.e("Setting text to null input wrapper, or without editText");
    }
}
 
源代码5 项目: openshop.io-android   文件: Utils.java
/**
 * Check if textInputLayout contains editText view. If so, then return text value of the view.
 *
 * @param textInputLayout wrapper for the editText view.
 * @return text value of the editText view.
 */
public static String getTextFromInputLayout(TextInputLayout textInputLayout) {
    if (textInputLayout != null && textInputLayout.getEditText() != null) {
        return textInputLayout.getEditText().getText().toString();
    } else {
        return null;
    }
}
 
private void setupView() {
        account = (TextInputLayout) findViewById(R.id.textinput_account);
        password = (TextInputLayout) findViewById(R.id.textinput_password);

        //可以在代码设置hint属性,即使xml的edittext控件定义了hint属性。也只会显示java代码定义的hint属性
//        account.setHint("RealMo");

        //获取TextInputLayout下的输入框
        et_account = account.getEditText();
        et_password =password.getEditText();

    }
 
源代码7 项目: timecat   文件: StringUtil.java
public static String toString(@NonNull TextInputLayout textInputLayout) {
    return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : "";
}
 
源代码8 项目: WanAndroid   文件: InputHelper.java
public static String toString(@NonNull TextInputLayout textInputLayout) {
    return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : "";
}
 
源代码9 项目: mvvm-template   文件: InputHelper.java
public static String toString(@NonNull TextInputLayout textInputLayout) {
    return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : "";
}
 
源代码10 项目: mvvm-template   文件: InputHelper.java
public static String toString(@NonNull TextInputLayout textInputLayout) {
    return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : "";
}
 
源代码11 项目: AccountBook   文件: VerifyPhoneDialog.java
public VerifyPhoneDialog(Context context) {
    mContentView = LayoutInflater.from(context).inflate(R.layout.dialog_verify_phone, null);
    TextInputLayout tilCode = (TextInputLayout) mContentView.findViewById(R.id.til_code);
    if (tilCode.getEditText() == null) return;
    mEdtCode = tilCode.getEditText();
}
 
源代码12 项目: openshop.io-android   文件: LoginDialogFragment.java
/**
 * Check if editTexts are valid view and if user set all required fields.
 *
 * @return true if ok.
 */
private boolean isRequiredFields(TextInputLayout emailWrapper, TextInputLayout passwordWrapper) {
    if (emailWrapper == null || passwordWrapper == null) {
        Timber.e(new RuntimeException(), "Called isRequiredFields with null parameters.");
        MsgUtils.showToast(getActivity(), MsgUtils.TOAST_TYPE_INTERNAL_ERROR, null, MsgUtils.ToastLength.LONG);
        return false;
    } else {
        EditText email = emailWrapper.getEditText();
        EditText password = passwordWrapper.getEditText();
        if (email == null || password == null) {
            Timber.e(new RuntimeException(), "Called isRequiredFields with null editTexts in wrappers.");
            MsgUtils.showToast(getActivity(), MsgUtils.TOAST_TYPE_INTERNAL_ERROR, null, MsgUtils.ToastLength.LONG);
            return false;
        } else {
            boolean isEmail = false;
            boolean isPassword = false;

            if (email.getText().toString().equalsIgnoreCase("")) {
                emailWrapper.setErrorEnabled(true);
                emailWrapper.setError(getString(R.string.Required_field));
            } else {
                emailWrapper.setErrorEnabled(false);
                isEmail = true;
            }

            if (password.getText().toString().equalsIgnoreCase("")) {
                passwordWrapper.setErrorEnabled(true);
                passwordWrapper.setError(getString(R.string.Required_field));
            } else {
                passwordWrapper.setErrorEnabled(false);
                isPassword = true;
            }

            if (isEmail && isPassword) {
                return true;
            } else {
                Timber.e("Some fields are required.");
                return false;
            }
        }
    }
}