Implement QS spec.
- Update padding between QS tiles - Add margins in the QS header for larger width devices - Update carrier text length in QS footer and fix animation overlap - Fix TouchAnimator to linearly interpolate more than 2 keyframe values Bug: 73312177 Test: visual Change-Id: I8da031437fc78ef1fb86797237711ac92a860616
This commit is contained in:
@@ -43,40 +43,24 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="end" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" >
|
||||
<!-- Add an extra 8dp margin before carrier text without shifting it right -->
|
||||
<android.widget.Space
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.android.keyguard.CarrierText
|
||||
android:id="@+id/qs_carrier_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|start"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textDirection="locale"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/qs_drag_handle_view"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="4dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/qs_footer_drag_handle" />
|
||||
|
||||
<com.android.keyguard.AlphaOptimizedLinearLayout
|
||||
android:id="@+id/qs_footer_actions_container"
|
||||
<com.android.keyguard.CarrierText
|
||||
android:id="@+id/qs_carrier_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:gravity="center_vertical|start"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textDirection="locale"
|
||||
android:singleLine="true" />
|
||||
|
||||
<com.android.keyguard.AlphaOptimizedLinearLayout
|
||||
android:id="@+id/qs_footer_actions_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|end" >
|
||||
<com.android.systemui.statusbar.phone.MultiUserSwitch
|
||||
android:id="@+id/multi_user_switch"
|
||||
@@ -139,4 +123,11 @@
|
||||
</com.android.keyguard.AlphaOptimizedLinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/qs_drag_handle_view"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="4dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/qs_footer_drag_handle" />
|
||||
|
||||
</com.android.systemui.qs.QSFooterImpl>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -18,4 +18,5 @@
|
||||
<resources>
|
||||
<dimen name="nav_content_padding">8dp</dimen>
|
||||
<dimen name="rounded_corner_content_padding">8dp</dimen>
|
||||
<dimen name="qs_header_tile_margin_horizontal">5dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -301,11 +301,13 @@
|
||||
<dimen name="pull_span_min">25dp</dimen>
|
||||
|
||||
<dimen name="qs_tile_height">106dp</dimen>
|
||||
<dimen name="qs_tile_margin">19dp</dimen>
|
||||
<dimen name="qs_tile_margin_horizontal">18dp</dimen>
|
||||
<dimen name="qs_tile_margin_vertical">24dp</dimen>
|
||||
<dimen name="qs_tile_margin_top">18dp</dimen>
|
||||
<dimen name="qs_quick_tile_size">48dp</dimen>
|
||||
<dimen name="qs_quick_tile_padding">12dp</dimen>
|
||||
<dimen name="qs_header_gear_translation">16dp</dimen>
|
||||
<dimen name="qs_header_tile_margin_horizontal">0dp</dimen>
|
||||
<dimen name="qs_page_indicator_width">16dp</dimen>
|
||||
<dimen name="qs_page_indicator_height">8dp</dimen>
|
||||
<dimen name="qs_tile_icon_size">24dp</dimen>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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<TileRecord> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user