Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08693931 authored by Lyubo's avatar Lyubo Committed by Michael W
Browse files

Clean up screenshot if nothing selected



If rect is null, run the finisher so the screenshot logic
is cleaned up and prepared for next screenshot. This fixes
BUGBASH-1831.

[basilgello: combined two if-clauses to avoid double else,
  inspired by @BadDaemon]
Signed-off-by: default avatarVasyl Gello <vasek.gello@gmail.com>

Change-Id: Ib46221df2a2a70bc5a901107ca6aa4268a0568f2
parent f4cebf64
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -642,8 +642,7 @@ class GlobalScreenshot {
                        view.setVisibility(View.GONE);
                        mWindowManager.removeView(mScreenshotSelectorLayout);
                        final Rect rect = view.getSelectionRect();
                        if (rect != null) {
                            if (rect.width() != 0 && rect.height() != 0) {
                        if (rect != null && rect.width() != 0 && rect.height() != 0) {
                            // Need mScreenshotSelectorLayout to handle it after the view disappears
                            mScreenshotSelectorLayout.post(new Runnable() {
                                public void run() {
@@ -651,7 +650,10 @@ class GlobalScreenshot {
                                            rect.left, rect.top, rect.width(), rect.height());
                                }
                            });
                            }
                        } else {
                            // Clean up if nothing is selected
                            // to initialize a new screenshot later
                            finisher.run();
                        }

                        view.stopSelection();