Loading iconloaderlib/res/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,7 @@ --> <resources> <color name="legacy_icon_background">#FFFFFF</color> <!-- Yellow 600, used for highlighting "important" conversations in settings & notifications --> <color name="important_conversation">#f9ab00</color> </resources> iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java +0 −20 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3.icons; import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; Loading @@ -25,7 +24,6 @@ import android.graphics.ColorFilter; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading @@ -36,7 +34,6 @@ import android.view.animation.Interpolator; import androidx.annotation.Nullable; public class FastBitmapDrawable extends Drawable { private static final Interpolator ACCEL = new AccelerateInterpolator(); Loading @@ -60,8 +57,6 @@ public class FastBitmapDrawable extends Drawable { private boolean mIsPressed; private boolean mIsDisabled; float mDisabledAlpha = 1f; private float mRoundedCornersRadius = 0f; private final Path mClipPath = new Path(); // Animator and properties for the fast bitmap drawable's scale private static final Property<FastBitmapDrawable, Float> SCALE Loading Loading @@ -103,13 +98,6 @@ public class FastBitmapDrawable extends Drawable { @Override public final void draw(Canvas canvas) { if (mRoundedCornersRadius > 0) { float radius = mRoundedCornersRadius * mScale; mClipPath.reset(); mClipPath.addRoundRect(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), radius, radius, Path.Direction.CCW); canvas.clipPath(mClipPath); } if (mScale != 1f) { int count = canvas.save(); Rect bounds = getBounds(); Loading Loading @@ -169,14 +157,6 @@ public class FastBitmapDrawable extends Drawable { return mScaleAnimation == null ? 1 : mScale; } public void setRoundedCornersRadius(float radius) { mRoundedCornersRadius = radius; } public float getRoundedCornersRadius() { return mRoundedCornersRadius; } @Override public int getIntrinsicWidth() { return mBitmap.getWidth(); Loading iconloaderlib/src/com/android/launcher3/icons/IconProvider.java +5 −3 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class IconProvider { * on the UI */ public Drawable getIconForUI(ActivityInfo info, UserHandle user) { Drawable icon = getIcon(info, user); Drawable icon = getIcon(info); if (icon instanceof BitmapInfo.Extender) { ((Extender) icon).prepareToDrawOnUi(); } Loading @@ -121,8 +121,10 @@ public class IconProvider { /** * Loads the icon for the provided activity info */ public Drawable getIcon(ActivityInfo info, UserHandle user) { return getIcon(info.applicationInfo.packageName, user, info, mContext.getPackageManager(), public Drawable getIcon(ActivityInfo info) { return getIcon(info.applicationInfo.packageName, UserHandle.getUserHandleForUid(info.applicationInfo.uid), info, mContext.getPackageManager(), AI_LOADER); } Loading iconloaderlib/src/com/android/launcher3/icons/RoundDrawableWrapper.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.icons; import android.graphics.Canvas; import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.graphics.drawable.DrawableWrapper; /** * A drawable which clips rounded corner around a child drawable */ public class RoundDrawableWrapper extends DrawableWrapper { private final RectF mTempRect = new RectF(); private final Path mClipPath = new Path(); private final float mRoundedCornersRadius; public RoundDrawableWrapper(Drawable dr, float radius) { super(dr); mRoundedCornersRadius = radius; } @Override protected void onBoundsChange(Rect bounds) { mTempRect.set(getBounds()); mClipPath.reset(); mClipPath.addRoundRect(mTempRect, mRoundedCornersRadius, mRoundedCornersRadius, Path.Direction.CCW); super.onBoundsChange(bounds); } @Override public final void draw(Canvas canvas) { int saveCount = canvas.save(); canvas.clipPath(mClipPath); super.draw(canvas); canvas.restoreToCount(saveCount); } } Loading
iconloaderlib/res/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,7 @@ --> <resources> <color name="legacy_icon_background">#FFFFFF</color> <!-- Yellow 600, used for highlighting "important" conversations in settings & notifications --> <color name="important_conversation">#f9ab00</color> </resources>
iconloaderlib/src/com/android/launcher3/icons/FastBitmapDrawable.java +0 −20 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3.icons; import android.animation.ObjectAnimator; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; Loading @@ -25,7 +24,6 @@ import android.graphics.ColorFilter; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading @@ -36,7 +34,6 @@ import android.view.animation.Interpolator; import androidx.annotation.Nullable; public class FastBitmapDrawable extends Drawable { private static final Interpolator ACCEL = new AccelerateInterpolator(); Loading @@ -60,8 +57,6 @@ public class FastBitmapDrawable extends Drawable { private boolean mIsPressed; private boolean mIsDisabled; float mDisabledAlpha = 1f; private float mRoundedCornersRadius = 0f; private final Path mClipPath = new Path(); // Animator and properties for the fast bitmap drawable's scale private static final Property<FastBitmapDrawable, Float> SCALE Loading Loading @@ -103,13 +98,6 @@ public class FastBitmapDrawable extends Drawable { @Override public final void draw(Canvas canvas) { if (mRoundedCornersRadius > 0) { float radius = mRoundedCornersRadius * mScale; mClipPath.reset(); mClipPath.addRoundRect(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), radius, radius, Path.Direction.CCW); canvas.clipPath(mClipPath); } if (mScale != 1f) { int count = canvas.save(); Rect bounds = getBounds(); Loading Loading @@ -169,14 +157,6 @@ public class FastBitmapDrawable extends Drawable { return mScaleAnimation == null ? 1 : mScale; } public void setRoundedCornersRadius(float radius) { mRoundedCornersRadius = radius; } public float getRoundedCornersRadius() { return mRoundedCornersRadius; } @Override public int getIntrinsicWidth() { return mBitmap.getWidth(); Loading
iconloaderlib/src/com/android/launcher3/icons/IconProvider.java +5 −3 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ public class IconProvider { * on the UI */ public Drawable getIconForUI(ActivityInfo info, UserHandle user) { Drawable icon = getIcon(info, user); Drawable icon = getIcon(info); if (icon instanceof BitmapInfo.Extender) { ((Extender) icon).prepareToDrawOnUi(); } Loading @@ -121,8 +121,10 @@ public class IconProvider { /** * Loads the icon for the provided activity info */ public Drawable getIcon(ActivityInfo info, UserHandle user) { return getIcon(info.applicationInfo.packageName, user, info, mContext.getPackageManager(), public Drawable getIcon(ActivityInfo info) { return getIcon(info.applicationInfo.packageName, UserHandle.getUserHandleForUid(info.applicationInfo.uid), info, mContext.getPackageManager(), AI_LOADER); } Loading
iconloaderlib/src/com/android/launcher3/icons/RoundDrawableWrapper.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.launcher3.icons; import android.graphics.Canvas; import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.graphics.drawable.DrawableWrapper; /** * A drawable which clips rounded corner around a child drawable */ public class RoundDrawableWrapper extends DrawableWrapper { private final RectF mTempRect = new RectF(); private final Path mClipPath = new Path(); private final float mRoundedCornersRadius; public RoundDrawableWrapper(Drawable dr, float radius) { super(dr); mRoundedCornersRadius = radius; } @Override protected void onBoundsChange(Rect bounds) { mTempRect.set(getBounds()); mClipPath.reset(); mClipPath.addRoundRect(mTempRect, mRoundedCornersRadius, mRoundedCornersRadius, Path.Direction.CCW); super.onBoundsChange(bounds); } @Override public final void draw(Canvas canvas) { int saveCount = canvas.save(); canvas.clipPath(mClipPath); super.draw(canvas); canvas.restoreToCount(saveCount); } }