diff --git a/packages/SystemUI/res/drawable/ic_cancel_24.xml b/packages/SystemUI/res/drawable/ic_cancel_24.xml
new file mode 100644
index 0000000000000..8ab28ddb680dc
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_cancel_24.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/screenshot_cancel.xml b/packages/SystemUI/res/drawable/screenshot_cancel.xml
new file mode 100644
index 0000000000000..be3c5983bb2e6
--- /dev/null
+++ b/packages/SystemUI/res/drawable/screenshot_cancel.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/global_screenshot.xml b/packages/SystemUI/res/layout/global_screenshot.xml
index 1f7def2bc9568..d0151fff95c45 100644
--- a/packages/SystemUI/res/layout/global_screenshot.xml
+++ b/packages/SystemUI/res/layout/global_screenshot.xml
@@ -55,10 +55,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:elevation="8dp"
+ android:elevation="@dimen/screenshot_preview_elevation"
android:visibility="gone"
android:background="@drawable/screenshot_rounded_corners"
android:adjustViewBounds="true"/>
+
+
+
1.0
@*android:dimen/notification_text_size
- @*android:dimen/notification_content_margin_end
+ @*android:dimen/notification_content_margin_end
+
100dp
@@ -267,7 +268,9 @@
15dp
- @*android:dimen/notification_header_icon_size_ambient
+
+ @*android:dimen/notification_header_icon_size_ambient
+
16dp
@@ -299,8 +302,11 @@
20dp
20dp
80dp
+ 8dp
48dp
16dp
+ 48dp
+ 8dp
32dp
10dp
10dp
@@ -597,10 +603,14 @@
- @dimen/notification_divider_height
+
+ @dimen/notification_divider_height
+
- @*android:dimen/notification_content_margin_top
+
+ @*android:dimen/notification_content_margin_top
+
53dp
@@ -1061,9 +1071,12 @@
83
16
- - 0
+ -
+ 0
+
- - 24
+ - 24
+
80
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 880b8f8776e8a..4f38a15824a49 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -69,6 +69,7 @@ import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.Interpolator;
+import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -143,7 +144,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
private static final float BACKGROUND_ALPHA = 0.5f;
private static final float SCREENSHOT_DROP_IN_MIN_SCALE = 0.725f;
private static final float ROUNDED_CORNER_RADIUS = .05f;
- private static final long SCREENSHOT_CORNER_TIMEOUT_MILLIS = 8000;
+ private static final long SCREENSHOT_CORNER_TIMEOUT_MILLIS = 6000;
private static final int MESSAGE_CORNER_TIMEOUT = 2;
private final ScreenshotNotificationsController mNotificationsController;
@@ -162,6 +163,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
private final HorizontalScrollView mActionsContainer;
private final LinearLayout mActionsView;
private final ImageView mBackgroundProtection;
+ private final FrameLayout mDismissButton;
private Bitmap mScreenBitmap;
private AnimatorSet mScreenshotAnimation;
@@ -170,6 +172,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
private float mScreenshotOffsetYPx;
private float mScreenshotHeightPx;
private float mCornerScale;
+ private float mDismissButtonSize;
private AsyncTask mSaveInBgTask;
@@ -216,19 +219,14 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
mActionsView = mScreenshotLayout.findViewById(R.id.global_screenshot_actions);
mBackgroundProtection = mScreenshotLayout.findViewById(
R.id.global_screenshot_actions_background);
+ mDismissButton = mScreenshotLayout.findViewById(R.id.global_screenshot_dismiss_button);
+ mDismissButton.setOnClickListener(view -> clearScreenshot("dismiss_button"));
mScreenshotFlash = mScreenshotLayout.findViewById(R.id.global_screenshot_flash);
mScreenshotSelectorView = mScreenshotLayout.findViewById(R.id.global_screenshot_selector);
mScreenshotLayout.setFocusable(true);
mScreenshotSelectorView.setFocusable(true);
mScreenshotSelectorView.setFocusableInTouchMode(true);
- mScreenshotLayout.setOnTouchListener((v, event) -> {
- if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
- clearScreenshot("tap_outside");
- }
- // Intercept and ignore all touch events
- return true;
- });
// Setup the window that we are going to use
mWindowLayoutParams = new WindowManager.LayoutParams(
@@ -254,6 +252,8 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
resources.getDimensionPixelSize(R.dimen.screenshot_action_container_offset_y);
mCornerScale = resources.getDimensionPixelSize(R.dimen.global_screenshot_x_scale)
/ (float) mDisplayMetrics.widthPixels;
+ mDismissButtonSize = resources.getDimensionPixelSize(
+ R.dimen.screenshot_dismiss_button_tappable_size);
// Setup the Camera shutter sound
mCameraSound = new MediaActionSound();
@@ -271,6 +271,9 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
Rect actionsRect = new Rect();
mActionsContainer.getBoundsOnScreen(actionsRect);
touchRegion.op(actionsRect, Region.Op.UNION);
+ Rect dismissRect = new Rect();
+ mDismissButton.getBoundsOnScreen(dismissRect);
+ touchRegion.op(dismissRect, Region.Op.UNION);
inoutInfo.touchableRegion.set(touchRegion);
}
@@ -408,6 +411,7 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
mActionsContainer.setVisibility(View.GONE);
mBackgroundView.setVisibility(View.GONE);
mBackgroundProtection.setAlpha(0f);
+ mDismissButton.setVisibility(View.GONE);
mScreenshotView.setVisibility(View.GONE);
mScreenshotView.setLayerType(View.LAYER_TYPE_NONE, null);
}
@@ -615,6 +619,17 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
mScreenshotView.setTranslationX(t * finalPos.x);
mScreenshotView.setTranslationY(t * finalPos.y);
});
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ Rect bounds = new Rect();
+ mScreenshotView.getBoundsOnScreen(bounds);
+ mDismissButton.setX(bounds.right - mDismissButtonSize / 2f);
+ mDismissButton.setY(bounds.top - mDismissButtonSize / 2f);
+ mDismissButton.setVisibility(View.VISIBLE);
+ }
+ });
return anim;
}
@@ -686,14 +701,6 @@ public class GlobalScreenshot implements ViewTreeObserver.OnComputeInternalInset
mBackgroundProtection.setAlpha(t);
mActionsContainer.setY(mDisplayMetrics.heightPixels - actionsViewHeight * t);
});
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- mScreenshotView.requestFocus();
- mScreenshotView.setElevation(50);
- }
- });
return animator;
}