Merge "Dismiss screenshot UI on back gesture/button." into rvc-dev am: 50886ed9a2 am: d20f039ec7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11875978 Change-Id: Iece90054bbf449e37317aa5bdcce68a84fee5887
This commit is contained in:
@@ -69,6 +69,7 @@ import android.util.Log;
|
|||||||
import android.util.MathUtils;
|
import android.util.MathUtils;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
@@ -374,6 +375,20 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
|
|||||||
|
|
||||||
// Inflate the screenshot layout
|
// Inflate the screenshot layout
|
||||||
mScreenshotLayout = LayoutInflater.from(mContext).inflate(R.layout.global_screenshot, null);
|
mScreenshotLayout = LayoutInflater.from(mContext).inflate(R.layout.global_screenshot, null);
|
||||||
|
mScreenshotLayout.setOnKeyListener(new View.OnKeyListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
dismissScreenshot("back pressed", true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Get focus so that the key events go to the layout.
|
||||||
|
mScreenshotLayout.setFocusableInTouchMode(true);
|
||||||
|
mScreenshotLayout.requestFocus();
|
||||||
|
|
||||||
mScreenshotAnimatedView =
|
mScreenshotAnimatedView =
|
||||||
mScreenshotLayout.findViewById(R.id.global_screenshot_animated_view);
|
mScreenshotLayout.findViewById(R.id.global_screenshot_animated_view);
|
||||||
mScreenshotAnimatedView.setClipToOutline(true);
|
mScreenshotAnimatedView.setClipToOutline(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user