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

Commit aceb4ed8 authored by Mady Mellor's avatar Mady Mellor
Browse files

Set a view id for the bubble dismiss view (shell)

There is a flake in the drag to dismiss bubble test, I think it's
because sometimes it misses the dismiss target since the test drags
the bubble to the bottom of the screen instead of the target location.

In attempt to fix this I'm setting an ID on the dismiss target to
look up where it is on screen and drag the bubble to it directly.

Test: treehugger
Bug: 296933279
Change-Id: I6c7040cc05d008604b863b066036b4e06e2dfc72
parent 3697f77a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -42,4 +42,6 @@
    <item type="id" name="action_move_top_right"/>
    <item type="id" name="action_move_bottom_left"/>
    <item type="id" name="action_move_bottom_right"/>

    <item type="id" name="dismiss_view"/>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.wm.shell.common.bubbles.DismissView

fun DismissView.setup() {
    setup(DismissView.Config(
            dismissViewResId = R.id.dismiss_view,
            targetSizeResId = R.dimen.dismiss_circle_size,
            iconSizeResId = R.dimen.dismiss_target_x_size,
            bottomMarginResId = R.dimen.floating_dismiss_bottom_margin,
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ class DismissView(context: Context) : FrameLayout(context) {
     * @see [setup] method
     */
    data class Config(
            /** The resource id to set on the dismiss target circle view */
            val dismissViewResId: Int,
            /** dimen resource id of the dismiss target circle view size */
            @DimenRes val targetSizeResId: Int,
            /** dimen resource id of the icon size in the dismiss target */
@@ -121,6 +123,7 @@ class DismissView(context: Context) : FrameLayout(context) {
        setBackgroundDrawable(gradientDrawable)

        // Setup DismissCircleView
        circle.id = config.dismissViewResId
        circle.setup(config.backgroundResId, config.iconResId, config.iconSizeResId)
        val targetSize: Int = resources.getDimensionPixelSize(config.targetSizeResId)
        circle.layoutParams = LayoutParams(targetSize, targetSize,