Allow Workspace Scrim to be colored per state
Make it possible to set the color of workspace scrim to a different color
per state. Motivated by making Overview Scrim and All Apps scrims different
colors.
Bug: 186253733
Test: Local build and flash
Change-Id: Id7c38ce3c9173308eedfcb7592ececa7bd6bf220
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index 803f8d2..b56c012 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -19,6 +19,8 @@
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.FloatProperty;
import android.util.IntProperty;
@@ -135,6 +137,22 @@
}
};
+ public static final IntProperty<View> VIEW_BACKGROUND_COLOR =
+ new IntProperty<View>("backgroundColor") {
+ @Override
+ public void setValue(View view, int color) {
+ view.setBackgroundColor(color);
+ }
+
+ @Override
+ public Integer get(View view) {
+ if (!(view.getBackground() instanceof ColorDrawable)) {
+ return Color.TRANSPARENT;
+ }
+ return ((ColorDrawable) view.getBackground()).getColor();
+ }
+ };
+
/**
* Utility method to create an {@link AnimatorListener} which executes a callback on animation
* cancel.