@@ -43,7 +43,7 @@ public class Flow extends VirtualLayout {
4343 public static final int WRAP_NONE = 0 ;
4444 public static final int WRAP_CHAIN = 1 ;
4545 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 ;
4747
4848 private int mHorizontalStyle = UNKNOWN ;
4949 private int mVerticalStyle = UNKNOWN ;
@@ -170,6 +170,9 @@ public void setWrapMode(int value) {
170170
171171 public void setMaxElementsWrap (int value ) { mMaxElementsWrap = value ; }
172172
173+ public float getMaxElementsWrap () {
174+ return mMaxElementsWrap ;
175+ }
173176 /////////////////////////////////////////////////////////////////////////////////////////////
174177 // Utility methods
175178 /////////////////////////////////////////////////////////////////////////////////////////////
@@ -293,14 +296,15 @@ public void measure(int widthMode, int widthSize, int heightMode, int heightSize
293296 measureChainWrap (widgets , count , mOrientation , max , measured );
294297 }
295298 break ;
296- case WRAP_CHAIN_DEPRECATED : {
297- measureChainWrap_broken (widgets , count , mOrientation , max , measured );
298- }
299- break ;
300299 case WRAP_NONE : {
301300 measureNoWrap (widgets , count , mOrientation , max , measured );
302301 }
303302 break ;
303+ case WRAP_CHAIN_NEW : {
304+ measureChainWrap_new (widgets , count , mOrientation , max , measured );
305+ }
306+ break ;
307+
304308 }
305309
306310 width = measured [HORIZONTAL ] + paddingLeft + paddingRight ;
@@ -785,7 +789,7 @@ private void recomputeDimensions() {
785789 * @param max the maximum available space
786790 * @param measured output parameters -- will contain the resulting measure
787791 */
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 ) {
789793 if (count == 0 ) {
790794 return ;
791795 }
@@ -926,18 +930,18 @@ private void measureChainWrap_broken(ConstraintWidget[] widgets, int count, int
926930 measured [VERTICAL ] = maxHeight ;
927931 }
928932 /////////////////////////////////////////////////////////////////////////////////////////////
929- // Measure Chain Wrap
933+ // Measure Chain Wrap new
930934 /////////////////////////////////////////////////////////////////////////////////////////////
931935
932936 /**
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"
934938 * @param widgets list of widgets
935939 * @param count
936940 * @param orientation the layout orientation (horizontal or vertical)
937941 * @param max the maximum available space
938942 * @param measured output parameters -- will contain the resulting measure
939943 */
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 ) {
941945 if (count == 0 ) {
942946 return ;
943947 }
@@ -1406,6 +1410,14 @@ public void addToSolver(LinearSystem system, boolean optimize) {
14061410 case WRAP_ALIGNED : {
14071411 createAlignedConstraints (isInRtl );
14081412 }
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 ;
14091421 }
14101422 needsCallbackFromSolver (false );
14111423 }
0 commit comments