Java Code Examples for android.support.design.widget.TextInputLayout#getEditText()
The following examples show how to use
android.support.design.widget.TextInputLayout#getEditText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java From openshop.io-android with MIT License | 6 votes |
/** * 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; } }
Example 2
Source File: SavePlaylistDialog.java From VCL-Android with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: InsertHelper.java From ForPDA with GNU General Public License v3.0 | 5 votes |
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); } }
Example 4
Source File: Utils.java From openshop.io-android with MIT License | 5 votes |
/** * 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"); } }
Example 5
Source File: Utils.java From openshop.io-android with MIT License | 5 votes |
/** * 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; } }
Example 6
Source File: TextInputLayout_Activity.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
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(); }
Example 7
Source File: StringUtil.java From timecat with Apache License 2.0 | 4 votes |
public static String toString(@NonNull TextInputLayout textInputLayout) { return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : ""; }
Example 8
Source File: InputHelper.java From WanAndroid with GNU General Public License v3.0 | 4 votes |
public static String toString(@NonNull TextInputLayout textInputLayout) { return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : ""; }
Example 9
Source File: InputHelper.java From mvvm-template with GNU General Public License v3.0 | 4 votes |
public static String toString(@NonNull TextInputLayout textInputLayout) { return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : ""; }
Example 10
Source File: InputHelper.java From mvvm-template with GNU General Public License v3.0 | 4 votes |
public static String toString(@NonNull TextInputLayout textInputLayout) { return textInputLayout.getEditText() != null ? toString(textInputLayout.getEditText()) : ""; }
Example 11
Source File: VerifyPhoneDialog.java From AccountBook with GNU General Public License v3.0 | 4 votes |
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(); }
Example 12
Source File: LoginDialogFragment.java From openshop.io-android with MIT License | 4 votes |
/** * 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; } } } }