Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b5f0abb authored by Alan Viverette's avatar Alan Viverette Committed by android-build-merger
Browse files

Merge "Revert "Always assign leftover pixels to last weighted child"" into...

Merge "Revert "Always assign leftover pixels to last weighted child"" into nyc-dev am: 3a3fb73c am: ff71f781
am: 91aefd57

* commit '91aefd57':
  Revert "Always assign leftover pixels to last weighted child"

Change-Id: I020369fa95fc497d3551678b815dba50d64085a6
parents d5f8e46c 91aefd57
Loading
Loading
Loading
Loading
+6 −24
Original line number Diff line number Diff line
@@ -730,7 +730,6 @@ public class LinearLayout extends ViewGroup {
        final int baselineChildIndex = mBaselineAlignedChildIndex;        
        final boolean useLargestChild = mUseLargestChild;

        int lastWeightedChildIndex = -1;
        int largestChildHeight = Integer.MIN_VALUE;
        int consumedExcessSpace = 0;

@@ -755,10 +754,8 @@ public class LinearLayout extends ViewGroup {
            }

            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (lp.weight > 0) {

            totalWeight += lp.weight;
                lastWeightedChildIndex = i;
            }

            final boolean useExcessSpace = lp.height == 0 && lp.weight > 0;
            if (heightMode == MeasureSpec.EXACTLY && useExcessSpace) {
@@ -912,13 +909,7 @@ public class LinearLayout extends ViewGroup {
                final LayoutParams lp = (LayoutParams) child.getLayoutParams();
                final float childWeight = lp.weight;
                if (childWeight > 0) {
                    final int share;
                    if (i == lastWeightedChildIndex) {
                        share = remainingExcess;
                    } else {
                        share = (int) (childWeight * remainingExcess / remainingWeightSum);
                    }

                    final int share = (int) (childWeight * remainingExcess / remainingWeightSum);
                    remainingExcess -= share;
                    remainingWeightSum -= childWeight;

@@ -1079,7 +1070,6 @@ public class LinearLayout extends ViewGroup {
        
        final boolean isExactly = widthMode == MeasureSpec.EXACTLY;

        int lastWeightedChildIndex = -1;
        int largestChildWidth = Integer.MIN_VALUE;
        int usedExcessSpace = 0;

@@ -1104,10 +1094,8 @@ public class LinearLayout extends ViewGroup {
            }

            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            if (lp.weight > 0) {

            totalWeight += lp.weight;
                lastWeightedChildIndex = i;
            }

            final boolean useExcessSpace = lp.width == 0 && lp.weight > 0;
            if (widthMode == MeasureSpec.EXACTLY && useExcessSpace) {
@@ -1306,13 +1294,7 @@ public class LinearLayout extends ViewGroup {
                final LayoutParams lp = (LayoutParams) child.getLayoutParams();
                final float childWeight = lp.weight;
                if (childWeight > 0) {
                    final int share;
                    if (i == lastWeightedChildIndex) {
                        share = remainingExcess;
                    } else {
                        share = (int) (childWeight * remainingExcess / remainingWeightSum);
                    }

                    final int share = (int) (childWeight * remainingExcess / remainingWeightSum);
                    remainingExcess -= share;
                    remainingWeightSum -= childWeight;