diff options
| author | 2024-05-02 18:23:52 +0000 | |
|---|---|---|
| committer | 2024-05-03 03:00:17 +0000 | |
| commit | c3e36a6299aa3cd783d1946391ffb9c6f2f8c4cc (patch) | |
| tree | 3f1dd2358bf153c3130c5408088606f20dae95e7 | |
| parent | d0c90f574e7afb316fbd2d59db979cd94452b607 (diff) | |
Add thumbnail blur view for ripple reveal effect in the screenshot thumbnail
Bug: 335315940
Bug: 329659738
Test: Manual
Flag: ACONFIG com.android.systemui.screenshot_shelf_ui2 TRUNKFOOD
Change-Id: I5b998ca1d91ab07a06fa4888433406baa6d45944
4 files changed, 22 insertions, 1 deletions
diff --git a/packages/SystemUI/res/layout/screenshot_shelf.xml b/packages/SystemUI/res/layout/screenshot_shelf.xml index 7adfa6ca1c29..e778c77d63a5 100644 --- a/packages/SystemUI/res/layout/screenshot_shelf.xml +++ b/packages/SystemUI/res/layout/screenshot_shelf.xml @@ -84,6 +84,22 @@ android:clickable="true" app:layout_constraintStart_toStartOf="@id/screenshot_preview_border" app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"/> + <!-- Keep the same dimension with screenshot_preview. --> + <ImageView + android:id="@+id/screenshot_preview_blur" + android:layout_width="@dimen/overlay_x_scale" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/overlay_border_width" + android:layout_marginBottom="@dimen/overlay_border_width" + android:layout_gravity="center" + android:elevation="4dp" + android:contentDescription="@string/screenshot_edit_description" + android:scaleType="fitEnd" + android:background="@drawable/overlay_preview_background" + android:adjustViewBounds="true" + android:visibility="invisible" + app:layout_constraintStart_toStartOf="@id/screenshot_preview_border" + app:layout_constraintBottom_toBottomOf="@id/screenshot_preview_border"/> <ImageView android:id="@+id/screenshot_badge" android:layout_width="56dp" diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotShelfViewProxy.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotShelfViewProxy.kt index 9b754f3271a7..9b5e71827ead 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotShelfViewProxy.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ScreenshotShelfViewProxy.kt @@ -103,7 +103,7 @@ constructor( } screenshotPreview = view.screenshotPreview thumbnailObserver.setViews( - view.screenshotPreview, + view.blurredScreenshotPreview, view.requireViewById(R.id.screenshot_preview_border) ) } diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt index 4437bf533353..21ac23b1ce15 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ui/ScreenshotShelfView.kt @@ -35,6 +35,7 @@ import kotlin.math.max class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) { lateinit var screenshotPreview: ImageView + lateinit var blurredScreenshotPreview: ImageView private lateinit var screenshotStatic: ViewGroup var onTouchInterceptListener: ((MotionEvent) -> Boolean)? = null @@ -48,6 +49,7 @@ class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) : // Get focus so that the key events go to the layout. isFocusableInTouchMode = true screenshotPreview = requireViewById(R.id.screenshot_preview) + blurredScreenshotPreview = requireViewById(R.id.screenshot_preview_blur) screenshotStatic = requireViewById(R.id.screenshot_static) actionsContainerBackground = requireViewById(R.id.actions_container_background) dismissButton = requireViewById(R.id.screenshot_dismiss_button) diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/ui/binder/ScreenshotShelfViewBinder.kt b/packages/SystemUI/src/com/android/systemui/screenshot/ui/binder/ScreenshotShelfViewBinder.kt index 734a530efea7..bc35e6b17345 100644 --- a/packages/SystemUI/src/com/android/systemui/screenshot/ui/binder/ScreenshotShelfViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/screenshot/ui/binder/ScreenshotShelfViewBinder.kt @@ -55,8 +55,10 @@ object ScreenshotShelfViewBinder { view.onTouchInterceptListener = { swipeGestureListener.onMotionEvent(it) } val previewView: ImageView = view.requireViewById(R.id.screenshot_preview) + val previewViewBlur: ImageView = view.requireViewById(R.id.screenshot_preview_blur) val previewBorder = view.requireViewById<View>(R.id.screenshot_preview_border) previewView.clipToOutline = true + previewViewBlur.clipToOutline = true val actionsContainer: LinearLayout = view.requireViewById(R.id.screenshot_actions) val dismissButton = view.requireViewById<View>(R.id.screenshot_dismiss_button) dismissButton.visibility = if (viewModel.showDismissButton) View.VISIBLE else View.GONE @@ -72,6 +74,7 @@ object ScreenshotShelfViewBinder { viewModel.preview.collect { bitmap -> if (bitmap != null) { setScreenshotBitmap(previewView, bitmap) + setScreenshotBitmap(previewViewBlur, bitmap) previewView.visibility = View.VISIBLE previewBorder.visibility = View.VISIBLE } else { |