Merge "Properly desaturating the dragview if the icon is disabled" into ub-launcher3-dorval-polish
This commit is contained in:
committed by
Android (Google) Code Review
commit
edfc0192ce
@@ -36,8 +36,6 @@ import com.android.launcher3.graphics.IconPalette;
|
||||
|
||||
public class FastBitmapDrawable extends Drawable {
|
||||
|
||||
private static final int[] STATE_PRESSED = new int[] {android.R.attr.state_pressed};
|
||||
|
||||
private static final float PRESSED_BRIGHTNESS = 100f / 255f;
|
||||
private static final float DISABLED_DESATURATION = 1f;
|
||||
private static final float DISABLED_BRIGHTNESS = 0.5f;
|
||||
@@ -184,6 +182,11 @@ public class FastBitmapDrawable extends Drawable {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorFilter getColorFilter() {
|
||||
return mPaint.getColorFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onStateChange(int[] state) {
|
||||
boolean isPressed = false;
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.content.pm.LauncherActivityInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.ColorMatrix;
|
||||
import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
@@ -245,6 +246,15 @@ public class DragView extends FrameLayout {
|
||||
addView(mBgImageView);
|
||||
addView(mFgImageView);
|
||||
setWillNotDraw(true);
|
||||
|
||||
if (info.isDisabled()) {
|
||||
FastBitmapDrawable d = new FastBitmapDrawable(null);
|
||||
d.setIsDisabled(true);
|
||||
ColorFilter cf = d.getColorFilter();
|
||||
mBgImageView.setColorFilter(cf);
|
||||
mFgImageView.setColorFilter(cf);
|
||||
mBadge.setColorFilter(cf);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user