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

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
......@@ -642,16 +642,18 @@ class GlobalScreenshot {
view.setVisibility(View.GONE);
mWindowManager.removeView(mScreenshotSelectorLayout);
final Rect rect = view.getSelectionRect();
if (rect != null) {
if (rect.width() != 0 && rect.height() != 0) {
// Need mScreenshotSelectorLayout to handle it after the view disappears
mScreenshotSelectorLayout.post(new Runnable() {
public void run() {
takeScreenshot(finisher, statusBarVisible, navBarVisible,
rect.left, rect.top, rect.width(), rect.height());
}
});
}
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() {
takeScreenshot(finisher, statusBarVisible, navBarVisible,
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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment