mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Overview - add the ability to color scrim task views.
Bug: 184202238 Test: local build and flash Change-Id: If700cb6dffc3966fe860c40d98d40a5899c236e4
This commit is contained in:
@@ -37,6 +37,8 @@ import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.LightingColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Point;
|
||||
@@ -64,6 +66,7 @@ import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.os.BuildCompat;
|
||||
|
||||
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
|
||||
@@ -732,6 +735,23 @@ public final class Utilities {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a color filter that blends a color into the destination based on a scalable amout.
|
||||
*
|
||||
* @param color to blend in.
|
||||
* @param tintAmount [0-1] 0 no tinting, 1 full color.
|
||||
* @return ColorFilter for tinting, or {@code null} if no filter is needed.
|
||||
*/
|
||||
public static ColorFilter makeColorTintingColorFilter(int color, float tintAmount) {
|
||||
if (tintAmount == 0f) {
|
||||
return null;
|
||||
}
|
||||
return new LightingColorFilter(
|
||||
// This isn't blending in white, its making a multiplication mask for the base color
|
||||
ColorUtils.blendARGB(Color.WHITE, 0, tintAmount),
|
||||
ColorUtils.blendARGB(0, color, tintAmount));
|
||||
}
|
||||
|
||||
private static class FixedSizeEmptyDrawable extends ColorDrawable {
|
||||
|
||||
private final int mSize;
|
||||
|
||||
Reference in New Issue
Block a user