/** * Convenience for {@link android.text.Selection#selectAll}. */ public void selectAll (){ mInputView.selectAll(); }
/** * Set comment text * * @return text */ public void setText(String comment) { if (commentText != null) { commentText.setText(comment); commentText.selectAll(); } else { initComment = comment; } } }
@Test public void testSelectAll() { EditText editText = new EditText(context); editText.setText("foo"); editText.selectAll(); assertThat(editText.getSelectionStart()).isEqualTo(0); assertThat(editText.getSelectionEnd()).isEqualTo(3); }
@Override public void onClick(View view) { editText.selectAll(); } });
public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { mInputText.selectAll(); } else { mInputText.setSelection(0, 0); validateInputTextView(v); } } });
public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { mInputText.selectAll(); } else { mInputText.setSelection(0, 0); validateInputTextView(v); } } });
@Override public void onAutofillDataAvailable(String username, String password) { mUsernameView.setText(username); mPasswordView.setText(password); mUsernameView.selectAll(); } }
protected void onPostExecute(Integer messageCode) { progressDialog.dismiss(); if (messageCode != null) { Toast.makeText(ChangeMasterPassword.this, messageCode, Toast.LENGTH_SHORT).show(); if (messageCode == R.string.invalid_password) { // Set focus back to the password and select all characters existingPassword.requestFocus(); existingPassword.selectAll(); } } }
@Override public void focus() { if (isAdded()) { mCardCVVView.selectAll(); } }
@Override public void focus() { if(isAdded()) { mCardNameView.selectAll(); } } }
@Override public void focus() { if(isAdded()) { cardExpiryView.selectAll(); } }
@Override public void focus() { if (isAdded()) { mCardNumberView.selectAll(); } } }
@Override protected void onResume() { mBodyText.requestFocus(); mBodyText.selectAll(); super.onResume(); } }
@Override public void onClick(View button) { float newValue = validateAndGetInput(view); if (newValue < 0) { return; } if (button.getId() == R.id.btn_inc) { newValue += INC_DEC_DELTA; } else { newValue -= INC_DEC_DELTA; } input.setText(formatValue(clampValue(newValue))); input.selectAll(); } };
@Override public void showInvalidURLSnackbar(String message) { createSnackbar(message) .setAction(getResources().getString(R.string.snackbar_edit), view -> { mUrl.requestFocus(); mUrl.selectAll(); }) .show(); }
private void updateControls(final int viewIndex, final boolean updateBar) { final SeekBar seekbar = (SeekBar) findViewById(R.id.seekbar); final EditText editText = (EditText) findViewById(R.id.pageNumberTextEdit); editText.setText("" + (viewIndex + offset)); editText.selectAll(); if (updateBar) { seekbar.setProgress(viewIndex); } current = null; }
@Override protected void prepare(ViewGroup layout) { super.prepare(layout); EditText prompt = (EditText) layout.findViewById(R.id.js_modal_dialog_prompt); prompt.setVisibility(View.VISIBLE); if (mDefaultPromptText.length() > 0) { prompt.setText(mDefaultPromptText); prompt.selectAll(); } } }
@Override public void showInvalidLoginOrPasswordSnackbar() { String message = getResources().getString(R.string.invalid_login_or_password_message); createSnackbar(message) .setAction(getResources().getString(R.string.snackbar_edit), view -> { mPassword.requestFocus(); mPassword.selectAll(); }) .show(); }
@Override public void onDialogReveled() { super.onDialogReveled(); EditText v = mBinding.project; v.clearFocus(); v.requestFocus(); v.selectAll(); }
@Override public void onDialogReveled() { super.onDialogReveled(); EditText v = mModel.mode.equals(MODE.RENAME) && mBinding.edit1.isEnabled() ? mBinding.edit1 : mBinding.edit2; v.clearFocus(); v.requestFocus(); v.selectAll(); }