Adding utility method to get adaptive icon scale

Change-Id: I5ff190c3b794bb13309375782ccd420e85b59091
This commit is contained in:
Sunny Goyal
2019-05-03 16:50:43 -07:00
parent 1bdb0f4046
commit 905262c1a7
11 changed files with 142 additions and 109 deletions
@@ -17,6 +17,8 @@
package com.android.launcher3.graphics;
import static com.android.launcher3.graphics.IconShape.DEFAULT_PATH_SIZE;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -55,8 +57,6 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
}
};
public static final int PATH_SIZE = 100;
private static final float PROGRESS_WIDTH = 7;
private static final float PROGRESS_GAP = 2;
private static final int MAX_PAINT_ALPHA = 255;
@@ -123,14 +123,14 @@ public class PreloadIconDrawable extends FastBitmapDrawable {
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mTmpMatrix.setScale(
(bounds.width() - 2 * PROGRESS_WIDTH - 2 * PROGRESS_GAP) / PATH_SIZE,
(bounds.height() - 2 * PROGRESS_WIDTH - 2 * PROGRESS_GAP) / PATH_SIZE);
(bounds.width() - 2 * PROGRESS_WIDTH - 2 * PROGRESS_GAP) / DEFAULT_PATH_SIZE,
(bounds.height() - 2 * PROGRESS_WIDTH - 2 * PROGRESS_GAP) / DEFAULT_PATH_SIZE);
mTmpMatrix.postTranslate(
bounds.left + PROGRESS_WIDTH + PROGRESS_GAP,
bounds.top + PROGRESS_WIDTH + PROGRESS_GAP);
mProgressPath.transform(mTmpMatrix, mScaledTrackPath);
float scale = bounds.width() / PATH_SIZE;
float scale = bounds.width() / DEFAULT_PATH_SIZE;
mProgressPaint.setStrokeWidth(PROGRESS_WIDTH * scale);
mShadowBitmap = getShadowBitmap(bounds.width(), bounds.height(),