diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt index 8ed994966c..9e5ffc9dc4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarPinController.kt @@ -19,7 +19,6 @@ package com.android.launcher3.taskbar.bubbles import android.annotation.SuppressLint import android.content.Context import android.graphics.Point -import android.graphics.RectF import android.view.Gravity.BOTTOM import android.view.Gravity.LEFT import android.view.Gravity.RIGHT @@ -37,44 +36,29 @@ import com.android.wm.shell.common.bubbles.BubbleBarLocation class BubbleBarPinController( private val context: Context, private val container: FrameLayout, - private val screenSizeProvider: () -> Point -) : BaseBubblePinController() { + screenSizeProvider: () -> Point +) : BaseBubblePinController(screenSizeProvider) { private lateinit var bubbleBarViewController: BubbleBarViewController private lateinit var bubbleStashController: BubbleStashController + private var exclRectWidth: Float = 0f + private var exclRectHeight: Float = 0f + private var dropTargetView: View? = null fun init(bubbleControllers: BubbleControllers) { bubbleBarViewController = bubbleControllers.bubbleBarViewController bubbleStashController = bubbleControllers.bubbleStashController + exclRectWidth = context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_width) + exclRectHeight = context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_height) } - override fun getScreenCenterX(): Int { - return screenSizeProvider.invoke().x / 2 + override fun getExclusionRectWidth(): Float { + return exclRectWidth } - override fun getExclusionRect(): RectF { - val rect = - RectF( - 0f, - 0f, - context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_width), - context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_height) - ) - val screenSize = screenSizeProvider.invoke() - val middleX = screenSize.x / 2 - // Center it around the bottom center of the screen - rect.offsetTo(middleX - rect.width() / 2, screenSize.y - rect.height()) - return rect - } - - override fun createDropTargetView(): View { - return LayoutInflater.from(context) - .inflate(R.layout.bubble_bar_drop_target, container, false) - .also { view -> - dropTargetView = view - container.addView(view) - } + override fun getExclusionRectHeight(): Float { + return exclRectHeight } override fun getDropTargetView(): View? { @@ -86,6 +70,15 @@ class BubbleBarPinController( dropTargetView = null } + override fun createDropTargetView(): View { + return LayoutInflater.from(context) + .inflate(R.layout.bubble_bar_drop_target, container, false) + .also { view -> + dropTargetView = view + container.addView(view) + } + } + @SuppressLint("RtlHardcoded") override fun updateLocation(location: BubbleBarLocation) { val onLeft = location.isOnLeft(container.isLayoutRtl)