@@ -16,7 +16,7 @@ public class WrapLayout extends LayoutBase {
16
16
private int _itemWidth = -1 ;
17
17
private int _itemHeight = -1 ;
18
18
private Orientation _orientation = Orientation .horzontal ;
19
- private ArrayList <Integer > _lenghts = new ArrayList <Integer >();
19
+ private ArrayList <Integer > _lengths = new ArrayList <Integer >();
20
20
21
21
public WrapLayout (Context context ) {
22
22
super (context );
@@ -82,9 +82,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
82
82
83
83
int count = this .getChildCount ();
84
84
85
- this ._lenghts .clear ();
85
+ this ._lengths .clear ();
86
86
int rowOrColumn = 0 ;
87
- int maxLenght = 0 ;
87
+ int maxLength = 0 ;
88
88
89
89
for (int i = 0 ; i < count ; i ++) {
90
90
View child = this .getChildAt (i );
@@ -99,10 +99,10 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
99
99
if (isVertical ) {
100
100
if (childMeasuredHeight > remainingHeight ) {
101
101
rowOrColumn ++;
102
- maxLenght = Math .max (maxLenght , measureHeight );
102
+ maxLength = Math .max (maxLength , measureHeight );
103
103
measureHeight = childMeasuredHeight ;
104
104
remainingWidth = height - childMeasuredHeight ;
105
- this ._lenghts .add (rowOrColumn , childMeasuredWidth );
105
+ this ._lengths .add (rowOrColumn , childMeasuredWidth );
106
106
}
107
107
else {
108
108
remainingHeight -= childMeasuredHeight ;
@@ -112,36 +112,36 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
112
112
else {
113
113
if (childMeasuredWidth > remainingWidth ) {
114
114
rowOrColumn ++;
115
- maxLenght = Math .max (maxLenght , measureWidth );
115
+ maxLength = Math .max (maxLength , measureWidth );
116
116
measureWidth = childMeasuredWidth ;
117
117
remainingWidth = width - childMeasuredWidth ;
118
- this ._lenghts .add (rowOrColumn , childMeasuredHeight );
118
+ this ._lengths .add (rowOrColumn , childMeasuredHeight );
119
119
}
120
120
else {
121
121
remainingWidth -= childMeasuredWidth ;
122
122
measureWidth += childMeasuredWidth ;
123
123
}
124
124
}
125
125
126
- if (this ._lenghts .size () <= rowOrColumn ) {
127
- this ._lenghts .add (rowOrColumn , isVertical ? childMeasuredWidth : childMeasuredHeight );
126
+ if (this ._lengths .size () <= rowOrColumn ) {
127
+ this ._lengths .add (rowOrColumn , isVertical ? childMeasuredWidth : childMeasuredHeight );
128
128
}
129
129
else {
130
- this ._lenghts .set (rowOrColumn , Math .max (this ._lenghts .get (rowOrColumn ), isVertical ? childMeasuredWidth : childMeasuredHeight ));
130
+ this ._lengths .set (rowOrColumn , Math .max (this ._lengths .get (rowOrColumn ), isVertical ? childMeasuredWidth : childMeasuredHeight ));
131
131
}
132
132
}
133
133
134
- count = this ._lenghts .size ();
134
+ count = this ._lengths .size ();
135
135
if (isVertical ) {
136
- measureHeight = Math .max (maxLenght , measureHeight );
136
+ measureHeight = Math .max (maxLength , measureHeight );
137
137
for (int i = 0 ; i < count ; i ++) {
138
- measureWidth += this ._lenghts .get (i );
138
+ measureWidth += this ._lengths .get (i );
139
139
}
140
140
}
141
141
else {
142
- measureWidth = Math .max (maxLenght , measureWidth );
142
+ measureWidth = Math .max (maxLength , measureWidth );
143
143
for (int i = 0 ; i < count ; i ++) {
144
- measureHeight += this ._lenghts .get (i );
144
+ measureHeight += this ._lengths .get (i );
145
145
}
146
146
}
147
147
@@ -170,7 +170,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
170
170
171
171
int childLeft = paddingLeft ;
172
172
int childTop = paddingTop ;
173
- int childrenLength = isVertical ? bottom - top - ( paddingRight + paddingBottom ) : right - left - ( paddingLeft + paddingRight ) ;
173
+ int childrenLength = isVertical ? bottom - top - paddingBottom : right - left - paddingRight ;
174
174
175
175
int rowOrColumn = 0 ;
176
176
int count = this .getChildCount ();
@@ -184,7 +184,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
184
184
int childWidth = CommonLayoutParams .getDesiredWidth (child );
185
185
int childHeight = CommonLayoutParams .getDesiredHeight (child );
186
186
187
- int length = this ._lenghts .get (rowOrColumn );
187
+ int length = this ._lengths .get (rowOrColumn );
188
188
if (isVertical ) {
189
189
190
190
childWidth = length ;
@@ -200,7 +200,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
200
200
rowOrColumn ++;
201
201
202
202
// Take current column width.
203
- childWidth = length = this ._lenghts .get (rowOrColumn );
203
+ childWidth = length = this ._lengths .get (rowOrColumn );
204
204
}
205
205
}
206
206
else {
@@ -217,7 +217,7 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
217
217
rowOrColumn ++;
218
218
219
219
// Take current row height.
220
- childHeight = length = this ._lenghts .get (rowOrColumn );
220
+ childHeight = length = this ._lengths .get (rowOrColumn );
221
221
}
222
222
}
223
223
0 commit comments