@@ -51,7 +51,6 @@ public AutoResizeTextView(final Context context, final AttributeSet attrs) {
51
51
52
52
public AutoResizeTextView (final Context context , final AttributeSet attrs , final int defStyle ) {
53
53
super (context , attrs , defStyle );
54
-
55
54
// using the minimal recommended font size
56
55
_minTextSize = TypedValue .applyDimension (TypedValue .COMPLEX_UNIT_SP , 12 , getResources ().getDisplayMetrics ());
57
56
_maxTextSize = getTextSize ();
@@ -62,18 +61,16 @@ public AutoResizeTextView(final Context context, final AttributeSet attrs, final
62
61
// prepare size tester:
63
62
_sizeTester = new SizeTester () {
64
63
final RectF textRect = new RectF ();
65
-
66
64
@ TargetApi (Build .VERSION_CODES .JELLY_BEAN )
67
65
@ Override
68
- public int onTestSize (final int suggestedSize , final RectF availableSPace ) {
66
+ public int onTestSize (final int suggestedSize , final RectF availableSpace ) {
69
67
_paint .setTextSize (suggestedSize );
70
68
final TransformationMethod transformationMethod = getTransformationMethod ();
71
69
final String text ;
72
70
if (transformationMethod != null )
73
71
text = transformationMethod .getTransformation (getText (), AutoResizeTextView .this ).toString ();
74
72
else
75
73
text = getText ().toString ();
76
-
77
74
final boolean singleLine = getMaxLines () == 1 ;
78
75
if (singleLine ) {
79
76
textRect .bottom = _paint .getFontSpacing ();
@@ -91,7 +88,7 @@ public int onTestSize(final int suggestedSize, final RectF availableSPace) {
91
88
textRect .right = maxWidth ;
92
89
}
93
90
textRect .offsetTo (0 , 0 );
94
- if (availableSPace .contains (textRect ))
91
+ if (availableSpace .contains (textRect ))
95
92
// may be too small, don't worry we will find the best match
96
93
return -1 ;
97
94
// else, too big
@@ -120,9 +117,9 @@ public void setTextSize(final float size) {
120
117
}
121
118
122
119
@ Override
123
- public void setMaxLines (final int maxlines ) {
124
- super .setMaxLines (maxlines );
125
- _maxLines = maxlines ;
120
+ public void setMaxLines (final int maxLines ) {
121
+ super .setMaxLines (maxLines );
122
+ _maxLines = maxLines ;
126
123
adjustTextSize ();
127
124
}
128
125
0 commit comments