Implement All Apps Icon upto the visual Specs.
Test: Visual Bug: 267382941 Change-Id: If675c2f4767014598b23d8a2c2e684f5a8fb4f19
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user