Skip to content

Commit

Permalink
Clean up screenshot if nothing selected
Browse files Browse the repository at this point in the history
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: Vasyl Gello <vasek.gello@gmail.com>

Change-Id: Ib46221df2a2a70bc5a901107ca6aa4268a0568f2
  • Loading branch information
ldzhamov authored and SKULSHADY committed Mar 18, 2019
1 parent 6edf389 commit 76e5e4e
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,18 @@ public boolean onTouch(View v, MotionEvent event) {
view.setVisibility(View.GONE);
mWindowManager.removeView(mScreenshotSelectorLayout);
final Rect rect = view.getSelectionRect();
if (rect != null && !rect.isEmpty()) {
// Need mScreenshotSelectorLayout to handle it after the view disappears
mScreenshotSelectorLayout.post(new Runnable() {
if (rect != null && rect.width() != 0 && rect.height() != 0) {
// Need mScreenshotLayout to handle it after the view disappears
mScreenshotLayout.post(new Runnable() {
public void run() {
takeScreenshot(finisher, statusBarVisible, navBarVisible,
rect);
}
});
} else {
// Clean up if nothing is selected
// to initialize a new screenshot later
finisher.run();
}

view.stopSelection();
Expand Down

2 comments on commit 76e5e4e

@neekless
Copy link

@neekless neekless commented on 76e5e4e Mar 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit broke partial screenshots.
I think
mScreenshotLayout.post(new Runnable() {
needs to be changed back to
mScreenshotSelectorLayout.post(new Runnable() {
This commit seems to come from ROMs that don't use ScreenshotSelectorLayout but havoc uses it.

@SKULSHADY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I'll look into it.

Please sign in to comment.