Merge "Updating Drawables as per GraphicsUtils changes" into tm-qpr-dev

This commit is contained in:
Sunny Goyal
2023-02-10 16:46:19 +00:00
committed by Android (Google) Code Review
3 changed files with 19 additions and 11 deletions

View File

@@ -124,7 +124,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
int shadowSize = context.getResources().getDimensionPixelSize(
R.dimen.blur_size_thin_outline);
mShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.OUTER);
mShapePath = GraphicsUtils.getShapePath(mNormalizedIconSize);
mShapePath = GraphicsUtils.getShapePath(context, mNormalizedIconSize);
}
@Override

View File

@@ -578,15 +578,16 @@ public class DeviceProfile {
dimensionOverrideProvider.accept(this);
// This is done last, after iconSizePx is calculated above.
mDotRendererWorkSpace = createDotRenderer(iconSizePx, dotRendererCache);
mDotRendererAllApps = createDotRenderer(allAppsIconSizePx, dotRendererCache);
mDotRendererWorkSpace = createDotRenderer(context, iconSizePx, dotRendererCache);
mDotRendererAllApps = createDotRenderer(context, allAppsIconSizePx, dotRendererCache);
}
private static DotRenderer createDotRenderer(
int size, @NonNull SparseArray<DotRenderer> cache) {
@NonNull Context context, int size, @NonNull SparseArray<DotRenderer> cache) {
DotRenderer renderer = cache.get(size);
if (renderer == null) {
renderer = new DotRenderer(size, getShapePath(DEFAULT_DOT_SIZE), DEFAULT_DOT_SIZE);
renderer = new DotRenderer(size, getShapePath(context, DEFAULT_DOT_SIZE),
DEFAULT_DOT_SIZE);
cache.put(size, renderer);
}
return renderer;

View File

@@ -138,7 +138,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
IconPalette.getPreloadProgressColor(context, info.bitmap.color),
getPreloadColors(context),
Utilities.isDarkTheme(context),
getRefreshRateMillis(context));
getRefreshRateMillis(context),
GraphicsUtils.getShapePath(context, DEFAULT_PATH_SIZE));
}
public PreloadIconDrawable(
@@ -146,10 +147,11 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
int indicatorColor,
int[] preloadColors,
boolean isDarkMode,
int refreshRateMillis) {
int refreshRateMillis,
Path shapePath) {
super(info.bitmap);
mItem = info;
mShapePath = GraphicsUtils.getShapePath(DEFAULT_PATH_SIZE);
mShapePath = shapePath;
mScaledTrackPath = new Path();
mScaledProgressPath = new Path();
@@ -386,7 +388,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
mIndicatorColor,
new int[] {mSystemAccentColor, mSystemBackgroundColor},
mIsDarkMode,
mRefreshRateMillis);
mRefreshRateMillis,
mShapePath);
}
@Override
@@ -442,6 +445,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
protected final boolean mIsDarkMode;
protected final int mLevel;
protected final int mRefreshRateMillis;
private final Path mShapePath;
public PreloadIconConstantState(
Bitmap bitmap,
@@ -450,7 +454,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
int indicatorColor,
int[] preloadColors,
boolean isDarkMode,
int refreshRateMillis) {
int refreshRateMillis,
Path shapePath) {
super(bitmap, iconColor);
mInfo = info;
mIndicatorColor = indicatorColor;
@@ -458,6 +463,7 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
mIsDarkMode = isDarkMode;
mLevel = info.getProgressLevel();
mRefreshRateMillis = refreshRateMillis;
mShapePath = shapePath;
}
@Override
@@ -467,7 +473,8 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
mIndicatorColor,
mPreloadColors,
mIsDarkMode,
mRefreshRateMillis);
mRefreshRateMillis,
mShapePath);
}
}
}