Update bubble bar pin controller after parent class refactor
Some of the common logic related to exclusion zone calculation moved to parent class. Update the bubble bar controller based on the refactor. Bug: 330585402 Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Test: run shell unit tests, manual test Change-Id: I5910f76f26aaf6d15a5f6f7c1399b36b80296aeb
This commit is contained in:
1 parent
1754a6a2b2
commit
79a5acf475
1 file changed
+20
-27
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user