Merge "Get dimens values from resources in pixels"

This commit is contained in:
TreeHugger Robot
2020-09-25 21:25:42 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 8 deletions

View File

@@ -506,6 +506,10 @@
<dimen name="qs_header_tile_margin_bottom">18dp</dimen>
<dimen name="qs_page_indicator_width">16dp</dimen>
<dimen name="qs_page_indicator_height">8dp</dimen>
<!-- The size of a single dot in relation to the whole animation.
Scaled @dimen/qs_page_indicator-width by .4f.
-->
<dimen name="qs_page_indicator_dot_width">6.4dp</dimen>
<dimen name="qs_tile_icon_size">24dp</dimen>
<dimen name="qs_tile_text_size">12sp</dimen>
<dimen name="qs_tile_divider_height">1dp</dimen>

View File

@@ -2,6 +2,7 @@ package com.android.systemui.qs;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
@@ -31,9 +32,6 @@ public class PageIndicator extends ViewGroup {
private static final long ANIMATION_DURATION = 250;
// The size of a single dot in relation to the whole animation.
private static final float SINGLE_SCALE = .4f;
private static final float MINOR_ALPHA = .42f;
private final ArrayList<Integer> mQueuedPositions = new ArrayList<>();
@@ -75,11 +73,10 @@ public class PageIndicator extends ViewGroup {
}
array.recycle();
mPageIndicatorWidth =
(int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_width);
mPageIndicatorHeight =
(int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_height);
mPageDotWidth = (int) (mPageIndicatorWidth * SINGLE_SCALE);
Resources res = context.getResources();
mPageIndicatorWidth = res.getDimensionPixelSize(R.dimen.qs_page_indicator_width);
mPageIndicatorHeight = res.getDimensionPixelSize(R.dimen.qs_page_indicator_height);
mPageDotWidth = res.getDimensionPixelSize(R.dimen.qs_page_indicator_dot_width);
}
public void setNumPages(int numPages) {