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

Commit c3e36a62 authored by Yein Jo's avatar Yein Jo
Browse files

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
parent d0c90f57
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -84,6 +84,22 @@
            android:clickable="true"
            android:clickable="true"
            app:layout_constraintStart_toStartOf="@id/screenshot_preview_border"
            app:layout_constraintStart_toStartOf="@id/screenshot_preview_border"
            app:layout_constraintBottom_toBottomOf="@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
        <ImageView
            android:id="@+id/screenshot_badge"
            android:id="@+id/screenshot_badge"
            android:layout_width="56dp"
            android:layout_width="56dp"
+1 −1
Original line number Original line Diff line number Diff line
@@ -103,7 +103,7 @@ constructor(
        }
        }
        screenshotPreview = view.screenshotPreview
        screenshotPreview = view.screenshotPreview
        thumbnailObserver.setViews(
        thumbnailObserver.setViews(
            view.screenshotPreview,
            view.blurredScreenshotPreview,
            view.requireViewById(R.id.screenshot_preview_border)
            view.requireViewById(R.id.screenshot_preview_border)
        )
        )
    }
    }
+2 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@ import kotlin.math.max
class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
class ScreenshotShelfView(context: Context, attrs: AttributeSet? = null) :
    FrameLayout(context, attrs) {
    FrameLayout(context, attrs) {
    lateinit var screenshotPreview: ImageView
    lateinit var screenshotPreview: ImageView
    lateinit var blurredScreenshotPreview: ImageView
    private lateinit var screenshotStatic: ViewGroup
    private lateinit var screenshotStatic: ViewGroup
    var onTouchInterceptListener: ((MotionEvent) -> Boolean)? = null
    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.
        // Get focus so that the key events go to the layout.
        isFocusableInTouchMode = true
        isFocusableInTouchMode = true
        screenshotPreview = requireViewById(R.id.screenshot_preview)
        screenshotPreview = requireViewById(R.id.screenshot_preview)
        blurredScreenshotPreview = requireViewById(R.id.screenshot_preview_blur)
        screenshotStatic = requireViewById(R.id.screenshot_static)
        screenshotStatic = requireViewById(R.id.screenshot_static)
        actionsContainerBackground = requireViewById(R.id.actions_container_background)
        actionsContainerBackground = requireViewById(R.id.actions_container_background)
        dismissButton = requireViewById(R.id.screenshot_dismiss_button)
        dismissButton = requireViewById(R.id.screenshot_dismiss_button)
+3 −0
Original line number Original line Diff line number Diff line
@@ -55,8 +55,10 @@ object ScreenshotShelfViewBinder {
        view.onTouchInterceptListener = { swipeGestureListener.onMotionEvent(it) }
        view.onTouchInterceptListener = { swipeGestureListener.onMotionEvent(it) }


        val previewView: ImageView = view.requireViewById(R.id.screenshot_preview)
        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)
        val previewBorder = view.requireViewById<View>(R.id.screenshot_preview_border)
        previewView.clipToOutline = true
        previewView.clipToOutline = true
        previewViewBlur.clipToOutline = true
        val actionsContainer: LinearLayout = view.requireViewById(R.id.screenshot_actions)
        val actionsContainer: LinearLayout = view.requireViewById(R.id.screenshot_actions)
        val dismissButton = view.requireViewById<View>(R.id.screenshot_dismiss_button)
        val dismissButton = view.requireViewById<View>(R.id.screenshot_dismiss_button)
        dismissButton.visibility = if (viewModel.showDismissButton) View.VISIBLE else View.GONE
        dismissButton.visibility = if (viewModel.showDismissButton) View.VISIBLE else View.GONE
@@ -72,6 +74,7 @@ object ScreenshotShelfViewBinder {
                        viewModel.preview.collect { bitmap ->
                        viewModel.preview.collect { bitmap ->
                            if (bitmap != null) {
                            if (bitmap != null) {
                                setScreenshotBitmap(previewView, bitmap)
                                setScreenshotBitmap(previewView, bitmap)
                                setScreenshotBitmap(previewViewBlur, bitmap)
                                previewView.visibility = View.VISIBLE
                                previewView.visibility = View.VISIBLE
                                previewBorder.visibility = View.VISIBLE
                                previewBorder.visibility = View.VISIBLE
                            } else {
                            } else {