Loading core/java/com/android/internal/widget/NotificationActionListLayout.java +2 −26 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,6 @@ public class NotificationActionListLayout extends LinearLayout { int otherViews = 0; int otherViews = 0; int notGoneChildren = 0; int notGoneChildren = 0; View lastNotGoneChild = null; for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) { View c = getChildAt(i); View c = getChildAt(i); if (c instanceof TextView) { if (c instanceof TextView) { Loading @@ -87,7 +86,6 @@ public class NotificationActionListLayout extends LinearLayout { } } if (c.getVisibility() != GONE) { if (c.getVisibility() != GONE) { notGoneChildren++; notGoneChildren++; lastNotGoneChild = c; } } } } Loading @@ -107,11 +105,8 @@ public class NotificationActionListLayout extends LinearLayout { } } } } } } boolean centerAligned = (mGravity & Gravity.CENTER_HORIZONTAL) != 0; boolean singleChildCentered = notGoneChildren == 1 && centerAligned; boolean needsRegularMeasurement = notGoneChildren > 1 || singleChildCentered; if (needsRegularMeasurement && needRebuild) { if (needRebuild) { rebuildMeasureOrder(textViews, otherViews); rebuildMeasureOrder(textViews, otherViews); } } Loading @@ -123,7 +118,7 @@ public class NotificationActionListLayout extends LinearLayout { int usedWidth = 0; int usedWidth = 0; int measuredChildren = 0; int measuredChildren = 0; for (int i = 0; i < N && needsRegularMeasurement; i++) { for (int i = 0; i < N; i++) { // Measure shortest children first. To avoid measuring twice, we approximate by looking // Measure shortest children first. To avoid measuring twice, we approximate by looking // at the text length. // at the text length. View c; View c; Loading Loading @@ -156,25 +151,6 @@ public class NotificationActionListLayout extends LinearLayout { measuredChildren++; measuredChildren++; } } // Make sure to measure the last child full-width if we didn't use up the entire width, // or we didn't measure yet because there's just one child. if (lastNotGoneChild != null && !centerAligned && (constrained && usedWidth < innerWidth || notGoneChildren == 1)) { MarginLayoutParams lp = (MarginLayoutParams) lastNotGoneChild.getLayoutParams(); if (notGoneChildren > 1) { // Need to make room, since we already measured this once. usedWidth -= lastNotGoneChild.getMeasuredWidth() + lp.rightMargin + lp.leftMargin; } int originalWidth = lp.width; lp.width = LayoutParams.MATCH_PARENT; measureChildWithMargins(lastNotGoneChild, widthMeasureSpec, usedWidth, heightMeasureSpec, 0 /* usedHeight */); lp.width = originalWidth; usedWidth += lastNotGoneChild.getMeasuredWidth() + lp.rightMargin + lp.leftMargin; } mTotalWidth = usedWidth + mPaddingRight + mPaddingLeft; mTotalWidth = usedWidth + mPaddingRight + mPaddingLeft; setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); Loading Loading
core/java/com/android/internal/widget/NotificationActionListLayout.java +2 −26 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,6 @@ public class NotificationActionListLayout extends LinearLayout { int otherViews = 0; int otherViews = 0; int notGoneChildren = 0; int notGoneChildren = 0; View lastNotGoneChild = null; for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) { View c = getChildAt(i); View c = getChildAt(i); if (c instanceof TextView) { if (c instanceof TextView) { Loading @@ -87,7 +86,6 @@ public class NotificationActionListLayout extends LinearLayout { } } if (c.getVisibility() != GONE) { if (c.getVisibility() != GONE) { notGoneChildren++; notGoneChildren++; lastNotGoneChild = c; } } } } Loading @@ -107,11 +105,8 @@ public class NotificationActionListLayout extends LinearLayout { } } } } } } boolean centerAligned = (mGravity & Gravity.CENTER_HORIZONTAL) != 0; boolean singleChildCentered = notGoneChildren == 1 && centerAligned; boolean needsRegularMeasurement = notGoneChildren > 1 || singleChildCentered; if (needsRegularMeasurement && needRebuild) { if (needRebuild) { rebuildMeasureOrder(textViews, otherViews); rebuildMeasureOrder(textViews, otherViews); } } Loading @@ -123,7 +118,7 @@ public class NotificationActionListLayout extends LinearLayout { int usedWidth = 0; int usedWidth = 0; int measuredChildren = 0; int measuredChildren = 0; for (int i = 0; i < N && needsRegularMeasurement; i++) { for (int i = 0; i < N; i++) { // Measure shortest children first. To avoid measuring twice, we approximate by looking // Measure shortest children first. To avoid measuring twice, we approximate by looking // at the text length. // at the text length. View c; View c; Loading Loading @@ -156,25 +151,6 @@ public class NotificationActionListLayout extends LinearLayout { measuredChildren++; measuredChildren++; } } // Make sure to measure the last child full-width if we didn't use up the entire width, // or we didn't measure yet because there's just one child. if (lastNotGoneChild != null && !centerAligned && (constrained && usedWidth < innerWidth || notGoneChildren == 1)) { MarginLayoutParams lp = (MarginLayoutParams) lastNotGoneChild.getLayoutParams(); if (notGoneChildren > 1) { // Need to make room, since we already measured this once. usedWidth -= lastNotGoneChild.getMeasuredWidth() + lp.rightMargin + lp.leftMargin; } int originalWidth = lp.width; lp.width = LayoutParams.MATCH_PARENT; measureChildWithMargins(lastNotGoneChild, widthMeasureSpec, usedWidth, heightMeasureSpec, 0 /* usedHeight */); lp.width = originalWidth; usedWidth += lastNotGoneChild.getMeasuredWidth() + lp.rightMargin + lp.leftMargin; } mTotalWidth = usedWidth + mPaddingRight + mPaddingLeft; mTotalWidth = usedWidth + mPaddingRight + mPaddingLeft; setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), setMeasuredDimension(resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec), resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec)); Loading