Merge "Fix RTL actions alignment" into pi-dev

am: 4024376f04

Change-Id: I56687a07b00914386b018a4e67bdf17300e6b5c1
This commit is contained in:
Lucas Dupin
2018-05-23 11:14:30 -07:00
committed by android-build-merger

View File

@@ -206,7 +206,17 @@ public class NotificationActionListLayout extends LinearLayout {
final boolean centerAligned = (mGravity & Gravity.CENTER_HORIZONTAL) != 0;
int childTop;
int childLeft = centerAligned ? left + (right - left) / 2 - mTotalWidth / 2 : 0;
int childLeft;
if (centerAligned) {
childLeft = mPaddingLeft + left + (right - left) / 2 - mTotalWidth / 2;
} else {
childLeft = mPaddingLeft;
int absoluteGravity = Gravity.getAbsoluteGravity(Gravity.START, getLayoutDirection());
if (absoluteGravity == Gravity.RIGHT) {
childLeft += right - left - mTotalWidth;
}
}
// Where bottom of child should go
final int height = bottom - top;
@@ -216,18 +226,6 @@ public class NotificationActionListLayout extends LinearLayout {
final int count = getChildCount();
final int layoutDirection = getLayoutDirection();
switch (Gravity.getAbsoluteGravity(Gravity.START, layoutDirection)) {
case Gravity.RIGHT:
childLeft += mPaddingLeft + right - left - mTotalWidth;
break;
case Gravity.LEFT:
default:
childLeft += mPaddingLeft;
break;
}
int start = 0;
int dir = 1;
//In case of RTL, start drawing from the last child.