@@ -461,10 +461,6 @@ public TextView(Context context,
461461 mMovement = getDefaultMovementMethod ();
462462 mTransformation = null ;
463463
464- TypedArray a =
465- context .obtainStyledAttributes (
466- attrs , com .android .internal .R .styleable .TextView , defStyle , 0 );
467-
468464 int textColorHighlight = 0 ;
469465 ColorStateList textColor = null ;
470466 ColorStateList textColorHint = null ;
@@ -474,18 +470,23 @@ public TextView(Context context,
474470 int styleIndex = -1 ;
475471 boolean allCaps = false ;
476472
473+ final Resources .Theme theme = context .getTheme ();
474+
477475 /*
478476 * Look the appearance up without checking first if it exists because
479477 * almost every TextView has one and it greatly simplifies the logic
480478 * to be able to parse the appearance first and then let specific tags
481479 * for this View override it.
482480 */
481+ TypedArray a = theme .obtainStyledAttributes (
482+ attrs , com .android .internal .R .styleable .TextViewAppearance , defStyle , 0 );
483483 TypedArray appearance = null ;
484- int ap = a .getResourceId (com .android .internal .R .styleable .TextView_textAppearance , -1 );
484+ int ap = a .getResourceId (
485+ com .android .internal .R .styleable .TextViewAppearance_textAppearance , -1 );
486+ a .recycle ();
485487 if (ap != -1 ) {
486- appearance = context .obtainStyledAttributes (ap ,
487- com .android .internal .R .styleable .
488- TextAppearance );
488+ appearance = theme .obtainStyledAttributes (
489+ ap , com .android .internal .R .styleable .TextAppearance );
489490 }
490491 if (appearance != null ) {
491492 int n = appearance .getIndexCount ();
@@ -552,6 +553,9 @@ public TextView(Context context,
552553 boolean password = false ;
553554 int inputType = EditorInfo .TYPE_NULL ;
554555
556+ a = theme .obtainStyledAttributes (
557+ attrs , com .android .internal .R .styleable .TextView , defStyle , 0 );
558+
555559 int n = a .getIndexCount ();
556560 for (int i = 0 ; i < n ; i ++) {
557561 int attr = a .getIndex (i );
0 commit comments