/** * Like {@link #setText(CharSequence)}, * except that the cursor position (if any) is retained in the new text. * * @param text The new text to place in the text view. * * @see #setText(CharSequence) */ public final void setTextKeepState (CharSequence text){ mInputView.setTextKeepState(text); }
/** * Like {@link #setText(CharSequence, TextView.BufferType)}, * except that the cursor position (if any) is retained in the new text. * * @see #setText(CharSequence, TextView.BufferType) */ public final void setTextKeepState (CharSequence text, TextView.BufferType type){ mInputView.setTextKeepState(text, type); }
private void updateUrlBarText() { final String text = !mUrlBarHasFocus && !mLoading && mTitle != null ? mTitle : mUrl; mEditor.setTextKeepState(text != null ? text : ""); }
private void getNoteFromFile() { if (DEBUG) { Log.d(TAG, "file: " + mFileContent); } if (mFileContent == null) { // TODO mFileContent = "error"; mReadOnly = true; } mText.setTextKeepState(mFileContent); // keep state does not work, so we have to do it manually: try { mText.setSelection(mSelectionStart, mSelectionStop); } catch (IndexOutOfBoundsException e) { // Then let's not adjust the selection. } // If we hadn't previously retrieved the original text, do so // now. This allows the user to revert their changes. if (mOriginalContent == null) { mOriginalContent = mFileContent; } updateTitleSdCard(); }
/** * Reverts to the original text, or undoes revert. */ private final void revertNote() { if (mCursor != null) { String tmp = mText.getText().toString(); mText.setAutoLinkMask(0); if (!tmp.equals(mOriginalContent)) { // revert to original content mText.setTextKeepState(mOriginalContent); mUndoRevert = tmp; } else if (mUndoRevert != null) { // revert to original content mText.setTextKeepState(mUndoRevert); mUndoRevert = null; } int autolink = PreferenceActivity.getAutoLinkFromPreference(this); mText.setAutoLinkMask(autolink); } // mCursor.requery(); // setResult(RESULT_CANCELED); // finish(); }
mText.setTextKeepState(newNote);
mText.setTextKeepState(note); ); mText.setTextKeepState(mDecryptedText);