Merge "Fix RTL TileLayout." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
12a1c46a67
@@ -20,7 +20,7 @@
|
|||||||
android:id="@+id/tile_page"
|
android:id="@+id/tile_page"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="@dimen/notification_side_paddings"
|
android:paddingStart="@dimen/notification_side_paddings"
|
||||||
android:paddingRight="@dimen/notification_side_paddings"
|
android:paddingEnd="@dimen/notification_side_paddings"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false" />
|
android:clipToPadding="false" />
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
|||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
final int numTiles = mRecords.size();
|
final int numTiles = mRecords.size();
|
||||||
final int width = MeasureSpec.getSize(widthMeasureSpec) - mPaddingLeft - mPaddingRight;
|
final int width = MeasureSpec.getSize(widthMeasureSpec)
|
||||||
|
- getPaddingStart() - getPaddingEnd();
|
||||||
final int numRows = (numTiles + mColumns - 1) / mColumns;
|
final int numRows = (numTiles + mColumns - 1) / mColumns;
|
||||||
mCellWidth = (width - mSidePadding * 2 - (mCellMarginHorizontal * mColumns)) / mColumns;
|
mCellWidth = (width - mSidePadding * 2 - (mCellMarginHorizontal * mColumns)) / mColumns;
|
||||||
|
|
||||||
@@ -140,16 +141,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
|||||||
|
|
||||||
final TileRecord record = mRecords.get(i);
|
final TileRecord record = mRecords.get(i);
|
||||||
final int top = getRowTop(row);
|
final int top = getRowTop(row);
|
||||||
final int right;
|
final int left = getColumnStart(isRtl ? mColumns - column - 1 : column);
|
||||||
final int left;
|
final int right = left + mCellWidth;
|
||||||
if (isRtl) {
|
|
||||||
right = w - getColumnStart(column);
|
|
||||||
left = right - mCellWidth;
|
|
||||||
} else {
|
|
||||||
left = getColumnStart(column);
|
|
||||||
right = left + mCellWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
record.tileView.layout(left, top, right, top + record.tileView.getMeasuredHeight());
|
record.tileView.layout(left, top, right, top + record.tileView.getMeasuredHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,6 +152,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getColumnStart(int column) {
|
private int getColumnStart(int column) {
|
||||||
return column * (mCellWidth + mCellMarginHorizontal) + mCellMarginHorizontal + mPaddingLeft;
|
return getPaddingStart() + mSidePadding + mCellMarginHorizontal / 2 +
|
||||||
|
column * (mCellWidth + mCellMarginHorizontal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user