From c3064ce9ac67cae6482e0e52caadb135d1126e3b Mon Sep 17 00:00:00 2001 From: Yash-Garg Date: Tue, 20 Sep 2022 19:53:39 +0530 Subject: [PATCH] fix crashing of launcher after dragging app icon by saving and restoring canvas Signed-off-by: Yash-Garg --- .../blisslauncher/core/customviews/BlissDragShadowBuilder.java | 2 ++ .../e/blisslauncher/features/launcher/LauncherActivity.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlissDragShadowBuilder.java b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlissDragShadowBuilder.java index da870aeae2..d81c756470 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlissDragShadowBuilder.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlissDragShadowBuilder.java @@ -65,10 +65,12 @@ public class BlissDragShadowBuilder extends View.DragShadowBuilder { @Override public void onDrawShadow(Canvas canvas) { + canvas.save(); // Draws the ColorDrawable in the Canvas passed in from the system. canvas.scale(mScaleFactor.x / (float) getView().getWidth(), mScaleFactor.y / (float) getView().getHeight()); getView().draw(canvas); + canvas.restore(); } } diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index 6eaeb6a0fa..30ff2d7505 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -1777,7 +1777,7 @@ public class LauncherActivity extends AppCompatActivity implements dragShadowBuilder = new BlissDragShadowBuilder( icon, (event.getX() < 0 ? 0 : event.getX()), (event.getY() < 0 ? 0 : event.getY())); - icon.startDrag(null, dragShadowBuilder, iconView, 0); + icon.startDragAndDrop(null, dragShadowBuilder, iconView, 0); if (iconView.getParent().getParent() instanceof HorizontalPager) { parentPage = getCurrentAppsPageNumber(); } else { -- GitLab