Fixes #1889268.
Dragging an icon out of a folder was showing a gray background. This was due to the icon's drawing cache background color. This fix simply temporarily resets that color when capturing the view into a Bitmap.
This commit is contained in:
@@ -195,8 +195,13 @@ public class DragLayer extends FrameLayout implements DragController {
|
|||||||
|
|
||||||
boolean willNotCache = v.willNotCacheDrawing();
|
boolean willNotCache = v.willNotCacheDrawing();
|
||||||
v.setWillNotCacheDrawing(false);
|
v.setWillNotCacheDrawing(false);
|
||||||
v.buildDrawingCache();
|
|
||||||
|
|
||||||
|
// Reset the drawing cache background color to fully transparent
|
||||||
|
// for the duration of this operation
|
||||||
|
int color = v.getDrawingCacheBackgroundColor();
|
||||||
|
v.setDrawingCacheBackgroundColor(0);
|
||||||
|
|
||||||
|
v.buildDrawingCache();
|
||||||
Bitmap viewBitmap = v.getDrawingCache();
|
Bitmap viewBitmap = v.getDrawingCache();
|
||||||
int width = viewBitmap.getWidth();
|
int width = viewBitmap.getWidth();
|
||||||
int height = viewBitmap.getHeight();
|
int height = viewBitmap.getHeight();
|
||||||
@@ -218,6 +223,7 @@ public class DragLayer extends FrameLayout implements DragController {
|
|||||||
mDragBitmap = Bitmap.createBitmap(viewBitmap, 0, 0, width, height, scale, true);
|
mDragBitmap = Bitmap.createBitmap(viewBitmap, 0, 0, width, height, scale, true);
|
||||||
v.destroyDrawingCache();
|
v.destroyDrawingCache();
|
||||||
v.setWillNotCacheDrawing(willNotCache);
|
v.setWillNotCacheDrawing(willNotCache);
|
||||||
|
v.setDrawingCacheBackgroundColor(color);
|
||||||
|
|
||||||
final Bitmap dragBitmap = mDragBitmap;
|
final Bitmap dragBitmap = mDragBitmap;
|
||||||
mBitmapOffsetX = (dragBitmap.getWidth() - width) / 2;
|
mBitmapOffsetX = (dragBitmap.getWidth() - width) / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user