diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml index f635b180a68d5..3c248452cece0 100644 --- a/packages/SystemUI/res/layout/qs_footer_impl.xml +++ b/packages/SystemUI/res/layout/qs_footer_impl.xml @@ -43,40 +43,24 @@ android:layout_gravity="center_vertical" android:gravity="end" > - - - - - - - - - - + + + + diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml index 959247ee76e7f..ca8fcba017b1a 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -44,6 +44,8 @@ android:layout_width="match_parent" android:layout_height="48dp" android:layout_below="@id/quick_qs_status_icons" + android:layout_marginStart="@dimen/qs_header_tile_margin_horizontal" + android:layout_marginEnd="@dimen/qs_header_tile_margin_horizontal" android:accessibilityTraversalAfter="@+id/date_time_group" android:accessibilityTraversalBefore="@id/expand_indicator" android:clipChildren="false" diff --git a/packages/SystemUI/res/values-sw372dp/dimens.xml b/packages/SystemUI/res/values-sw372dp/dimens.xml index 635185d7f2ad1..3a7442a6ecd68 100644 --- a/packages/SystemUI/res/values-sw372dp/dimens.xml +++ b/packages/SystemUI/res/values-sw372dp/dimens.xml @@ -18,4 +18,5 @@ 8dp 8dp + 5dp diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index dc230d497fc20..ca4ea9e1578c3 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -301,11 +301,13 @@ 25dp 106dp - 19dp + 18dp + 24dp 18dp 48dp 12dp 16dp + 0dp 16dp 8dp 24dp diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java index 993df75962498..7b48e021b715a 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java @@ -169,10 +169,10 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, private TouchAnimator createFooterAnimator() { return new TouchAnimator.Builder() .addFloat(mDivider, "alpha", 0, 1) - .addFloat(mCarrierText, "alpha", 0, 1) + .addFloat(mCarrierText, "alpha", 0, 0, 1) .addFloat(mActionsContainer, "alpha", 0, 1) .addFloat(mDragHandle, "translationY", mDragHandleExpandOffset, 0) - .addFloat(mDragHandle, "alpha", 1, 0) + .addFloat(mDragHandle, "alpha", 1, 0, 0) .setStartDelay(0.15f) .build(); } diff --git a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java index 23faa559793ea..66823ca135cba 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java +++ b/packages/SystemUI/src/com/android/systemui/qs/TileLayout.java @@ -21,7 +21,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout { protected int mColumns; protected int mCellWidth; protected int mCellHeight; - protected int mCellMargin; + protected int mCellMarginHorizontal; + protected int mCellMarginVertical; protected final ArrayList mRecords = new ArrayList<>(); private int mCellMarginTop; @@ -76,7 +77,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout { final Resources res = mContext.getResources(); final int columns = Math.max(1, res.getInteger(R.integer.quick_settings_num_columns)); mCellHeight = mContext.getResources().getDimensionPixelSize(R.dimen.qs_tile_height); - mCellMargin = res.getDimensionPixelSize(R.dimen.qs_tile_margin); + mCellMarginHorizontal = res.getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal); + mCellMarginVertical= res.getDimensionPixelSize(R.dimen.qs_tile_margin_vertical); mCellMarginTop = res.getDimensionPixelSize(R.dimen.qs_tile_margin_top); if (mColumns != columns) { mColumns = columns; @@ -91,7 +93,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout { final int numTiles = mRecords.size(); final int width = MeasureSpec.getSize(widthMeasureSpec); final int rows = (numTiles + mColumns - 1) / mColumns; - mCellWidth = (width - (mCellMargin * (mColumns + 1))) / mColumns; + mCellWidth = (width - (mCellMarginHorizontal * (mColumns + 1))) / mColumns; View previousView = this; for (TileRecord record : mRecords) { @@ -102,8 +104,8 @@ public class TileLayout extends ViewGroup implements QSTileLayout { // Only include the top margin in our measurement if we have more than 1 row to show. // Otherwise, don't add the extra margin buffer at top. - int height = (mCellHeight + mCellMargin) * rows + - (rows != 0 ? (mCellMarginTop - mCellMargin) : 0); + int height = (mCellHeight + mCellMarginVertical) * rows + + (rows != 0 ? (mCellMarginTop - mCellMarginVertical) : 0); if (height < 0) height = 0; setMeasuredDimension(width, height); } @@ -143,10 +145,10 @@ public class TileLayout extends ViewGroup implements QSTileLayout { } private int getRowTop(int row) { - return row * (mCellHeight + mCellMargin) + mCellMarginTop; + return row * (mCellHeight + mCellMarginVertical) + mCellMarginTop; } private int getColumnStart(int column) { - return column * (mCellWidth + mCellMargin) + mCellMargin; + return column * (mCellWidth + mCellMarginHorizontal) + mCellMarginHorizontal; } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java index 6263efa2c7114..f673364c7e17d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/qs/TouchAnimator.java @@ -200,7 +200,6 @@ public class TouchAnimator { } private static abstract class KeyframeSet { - private final float mFrameWidth; private final int mSize; @@ -210,9 +209,8 @@ public class TouchAnimator { } void setValue(float fraction, Object target) { - int i; - for (i = 1; i < mSize - 1 && fraction > mFrameWidth; i++); - float amount = fraction / mFrameWidth; + int i = MathUtils.constrain((int) Math.ceil(fraction / mFrameWidth), 1, mSize - 1); + float amount = (fraction - mFrameWidth * (i - 1)) / mFrameWidth; interpolate(i, amount, target); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java index 11491a75c6555..2040e75789101 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/TileLayoutTest.java @@ -54,7 +54,7 @@ public class TileLayoutTest extends SysuiTestCase { // Layout needs to leave space for the tile margins. Three times the margin size is // sufficient for any number of columns. mLayoutSizeForOneTile = - mContext.getResources().getDimensionPixelSize(R.dimen.qs_tile_margin) * 3; + mContext.getResources().getDimensionPixelSize(R.dimen.qs_tile_margin_horizontal) * 3; } private QSPanel.TileRecord createTileRecord() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java index 641cdc7617658..4cc0e20dd9649 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/TouchAnimatorTest.java @@ -55,6 +55,28 @@ public class TouchAnimatorTest extends SysuiTestCase { assertEquals(50f, mTestView.getX()); } + @Test + public void testSetValueFloat_threeValues() { + TouchAnimator animator = new TouchAnimator.Builder() + .addFloat(mTestView, "x", 0, 20, 50) + .build(); + + animator.setPosition(0); + assertEquals(0f, mTestView.getX()); + + animator.setPosition(.25f); + assertEquals(10f, mTestView.getX()); + + animator.setPosition(.5f); + assertEquals(20f, mTestView.getX()); + + animator.setPosition(.75f); + assertEquals(35f, mTestView.getX()); + + animator.setPosition(1); + assertEquals(50f, mTestView.getX()); + } + @Test public void testSetValueInt() { TouchAnimator animator = new TouchAnimator.Builder()