@Override public boolean onTouchEvent(MotionEvent event) { if((mTouchEventInterceptor != null) && mTouchEventInterceptor.onTouch(this, event)) { return true; } return super.onTouchEvent(event); }
@Override protected void refresh() { super.refresh(); if (mTextView != null && mTitleText != null) { mTextView.setText(mTitleText); } if (mEditTextView != null) { if (mHintText != null) { mEditTextView.setHint(mHintText); } if (mInputType != 0) { mEditTextView.setInputType(mInputType); } if (mText != null) { mEditTextView.setText(mText); mEditTextView.setSelection(mText.length()); } } } }
private void performReplyComment(int position) { String currentMessage = mBinding.reviewInfo.reviewComment.getText().toString(); String replyMessage = mMessageAdapter.getMessage(position); String msg = StringHelper.quoteMessage(currentMessage, replyMessage); mBinding.reviewInfo.reviewComment.setText(msg); mBinding.reviewInfo.reviewComment.setSelection(msg.length()); mBinding.nestedScroll.fullScroll(View.FOCUS_DOWN); }
layout.setPadding(padding, padding, padding, padding); final AppCompatEditText editText = new AppCompatEditText(context); editText.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); if (text != null) { editText.append(text); editText.setHint(hint); editText.setSingleLine(true); final AppCompatEditText editText2 = new AppCompatEditText(context); editText2.setLayoutParams(new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); if (text2 != null) { editText2.setText(text2); editText2.setHint(hint2); editText2.setSingleLine(true); .setPositiveButton(context.getString(R.string.ok), (dialog1, which) -> onDialogEditTextListener.onClick( editText.getText().toString(), editText2.getText().toString())) .setOnDismissListener(dialog1 -> { if (negativeListener != null) {
layout.setPadding(padding, padding, padding, padding); final AppCompatEditText editText = new AppCompatEditText(context); editText.setGravity(Gravity.CENTER); editText.setLayoutParams(new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); if (text != null) { editText.append(text); editText.setSingleLine(true); if (inputType >= 0) { editText.setInputType(inputType); -> onDialogEditTextListener.onClick(editText.getText().toString())) .setOnDismissListener(dialog1 -> { if (negativeListener != null) {
final AppCompatEditText oldPassword = new AppCompatEditText(getActivity()); if (!oldPass.isEmpty()) { oldPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); oldPassword.setHint(getString(R.string.old_password)); linearLayout.addView(oldPassword); final AppCompatEditText newPassword = new AppCompatEditText(getActivity()); newPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); newPassword.setHint(getString(R.string.new_password)); linearLayout.addView(newPassword); final AppCompatEditText confirmNewPassword = new AppCompatEditText(getActivity()); confirmNewPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); confirmNewPassword.setHint(getString(R.string.confirm_new_password)); linearLayout.addView(confirmNewPassword); }) .setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> { if (!oldPass.isEmpty() && !oldPassword.getText().toString().equals(Utils .decodeString(oldPass))) { Utils.toast(getString(R.string.old_password_wrong), getActivity()); if (newPassword.getText().toString().isEmpty()) { Utils.toast(getString(R.string.password_empty), getActivity()); return; if (!newPassword.getText().toString().equals(confirmNewPassword.getText()
@Override public void setText(CharSequence text, BufferType type) { mSettingText = true; super.setText(text, type); mSettingText = false; }
@Override protected void onSelectionChanged(int selStart, int selEnd) { super.onSelectionChanged(selStart, selEnd); int minSelPos = mTagList.size(); if (selStart < minSelPos) { setSelection(minSelPos); } }
public CharSequence getText() { return mEditTextView == null ? null : mEditTextView.getText(); }
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); mTouchEventInterceptor = null; }
@Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { showClearIcon( (!mClearIconDrawWhenFocused || focused) && !TextUtils.isEmpty(getText().toString())); super.onFocusChanged(focused, direction, previouslyFocusedRect); }
AppCompatEditText valueEdit = rootView.findViewById(R.id.value_edittext); keyEdit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { valueEdit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { keyEdit.append(buildpropFragment.mKeyText); valueEdit.append(buildpropFragment.mKeyText);
@Override protected void init(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) { super.init(context, attrs, defStyleAttr, defStyleRes); mEditText = new AppCompatEditText(context, attrs); // Give it an ID so it can be saved/restored mEditText.setId(android.R.id.edit); /* * The preference framework and view framework both have an 'enabled' * attribute. Most likely, the 'enabled' specified in this XML is for * the preference framework, but it was also given to the view framework. * We reset the enabled state. */ mEditText.setEnabled(true); setDialogLayoutResource(R.layout.mpl__edittext_dialog_preference); }
@Override public void onCreateView(View view) { mTextView = view.findViewById(R.id.title); mEditTextView = view.findViewById(R.id.edittext); mEditTextView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { if (mTextWatcher != null) { mTextWatcher.beforeTextChanged(s, start, count, after); } } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (mTextWatcher != null) { mTextWatcher.onTextChanged(s, start, before, count); } } @Override public void afterTextChanged(Editable s) { if (mTextWatcher != null) { mTextWatcher.afterTextChanged(s); } mText = s; } }); super.onCreateView(view); }
private void deletePasswordDialog(final String password) { if (password.isEmpty()) { Utils.toast(getString(R.string.set_password_first), getActivity()); return; } mDeletePassword = password; LinearLayout linearLayout = new LinearLayout(getActivity()); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.setGravity(Gravity.CENTER); int padding = Math.round(getResources().getDimension(R.dimen.dialog_padding)); linearLayout.setPadding(padding, padding, padding, padding); final AppCompatEditText mPassword = new AppCompatEditText(getActivity()); mPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); mPassword.setHint(getString(R.string.password)); linearLayout.addView(mPassword); new Dialog(getActivity()).setView(linearLayout) .setPositiveButton(getString(R.string.ok), (dialogInterface, i) -> { if (!mPassword.getText().toString().equals(Utils.decodeString(password))) { Utils.toast(getString(R.string.password_wrong), getActivity()); return; } AppSettings.resetPassword(getActivity()); if (mFingerprint != null) { mFingerprint.setEnabled(false); } }) .setOnDismissListener(dialogInterface -> mDeletePassword = null).show(); }
@Override public void setText(CharSequence text, BufferType type) { super.setText(text, type); createPasswordSpans(); }
@Override protected void onSelectionChanged(int selStart, int selEnd) { super.onSelectionChanged(selStart, selEnd); if (mFormatBar != null) mFormatBar.updateFormattingAtCursor(); }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putCharSequence(EDITTEXT_INTENT, mEditText.getText()); }
@Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); // register for passage change events ABEventBus.getDefault().unregister(this); }
@Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { super.onFocusChanged(focused, direction, previouslyFocusedRect); if (focused) mFormatBar.setEditText(this); else mFormatBar.setEditText(null); }