@@ -397,7 +397,7 @@ static class Drawables {
397397
398398 /**
399399 * EditText specific data, created on demand when one of the Editor fields is used.
400- * See {@link #createEditorIfNeeded(String )}.
400+ * See {@link #createEditorIfNeeded()}.
401401 */
402402 private Editor mEditor ;
403403
@@ -798,20 +798,20 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
798798 break ;
799799
800800 case com .android .internal .R .styleable .TextView_imeOptions :
801- createEditorIfNeeded ("IME options specified in constructor" );
801+ createEditorIfNeeded ();
802802 mEditor .createInputContentTypeIfNeeded ();
803803 mEditor .mInputContentType .imeOptions = a .getInt (attr ,
804804 mEditor .mInputContentType .imeOptions );
805805 break ;
806806
807807 case com .android .internal .R .styleable .TextView_imeActionLabel :
808- createEditorIfNeeded ("IME action label specified in constructor" );
808+ createEditorIfNeeded ();
809809 mEditor .createInputContentTypeIfNeeded ();
810810 mEditor .mInputContentType .imeActionLabel = a .getText (attr );
811811 break ;
812812
813813 case com .android .internal .R .styleable .TextView_imeActionId :
814- createEditorIfNeeded ("IME action id specified in constructor" );
814+ createEditorIfNeeded ();
815815 mEditor .createInputContentTypeIfNeeded ();
816816 mEditor .mInputContentType .imeActionId = a .getInt (attr ,
817817 mEditor .mInputContentType .imeActionId );
@@ -883,7 +883,7 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
883883 }
884884
885885 try {
886- createEditorIfNeeded ("inputMethod in ctor" );
886+ createEditorIfNeeded ();
887887 mEditor .mKeyListener = (KeyListener ) c .newInstance ();
888888 } catch (InstantiationException ex ) {
889889 throw new RuntimeException (ex );
@@ -898,7 +898,7 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
898898 mEditor .mInputType = EditorInfo .TYPE_CLASS_TEXT ;
899899 }
900900 } else if (digits != null ) {
901- createEditorIfNeeded ("digits in ctor" );
901+ createEditorIfNeeded ();
902902 mEditor .mKeyListener = DigitsKeyListener .getInstance (digits .toString ());
903903 // If no input type was specified, we will default to generic
904904 // text, since we can't tell the IME about the set of digits
@@ -910,11 +910,11 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
910910 // If set, the input type overrides what was set using the deprecated singleLine flag.
911911 singleLine = !isMultilineInputType (inputType );
912912 } else if (phone ) {
913- createEditorIfNeeded ("dialer in ctor" );
913+ createEditorIfNeeded ();
914914 mEditor .mKeyListener = DialerKeyListener .getInstance ();
915915 mEditor .mInputType = inputType = EditorInfo .TYPE_CLASS_PHONE ;
916916 } else if (numeric != 0 ) {
917- createEditorIfNeeded ("numeric in ctor" );
917+ createEditorIfNeeded ();
918918 mEditor .mKeyListener = DigitsKeyListener .getInstance ((numeric & SIGNED ) != 0 ,
919919 (numeric & DECIMAL ) != 0 );
920920 inputType = EditorInfo .TYPE_CLASS_NUMBER ;
@@ -951,7 +951,7 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
951951 break ;
952952 }
953953
954- createEditorIfNeeded ("text input in ctor" );
954+ createEditorIfNeeded ();
955955 mEditor .mKeyListener = TextKeyListener .getInstance (autotext , cap );
956956 mEditor .mInputType = inputType ;
957957 } else if (isTextSelectable ()) {
@@ -964,7 +964,7 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
964964 // So that selection can be changed using arrow keys and touch is handled.
965965 setMovementMethod (ArrowKeyMovementMethod .getInstance ());
966966 } else if (editable ) {
967- createEditorIfNeeded ("editable input in ctor" );
967+ createEditorIfNeeded ();
968968 mEditor .mKeyListener = TextKeyListener .getInstance ();
969969 mEditor .mInputType = EditorInfo .TYPE_CLASS_TEXT ;
970970 } else {
@@ -987,7 +987,7 @@ public TextView(Context context, AttributeSet attrs, int defStyle) {
987987 webPasswordInputType , numberPasswordInputType );
988988
989989 if (selectallonfocus ) {
990- createEditorIfNeeded ("selectallonfocus in constructor" );
990+ createEditorIfNeeded ();
991991 mEditor .mSelectAllOnFocus = true ;
992992
993993 if (bufferType == BufferType .NORMAL )
@@ -1335,7 +1335,7 @@ public void setKeyListener(KeyListener input) {
13351335 fixFocusableAndClickableSettings ();
13361336
13371337 if (input != null ) {
1338- createEditorIfNeeded ("input is not null" );
1338+ createEditorIfNeeded ();
13391339 try {
13401340 mEditor .mInputType = mEditor .mKeyListener .getInputType ();
13411341 } catch (IncompatibleClassChangeError e ) {
@@ -1355,7 +1355,7 @@ public void setKeyListener(KeyListener input) {
13551355 private void setKeyListenerOnly (KeyListener input ) {
13561356 if (mEditor == null && input == null ) return ; // null is the default value
13571357
1358- createEditorIfNeeded ("setKeyListenerOnly" );
1358+ createEditorIfNeeded ();
13591359 if (mEditor .mKeyListener != input ) {
13601360 mEditor .mKeyListener = input ;
13611361 if (input != null && !(mText instanceof Editable )) {
@@ -2383,7 +2383,7 @@ public int getHighlightColor() {
23832383 */
23842384 @ android .view .RemotableViewMethod
23852385 public final void setShowSoftInputOnFocus (boolean show ) {
2386- createEditorIfNeeded ("setShowSoftInputOnFocus" );
2386+ createEditorIfNeeded ();
23872387 mEditor .mShowSoftInputOnFocus = show ;
23882388 }
23892389
@@ -3263,7 +3263,7 @@ public void onRestoreInstanceState(Parcelable state) {
32633263 Selection .setSelection ((Spannable ) mText , ss .selStart , ss .selEnd );
32643264
32653265 if (ss .frozenWithFocus ) {
3266- createEditorIfNeeded ("restore instance with focus" );
3266+ createEditorIfNeeded ();
32673267 mEditor .mFrozenWithFocus = true ;
32683268 }
32693269 }
@@ -3424,7 +3424,7 @@ private void setText(CharSequence text, BufferType type,
34243424
34253425 if (type == BufferType .EDITABLE || getKeyListener () != null ||
34263426 needEditableForNotification ) {
3427- createEditorIfNeeded ("setText with BufferType.EDITABLE or non null mInput" );
3427+ createEditorIfNeeded ();
34283428 Editable t = mEditableFactory .newEditable (text );
34293429 text = t ;
34303430 setFilters (t , mFilters );
@@ -3768,7 +3768,7 @@ private static boolean isVisiblePasswordInputType(int inputType) {
37683768 */
37693769 public void setRawInputType (int type ) {
37703770 if (type == InputType .TYPE_NULL && mEditor == null ) return ; //TYPE_NULL is the default value
3771- createEditorIfNeeded ("non null input type" );
3771+ createEditorIfNeeded ();
37723772 mEditor .mInputType = type ;
37733773 }
37743774
@@ -3811,7 +3811,7 @@ private void setInputType(int type, boolean direct) {
38113811 }
38123812 setRawInputType (type );
38133813 if (direct ) {
3814- createEditorIfNeeded ("setInputType" );
3814+ createEditorIfNeeded ();
38153815 mEditor .mKeyListener = input ;
38163816 } else {
38173817 setKeyListenerOnly (input );
@@ -3837,7 +3837,7 @@ public int getInputType() {
38373837 * @attr ref android.R.styleable#TextView_imeOptions
38383838 */
38393839 public void setImeOptions (int imeOptions ) {
3840- createEditorIfNeeded ("IME options specified" );
3840+ createEditorIfNeeded ();
38413841 mEditor .createInputContentTypeIfNeeded ();
38423842 mEditor .mInputContentType .imeOptions = imeOptions ;
38433843 }
@@ -3864,7 +3864,7 @@ public int getImeOptions() {
38643864 * @attr ref android.R.styleable#TextView_imeActionId
38653865 */
38663866 public void setImeActionLabel (CharSequence label , int actionId ) {
3867- createEditorIfNeeded ("IME action label specified" );
3867+ createEditorIfNeeded ();
38683868 mEditor .createInputContentTypeIfNeeded ();
38693869 mEditor .mInputContentType .imeActionLabel = label ;
38703870 mEditor .mInputContentType .imeActionId = actionId ;
@@ -3901,7 +3901,7 @@ public int getImeActionId() {
39013901 * modifier will, however, allow the user to insert a newline character.
39023902 */
39033903 public void setOnEditorActionListener (OnEditorActionListener l ) {
3904- createEditorIfNeeded ("Editor action listener set" );
3904+ createEditorIfNeeded ();
39053905 mEditor .createInputContentTypeIfNeeded ();
39063906 mEditor .mInputContentType .onEditorActionListener = l ;
39073907 }
@@ -3998,7 +3998,7 @@ public void onEditorAction(int actionCode) {
39983998 * @attr ref android.R.styleable#TextView_privateImeOptions
39993999 */
40004000 public void setPrivateImeOptions (String type ) {
4001- createEditorIfNeeded ("Private IME option set" );
4001+ createEditorIfNeeded ();
40024002 mEditor .createInputContentTypeIfNeeded ();
40034003 mEditor .mInputContentType .privateImeOptions = type ;
40044004 }
@@ -4026,7 +4026,7 @@ public String getPrivateImeOptions() {
40264026 * @attr ref android.R.styleable#TextView_editorExtras
40274027 */
40284028 public void setInputExtras (int xmlResId ) throws XmlPullParserException , IOException {
4029- createEditorIfNeeded ("Input extra set" );
4029+ createEditorIfNeeded ();
40304030 XmlResourceParser parser = getResources ().getXml (xmlResId );
40314031 mEditor .createInputContentTypeIfNeeded ();
40324032 mEditor .mInputContentType .extras = new Bundle ();
@@ -4045,7 +4045,7 @@ public void setInputExtras(int xmlResId) throws XmlPullParserException, IOExcept
40454045 */
40464046 public Bundle getInputExtras (boolean create ) {
40474047 if (mEditor == null && !create ) return null ;
4048- createEditorIfNeeded ("get Input extra" );
4048+ createEditorIfNeeded ();
40494049 if (mEditor .mInputContentType == null ) {
40504050 if (!create ) return null ;
40514051 mEditor .createInputContentTypeIfNeeded ();
@@ -4097,7 +4097,7 @@ public void setError(CharSequence error) {
40974097 * be cleared (and you should provide a <code>null</code> icon as well).
40984098 */
40994099 public void setError (CharSequence error , Drawable icon ) {
4100- createEditorIfNeeded ("setError" );
4100+ createEditorIfNeeded ();
41014101 mEditor .setError (error , icon );
41024102 }
41034103
@@ -4609,7 +4609,7 @@ public boolean isTextSelectable() {
46094609 public void setTextIsSelectable (boolean selectable ) {
46104610 if (!selectable && mEditor == null ) return ; // false is default value with no edit data
46114611
4612- createEditorIfNeeded ("setTextIsSelectable" );
4612+ createEditorIfNeeded ();
46134613 if (mEditor .mTextIsSelectable == selectable ) return ;
46144614
46154615 mEditor .mTextIsSelectable = selectable ;
@@ -5422,7 +5422,7 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
54225422 * @return Returns true if the text was successfully extracted, else false.
54235423 */
54245424 public boolean extractText (ExtractedTextRequest request , ExtractedText outText ) {
5425- createEditorIfNeeded ("extractText" );
5425+ createEditorIfNeeded ();
54265426 return mEditor .extractText (request , outText );
54275427 }
54285428
@@ -6836,7 +6836,7 @@ public TextUtils.TruncateAt getEllipsize() {
68366836 */
68376837 @ android .view .RemotableViewMethod
68386838 public void setSelectAllOnFocus (boolean selectAllOnFocus ) {
6839- createEditorIfNeeded ("setSelectAllOnFocus" );
6839+ createEditorIfNeeded ();
68406840 mEditor .mSelectAllOnFocus = selectAllOnFocus ;
68416841
68426842 if (selectAllOnFocus && !(mText instanceof Spannable )) {
@@ -6855,7 +6855,7 @@ public void setSelectAllOnFocus(boolean selectAllOnFocus) {
68556855 @ android .view .RemotableViewMethod
68566856 public void setCursorVisible (boolean visible ) {
68576857 if (visible && mEditor == null ) return ; // visible is the default value with no edit data
6858- createEditorIfNeeded ("setCursorVisible" );
6858+ createEditorIfNeeded ();
68596859 if (mEditor .mCursorVisible != visible ) {
68606860 mEditor .mCursorVisible = visible ;
68616861 invalidate ();
@@ -7914,7 +7914,7 @@ public boolean isSuggestionsEnabled() {
79147914 * that case, to allow for quick replacement.
79157915 */
79167916 public void setCustomSelectionActionModeCallback (ActionMode .Callback actionModeCallback ) {
7917- createEditorIfNeeded ("custom selection action mode set" );
7917+ createEditorIfNeeded ();
79187918 mEditor .mCustomSelectionActionModeCallback = actionModeCallback ;
79197919 }
79207920
@@ -8285,16 +8285,9 @@ protected void setCursorPosition_internal(int start, int end) {
82858285 * Also note that for performance reasons, the mEditor is created when needed, but not
82868286 * reset when no more edit-specific fields are needed.
82878287 */
8288- private void createEditorIfNeeded (String reason ) {
8288+ private void createEditorIfNeeded () {
82898289 if (mEditor == null ) {
8290- if (!(this instanceof EditText )) {
8291- Log .e (LOG_TAG + " EDITOR" , "Creating an Editor on a regular TextView. " + reason );
8292- }
82938290 mEditor = new Editor (this );
8294- } else {
8295- if (!(this instanceof EditText )) {
8296- Log .d (LOG_TAG + " EDITOR" , "Redundant Editor creation. " + reason );
8297- }
82988291 }
82998292 }
83008293
0 commit comments