Java Code Examples for android.widget.EditText#getParent()

The following examples show how to use android.widget.EditText#getParent() . 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: EditTextPreference.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    EditText editText = mEditText;
    editText.setText(getText());
    
    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null) {
            ((ViewGroup) oldParent).removeView(editText);
        }
        onAddEditTextToDialogView(view, editText);
    }
}
 
Example 2
Source File: EditTexts.java    From convalida with Apache License 2.0 5 votes vote down vote up
private static TextInputLayout getTextInputLayout(EditText editText) {
    ViewParent parent = editText.getParent();

    while (parent instanceof View) {
        if (parent instanceof TextInputLayout) {
            return (TextInputLayout) parent;
        }
        parent = parent.getParent();
    }

    return null;
}
 
Example 3
Source File: AutocompleteTextPreference.java    From habpanelviewer with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("MissingSuperCall")
@Override
protected void onBindDialogView(View view) {
    EditText editText = mTextView;
    editText.setText(getText());

    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null) {
            ((ViewGroup) oldParent).removeView(editText);
        }
        onAddEditTextToDialogView(view, editText);
    }
}
 
Example 4
Source File: MaterialEditTextPreference.java    From talk-android with MIT License 5 votes vote down vote up
@Override
protected void onBindDialogView(@NonNull View view) {
    EditText editText = mEditText;
    editText.setText(getText());
    // Initialize cursor to end of text
    if (editText.getText().length() > 0)
        editText.setSelection(editText.length());
    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null)
            ((ViewGroup) oldParent).removeView(editText);
        onAddEditTextToDialogView(view, editText);
    }
}
 
Example 5
Source File: MaterialEditTextPreference.java    From 920-text-editor-v2 with Apache License 2.0 5 votes vote down vote up
@SuppressLint("MissingSuperCall")
@Override
protected void onBindDialogView(@NonNull View view) {
    EditText editText = mEditText;
    editText.setText(getText());
    // Initialize cursor to end of text
    if (editText.getText().length() > 0)
        editText.setSelection(editText.length());
    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null)
            ((ViewGroup) oldParent).removeView(editText);
        onAddEditTextToDialogView(view, editText);
    }
}
 
Example 6
Source File: LoginActivity.java    From KUAS-AP-Material with MIT License 5 votes vote down vote up
private void findViews() {
	mIdEditText = (EditText) findViewById(R.id.editText_id);
	mIdTextInputLayout = (TextInputLayout) mIdEditText.getParent();
	mPasswordEditText = (EditText) findViewById(R.id.editText_password);
	mPasswordTextInputLayout = (TextInputLayout) mPasswordEditText.getParent();

	dot_ap = (ImageView) findViewById(R.id.dot_ap);
	dot_leave = (ImageView) findViewById(R.id.dot_leave);
	dot_bus = (ImageView) findViewById(R.id.dot_bus);

	mVersionTextView = (TextView) findViewById(R.id.textView_version);
	mRememberCheckBox = (CheckBox) findViewById(R.id.checkbox_remember);

	mLoginButton = (Button) findViewById(R.id.button_login);
}
 
Example 7
Source File: EditTextPreferenceCompat.java    From MaterialPreferenceCompat with MIT License 5 votes vote down vote up
@Override
protected void onAddEditTextToDialogView(@NonNull View view, @NonNull EditText editText) {
	if (editText.getParent() != null) {
		((ViewGroup) mEditText.getParent()).removeView(editText);
	}
	((ViewGroup) view).addView(
			editText,
			new LinearLayout.LayoutParams(
					ViewGroup.LayoutParams.MATCH_PARENT,
					ViewGroup.LayoutParams.WRAP_CONTENT
			)
	);
}
 
Example 8
Source File: EditTextPreference.java    From MaterialPreferenceLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    EditText editText = mEditText;
    editText.setText(getText());

    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null) {
            ((ViewGroup) oldParent).removeView(editText);
        }
        onAddEditTextToDialogView(view, editText);
    }
}
 
Example 9
Source File: ConversationActivity.java    From Atomic with GNU General Public License v3.0 5 votes vote down vote up
private void setupColors() {
  if( settings.tintActionbar() ) {
    // the ActionBar can be tinted. This is really cool.
    // Get the ActionBar
    ActionBar ab = getSupportActionBar();
    // Make its background drawable a ColorDrawable
    ab.setBackgroundDrawable(new ColorDrawable(_scheme.getBackground()));

    _mainToolbar.setBackgroundColor(_scheme.getBackground());

    // Create a SpannableString from the current server.
    SpannableString st = new SpannableString(server.getTitle());
    // Make its forground color (through a ForgroundColorSpan) to be the
    // foreground of the scheme.
    // This is because you can't guarantee that the ActionBar text color and
    // actionbar color aren't going to be the same.
    st.setSpan(new ForegroundColorSpan(_scheme.getForeground()),
        0, st.length(), SpannableString.SPAN_INCLUSIVE_INCLUSIVE);
    // Now, set our spannable to be the ActionBar title.
    _mainToolbar.setTitle(st);
  } else {
    (getSupportActionBar()).setTitle(server.getTitle());
  }
  EditText input = (EditText)findViewById(R.id.input);
  LinearLayout lll = (LinearLayout)(input.getParent());
  lll.setBackgroundColor(_scheme.getBackground());

  input.setTextColor(_scheme.getForeground());

}