Implement All Apps Icon upto the visual Specs.

Test: Visual
Bug: 267382941

Change-Id: If675c2f4767014598b23d8a2c2e684f5a8fb4f19
This commit is contained in:
Jagrut Desai
2023-02-16 15:40:44 -08:00
parent 73a2334f7f
commit 560b0eac62
8 changed files with 134 additions and 3 deletions
@@ -31,6 +31,7 @@ import android.os.Build;
import android.util.AttributeSet;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.icons.BaseIconFactory;
@@ -70,6 +71,15 @@ public class IconButtonView extends BubbleTextView {
}
}
/** Sets given Drawable as icon */
public void setIconDrawable(@NonNull Drawable drawable) {
ColorStateList tintList = getBackgroundTintList();
int tint = tintList == null ? Color.WHITE : tintList.getDefaultColor();
try (BaseIconFactory factory = LauncherIcons.obtain(getContext())) {
setIcon(new IconDrawable(factory.getWhiteShadowLayer(), tint, drawable));
}
}
/** Updates the color of the icon's foreground layer. */
public void setForegroundTint(@ColorInt int tintColor) {
FastBitmapDrawable icon = getIcon();