Revert "fetch and update shortcut icons in background thread"
This reverts commit 4ec390e490.
Reason for revert: the code change introduces significant delay when saving deep shortcut icons in cache.
Bug: 142514365
Change-Id: If7a69844aba7f32690ff347f2db11f0a8041b9e4
This commit is contained in:
1 parent
4ec390e490
commit
01c80d7a00
5 files changed
+27
-66
No files matched your search
@@ -26,7 +26,6 @@ import android.view.View;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.graphics.DragPreviewProvider;
|
||||
import com.android.launcher3.icons.BitmapRenderer;
|
||||
|
||||
/**
|
||||
* Extension of {@link DragPreviewProvider} which generates bitmaps scaled to the default icon size.
|
||||
@@ -40,22 +39,22 @@ public class ShortcutDragPreviewProvider extends DragPreviewProvider {
|
||||
mPositionShift = shift;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap createDragBitmap() {
|
||||
int size = Launcher.getLauncher(mView.getContext()).getDeviceProfile().iconSizePx;
|
||||
return BitmapRenderer.createHardwareBitmap(
|
||||
size + blurSizeOutline,
|
||||
size + blurSizeOutline,
|
||||
(c) -> drawDragViewOnBackground(c, size));
|
||||
}
|
||||
|
||||
private void drawDragViewOnBackground(Canvas canvas, float size) {
|
||||
Drawable d = mView.getBackground();
|
||||
Rect bounds = getDrawableBounds(d);
|
||||
|
||||
int size = Launcher.getLauncher(mView.getContext()).getDeviceProfile().iconSizePx;
|
||||
final Bitmap b = Bitmap.createBitmap(
|
||||
size + blurSizeOutline,
|
||||
size + blurSizeOutline,
|
||||
Bitmap.Config.ARGB_8888);
|
||||
|
||||
Canvas canvas = new Canvas(b);
|
||||
canvas.translate(blurSizeOutline / 2, blurSizeOutline / 2);
|
||||
canvas.scale(size / bounds.width(), size / bounds.height(), 0, 0);
|
||||
canvas.scale(((float) size) / bounds.width(), ((float) size) / bounds.height(), 0, 0);
|
||||
canvas.translate(bounds.left, bounds.top);
|
||||
d.draw(canvas);
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user