Using color filter when animating the drop target instead to TransitionDrawable
> No more flickering when crossfading between two bitmaps in small duration > Allows us to control the color directly without depending on the assets Change-Id: Ie7ed8bb94baf560e9b939cca624ed1bad457732c
This commit is contained in:
1 parent
c393b0765d
commit
3a644ed1ce
24 files changed
+59
-94
No files matched your search
@@ -38,7 +38,7 @@ import com.android.launcher3.util.Thunk;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class DragView extends View {
|
||||
public static int COLOR_CHANGE_DURATION = 200;
|
||||
public static int COLOR_CHANGE_DURATION = 120;
|
||||
|
||||
@Thunk static float sDragAlpha = 1f;
|
||||
|
||||
@@ -249,8 +249,7 @@ public class DragView extends View {
|
||||
m1.setSaturation(0);
|
||||
|
||||
ColorMatrix m2 = new ColorMatrix();
|
||||
m2.setScale(Color.red(color) / 255f, Color.green(color) / 255f,
|
||||
Color.blue(color) / 255f, Color.alpha(color) / 255f);
|
||||
setColorScale(color, m2);
|
||||
m1.postConcat(m2);
|
||||
|
||||
if (Utilities.isLmpOrAbove()) {
|
||||
@@ -355,4 +354,9 @@ public class DragView extends View {
|
||||
mDragLayer.removeView(DragView.this);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setColorScale(int color, ColorMatrix target) {
|
||||
target.setScale(Color.red(color) / 255f, Color.green(color) / 255f,
|
||||
Color.blue(color) / 255f, Color.alpha(color) / 255f);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user