@@ -43,7 +43,7 @@ public class Flow extends VirtualLayout {
43
43
public static final int WRAP_NONE = 0 ;
44
44
public static final int WRAP_CHAIN = 1 ;
45
45
public static final int WRAP_ALIGNED = 2 ;
46
- public static final int WRAP_CHAIN_DEPRECATED = 3 ;
46
+ public static final int WRAP_CHAIN_NEW = 3 ;
47
47
48
48
private int mHorizontalStyle = UNKNOWN ;
49
49
private int mVerticalStyle = UNKNOWN ;
@@ -170,6 +170,9 @@ public void setWrapMode(int value) {
170
170
171
171
public void setMaxElementsWrap (int value ) { mMaxElementsWrap = value ; }
172
172
173
+ public float getMaxElementsWrap () {
174
+ return mMaxElementsWrap ;
175
+ }
173
176
/////////////////////////////////////////////////////////////////////////////////////////////
174
177
// Utility methods
175
178
/////////////////////////////////////////////////////////////////////////////////////////////
@@ -293,14 +296,15 @@ public void measure(int widthMode, int widthSize, int heightMode, int heightSize
293
296
measureChainWrap (widgets , count , mOrientation , max , measured );
294
297
}
295
298
break ;
296
- case WRAP_CHAIN_DEPRECATED : {
297
- measureChainWrap_broken (widgets , count , mOrientation , max , measured );
298
- }
299
- break ;
300
299
case WRAP_NONE : {
301
300
measureNoWrap (widgets , count , mOrientation , max , measured );
302
301
}
303
302
break ;
303
+ case WRAP_CHAIN_NEW : {
304
+ measureChainWrap_new (widgets , count , mOrientation , max , measured );
305
+ }
306
+ break ;
307
+
304
308
}
305
309
306
310
width = measured [HORIZONTAL ] + paddingLeft + paddingRight ;
@@ -785,7 +789,7 @@ private void recomputeDimensions() {
785
789
* @param max the maximum available space
786
790
* @param measured output parameters -- will contain the resulting measure
787
791
*/
788
- private void measureChainWrap_broken (ConstraintWidget [] widgets , int count , int orientation , int max , int [] measured ) {
792
+ private void measureChainWrap (ConstraintWidget [] widgets , int count , int orientation , int max , int [] measured ) {
789
793
if (count == 0 ) {
790
794
return ;
791
795
}
@@ -926,18 +930,18 @@ private void measureChainWrap_broken(ConstraintWidget[] widgets, int count, int
926
930
measured [VERTICAL ] = maxHeight ;
927
931
}
928
932
/////////////////////////////////////////////////////////////////////////////////////////////
929
- // Measure Chain Wrap
933
+ // Measure Chain Wrap new
930
934
/////////////////////////////////////////////////////////////////////////////////////////////
931
935
932
936
/**
933
- * Measure the virtual layout using a list of chains for the children
937
+ * Measure the virtual layout using a list of chains for the children in new "fixed way"
934
938
* @param widgets list of widgets
935
939
* @param count
936
940
* @param orientation the layout orientation (horizontal or vertical)
937
941
* @param max the maximum available space
938
942
* @param measured output parameters -- will contain the resulting measure
939
943
*/
940
- private void measureChainWrap (ConstraintWidget [] widgets , int count , int orientation , int max , int [] measured ) {
944
+ private void measureChainWrap_new (ConstraintWidget [] widgets , int count , int orientation , int max , int [] measured ) {
941
945
if (count == 0 ) {
942
946
return ;
943
947
}
@@ -1406,6 +1410,14 @@ public void addToSolver(LinearSystem system, boolean optimize) {
1406
1410
case WRAP_ALIGNED : {
1407
1411
createAlignedConstraints (isInRtl );
1408
1412
}
1413
+ break ;
1414
+ case WRAP_CHAIN_NEW : {
1415
+ final int count = mChainList .size ();
1416
+ for (int i = 0 ; i < count ; i ++) {
1417
+ WidgetsList list = mChainList .get (i );
1418
+ list .createConstraints (isInRtl , i , i == count - 1 );
1419
+ }
1420
+ } break ;
1409
1421
}
1410
1422
needsCallbackFromSolver (false );
1411
1423
}
0 commit comments