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

Unverified Commit 0c2d0bff authored by Pranav Vashi's avatar Pranav Vashi Committed by Michael Bestas
Browse files

SystemUI: screenshot: add delay for long-press partial screenshot



* Otherwise, we get power menu in screenshot.

Signed-off-by: default avatarPranav Vashi <neobuddy89@gmail.com>
Change-Id: I018994c16eedfabffd6b7c291377668701c0e00d
parent e306e7ec
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1133,8 +1133,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
            super(R.drawable.ic_screenshot, R.string.global_action_screenshot);
        }

        @Override
        public void onPress() {
        private void takeScreenshot(int type) {
            // Add a little delay before executing, to give the
            // dialog a chance to go away before it takes a
            // screenshot.
@@ -1142,7 +1141,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    mScreenshotHelper.takeScreenshot(TAKE_SCREENSHOT_FULLSCREEN, true, true,
                    mScreenshotHelper.takeScreenshot(type, true, true,
                            SCREENSHOT_GLOBAL_ACTIONS, mHandler, null);
                    mMetricsLogger.action(MetricsEvent.ACTION_SCREENSHOT_POWER_MENU);
                    mUiEventLogger.log(GlobalActionsEvent.GA_SCREENSHOT_PRESS);
@@ -1150,10 +1149,15 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
            }, mDialogPressDelay);
        }

        @Override
        public void onPress() {
            takeScreenshot(TAKE_SCREENSHOT_FULLSCREEN);
        }

        @Override
        public boolean onLongPress() {
            mScreenshotHelper.takeScreenshot(TAKE_SCREENSHOT_SELECTED_REGION, true, true,
                    SCREENSHOT_GLOBAL_ACTIONS, mHandler, null);
            takeScreenshot(TAKE_SCREENSHOT_SELECTED_REGION);

            return true;
        }