Add TaskContentView parent to TaskThumbnailViewHeader and TTV
- Add TaskContentView parent view - Extract TaskThumbnailViewHeader logic and any related state out of TaskThumbnailView and move to TaskContentView - Use vertical LinearLayoutManager to hold the TaskThumbnailViewHeader and TaskThumbnailView - Rename TaskThumbnailViewHeader to TaskHeaderView. Rename xml and state similarly Bug: 397889146 Flag: EXEMPT. Refactor Test: Refactoring CL. Existing unit tests still pass. Change-Id: Ie31f35c6617aab272f984a6beb3e4cb8f58e3ce9
This commit is contained in:
1 parent
aee4b11336
commit
e0cc96df62
28 files changed
+700
-464
No files matched your search
@@ -275,7 +275,7 @@ open class LandscapePagedViewHandler : RecentsPagedOrientationHandler {
|
||||
desiredTaskId: Int,
|
||||
banner: View,
|
||||
): Pair<Float, Float> {
|
||||
val snapshotParams = thumbnailViews[0].layoutParams as FrameLayout.LayoutParams
|
||||
val snapshotParams = thumbnailViews[0].layoutParams as LinearLayout.LayoutParams
|
||||
val translationX = banner.height.toFloat()
|
||||
val translationY: Float
|
||||
if (splitBounds == null) {
|
||||
|
||||
@@ -255,7 +255,7 @@ class PortraitPagedViewHandler : DefaultPagedViewHandler(), RecentsPagedOrientat
|
||||
}
|
||||
} else {
|
||||
if (desiredTaskId == splitBounds.leftTopTaskId) {
|
||||
val snapshotParams = thumbnailViews[0].layoutParams as FrameLayout.LayoutParams
|
||||
val snapshotParams = thumbnailViews[0].layoutParams as LinearLayout.LayoutParams
|
||||
val bottomRightTaskPlusDividerPercent =
|
||||
(splitBounds.rightBottomTaskPercent + splitBounds.dividerPercent)
|
||||
translationY =
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.view.Surface
|
||||
import android.view.View
|
||||
import android.view.View.MeasureSpec
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.util.component1
|
||||
import androidx.core.util.component2
|
||||
import androidx.core.view.updateLayoutParams
|
||||
@@ -151,7 +152,7 @@ class SeascapePagedViewHandler : LandscapePagedViewHandler() {
|
||||
desiredTaskId: Int,
|
||||
banner: View,
|
||||
): Pair<Float, Float> {
|
||||
val snapshotParams = thumbnailViews[0].layoutParams as FrameLayout.LayoutParams
|
||||
val snapshotParams = thumbnailViews[0].layoutParams as LinearLayout.LayoutParams
|
||||
val translationX: Float = (taskViewWidth - banner.height).toFloat()
|
||||
val translationY: Float
|
||||
if (splitBounds == null) {
|
||||
|
||||
@@ -18,16 +18,48 @@ package com.android.quickstep.recents.ui.mapper
|
||||
|
||||
import android.view.View.OnClickListener
|
||||
import com.android.quickstep.recents.ui.viewmodel.TaskData
|
||||
import com.android.quickstep.task.thumbnail.TaskHeaderUiState
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.BackgroundOnly
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.LiveTile
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.Snapshot
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.SnapshotSplash
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.ThumbnailHeader
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.Uninitialized
|
||||
|
||||
object TaskUiStateMapper {
|
||||
|
||||
/**
|
||||
* Converts a [TaskData] object into a [TaskHeaderUiState] for display in the UI.
|
||||
*
|
||||
* This function handles different types of [TaskData] and determines the appropriate UI state
|
||||
* based on the data and provided flags.
|
||||
*
|
||||
* @param taskData The [TaskData] to convert. Can be null or a specific subclass.
|
||||
* @param hasHeader A flag indicating whether the UI should display a header.
|
||||
* @param clickCloseListener A callback when the close button in the UI is clicked.
|
||||
* @return A [TaskHeaderUiState] representing the UI state for the given task data.
|
||||
*/
|
||||
fun toTaskHeaderState(
|
||||
taskData: TaskData?,
|
||||
hasHeader: Boolean,
|
||||
clickCloseListener: OnClickListener?,
|
||||
): TaskHeaderUiState =
|
||||
when {
|
||||
taskData !is TaskData.Data -> TaskHeaderUiState.HideHeader
|
||||
canHeaderBeCreated(taskData, hasHeader, clickCloseListener) -> {
|
||||
TaskHeaderUiState.ShowHeader(
|
||||
TaskHeaderUiState.ThumbnailHeader(
|
||||
// TODO(http://b/353965691): figure out what to do when `icon` or
|
||||
// `titleDescription` is null.
|
||||
taskData.icon!!,
|
||||
taskData.titleDescription!!,
|
||||
clickCloseListener!!,
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> TaskHeaderUiState.HideHeader
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a [TaskData] object into a [TaskThumbnailUiState] for display in the UI.
|
||||
*
|
||||
@@ -36,46 +68,24 @@ object TaskUiStateMapper {
|
||||
*
|
||||
* @param taskData The [TaskData] to convert. Can be null or a specific subclass.
|
||||
* @param isLiveTile A flag indicating whether the task data represents live tile.
|
||||
* @param hasHeader A flag indicating whether the UI should display a header.
|
||||
* @param clickCloseListener A callback when the close button in the UI is clicked.
|
||||
* @return A [TaskThumbnailUiState] representing the UI state for the given task data.
|
||||
*/
|
||||
fun toTaskThumbnailUiState(
|
||||
taskData: TaskData?,
|
||||
isLiveTile: Boolean,
|
||||
hasHeader: Boolean,
|
||||
clickCloseListener: OnClickListener?,
|
||||
): TaskThumbnailUiState =
|
||||
fun toTaskThumbnailUiState(taskData: TaskData?, isLiveTile: Boolean): TaskThumbnailUiState =
|
||||
when {
|
||||
taskData !is TaskData.Data -> Uninitialized
|
||||
isLiveTile -> createLiveTileState(taskData, hasHeader, clickCloseListener)
|
||||
isLiveTile -> LiveTile
|
||||
isBackgroundOnly(taskData) -> BackgroundOnly(taskData.backgroundColor)
|
||||
isSnapshotSplash(taskData) ->
|
||||
SnapshotSplash(
|
||||
createSnapshotState(taskData, hasHeader, clickCloseListener),
|
||||
Snapshot(
|
||||
taskData.thumbnailData?.thumbnail!!,
|
||||
taskData.thumbnailData.rotation,
|
||||
taskData.backgroundColor,
|
||||
),
|
||||
taskData.icon,
|
||||
)
|
||||
else -> Uninitialized
|
||||
}
|
||||
|
||||
private fun createSnapshotState(
|
||||
taskData: TaskData.Data,
|
||||
hasHeader: Boolean,
|
||||
clickCloseListener: OnClickListener?,
|
||||
): Snapshot =
|
||||
if (canHeaderBeCreated(taskData, hasHeader, clickCloseListener)) {
|
||||
Snapshot.WithHeader(
|
||||
taskData.thumbnailData?.thumbnail!!,
|
||||
taskData.thumbnailData.rotation,
|
||||
taskData.backgroundColor,
|
||||
ThumbnailHeader(taskData.icon!!, taskData.titleDescription!!, clickCloseListener!!),
|
||||
)
|
||||
} else {
|
||||
Snapshot.WithoutHeader(
|
||||
taskData.thumbnailData?.thumbnail!!,
|
||||
taskData.thumbnailData.rotation,
|
||||
taskData.backgroundColor,
|
||||
)
|
||||
else -> Uninitialized
|
||||
}
|
||||
|
||||
private fun isBackgroundOnly(taskData: TaskData.Data) =
|
||||
@@ -93,17 +103,4 @@ object TaskUiStateMapper {
|
||||
taskData.icon != null &&
|
||||
taskData.titleDescription != null &&
|
||||
clickCloseListener != null
|
||||
|
||||
private fun createLiveTileState(
|
||||
taskData: TaskData.Data,
|
||||
hasHeader: Boolean,
|
||||
clickCloseListener: OnClickListener?,
|
||||
) =
|
||||
if (canHeaderBeCreated(taskData, hasHeader, clickCloseListener)) {
|
||||
// TODO(http://b/353965691): figure out what to do when `icon` or `titleDescription` is
|
||||
// null.
|
||||
LiveTile.WithHeader(
|
||||
ThumbnailHeader(taskData.icon!!, taskData.titleDescription!!, clickCloseListener!!)
|
||||
)
|
||||
} else LiveTile.WithoutHeader
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (C) 2025 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.quickstep.task.thumbnail
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Outline
|
||||
import android.graphics.Path
|
||||
import android.graphics.Rect
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewOutlineProvider
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.isInvisible
|
||||
import com.android.launcher3.Flags.enableDesktopExplodedView
|
||||
import com.android.launcher3.Flags.enableRefactorTaskThumbnail
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.util.ViewPool
|
||||
import com.android.quickstep.views.TaskHeaderView
|
||||
import com.android.quickstep.views.TaskThumbnailViewDeprecated
|
||||
|
||||
/**
|
||||
* TaskContentView is a wrapper around the TaskHeaderView and TaskThumbnailView. It is a sibling to
|
||||
* DWB, AiAi (TaskOverlay).
|
||||
*/
|
||||
class TaskContentView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
LinearLayout(context, attrs), ViewPool.Reusable {
|
||||
|
||||
private var taskHeaderView: TaskHeaderView? = null
|
||||
private var taskThumbnailView: TaskThumbnailView? = null
|
||||
private var taskThumbnailViewDeprecated: TaskThumbnailViewDeprecated? = null
|
||||
private var onSizeChanged: ((width: Int, height: Int) -> Unit)? = null
|
||||
private val outlinePath = Path()
|
||||
|
||||
/**
|
||||
* Sets the outline bounds of the view. Default to use view's bound as outline when set to null.
|
||||
*/
|
||||
var outlineBounds: Rect? = null
|
||||
set(value) {
|
||||
field = value
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
private val bounds = Rect()
|
||||
|
||||
var cornerRadius: Float = 0f
|
||||
set(value) {
|
||||
field = value
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
maybeCreateHeader()
|
||||
createTaskThumbnailView()
|
||||
}
|
||||
|
||||
override fun setScaleX(scaleX: Float) {
|
||||
super.setScaleX(scaleX)
|
||||
taskThumbnailView?.parentScaleXUpdated(scaleX)
|
||||
}
|
||||
|
||||
override fun setScaleY(scaleY: Float) {
|
||||
super.setScaleY(scaleY)
|
||||
taskThumbnailView?.parentScaleYUpdated(scaleY)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
clipToOutline = true
|
||||
outlineProvider =
|
||||
object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
val outlineRect = outlineBounds ?: bounds
|
||||
outlinePath.apply {
|
||||
rewind()
|
||||
addRoundRect(
|
||||
outlineRect.left.toFloat(),
|
||||
outlineRect.top.toFloat(),
|
||||
outlineRect.right.toFloat(),
|
||||
outlineRect.bottom.toFloat(),
|
||||
cornerRadius / scaleX,
|
||||
cornerRadius / scaleY,
|
||||
Path.Direction.CW,
|
||||
)
|
||||
}
|
||||
outline.setPath(outlinePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRecycle() {
|
||||
taskHeaderView?.isInvisible = true
|
||||
onSizeChanged = null
|
||||
outlineBounds = null
|
||||
taskThumbnailView?.onRecycle()
|
||||
taskThumbnailViewDeprecated?.onRecycle()
|
||||
}
|
||||
|
||||
fun doOnSizeChange(action: (width: Int, height: Int) -> Unit) {
|
||||
onSizeChanged = action
|
||||
}
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
onSizeChanged?.invoke(width, height)
|
||||
bounds.set(0, 0, w, h)
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
private fun maybeCreateHeader() {
|
||||
if (enableDesktopExplodedView() && taskHeaderView == null) {
|
||||
taskHeaderView =
|
||||
LayoutInflater.from(context).inflate(R.layout.task_header_view, this, false)
|
||||
as TaskHeaderView
|
||||
addView(taskHeaderView)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createTaskThumbnailView() {
|
||||
if (taskThumbnailView == null) {
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
taskThumbnailView =
|
||||
LayoutInflater.from(context).inflate(R.layout.task_thumbnail, this, false)
|
||||
as TaskThumbnailView
|
||||
addView(taskThumbnailView)
|
||||
} else {
|
||||
taskThumbnailViewDeprecated =
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.task_thumbnail_deprecated, this, false)
|
||||
as TaskThumbnailViewDeprecated
|
||||
addView(taskThumbnailViewDeprecated)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setState(
|
||||
taskHeaderState: TaskHeaderUiState,
|
||||
taskThumbnailUiState: TaskThumbnailUiState,
|
||||
taskId: Int?,
|
||||
) {
|
||||
taskHeaderView?.setState(taskHeaderState)
|
||||
taskThumbnailView?.setState(taskThumbnailUiState, taskId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2025 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.quickstep.task.thumbnail
|
||||
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.View
|
||||
|
||||
sealed class TaskHeaderUiState {
|
||||
data class ShowHeader(val header: ThumbnailHeader) : TaskHeaderUiState()
|
||||
|
||||
data object HideHeader : TaskHeaderUiState()
|
||||
|
||||
data class ThumbnailHeader(
|
||||
val icon: Drawable,
|
||||
val title: String,
|
||||
val clickCloseListener: View.OnClickListener,
|
||||
)
|
||||
}
|
||||
@@ -19,7 +19,6 @@ package com.android.quickstep.task.thumbnail
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.Surface
|
||||
import android.view.View.OnClickListener
|
||||
import androidx.annotation.ColorInt
|
||||
|
||||
sealed class TaskThumbnailUiState {
|
||||
@@ -27,37 +26,14 @@ sealed class TaskThumbnailUiState {
|
||||
|
||||
data class BackgroundOnly(@ColorInt val backgroundColor: Int) : TaskThumbnailUiState()
|
||||
|
||||
data object LiveTile : TaskThumbnailUiState()
|
||||
|
||||
data class SnapshotSplash(val snapshot: Snapshot, val splash: Drawable?) :
|
||||
TaskThumbnailUiState()
|
||||
|
||||
sealed class LiveTile : TaskThumbnailUiState() {
|
||||
data class WithHeader(val header: ThumbnailHeader) : LiveTile()
|
||||
|
||||
data object WithoutHeader : LiveTile()
|
||||
}
|
||||
|
||||
sealed class Snapshot {
|
||||
abstract val bitmap: Bitmap
|
||||
abstract val thumbnailRotation: Int
|
||||
abstract val backgroundColor: Int
|
||||
|
||||
data class WithHeader(
|
||||
override val bitmap: Bitmap,
|
||||
@Surface.Rotation override val thumbnailRotation: Int,
|
||||
@ColorInt override val backgroundColor: Int,
|
||||
val header: ThumbnailHeader,
|
||||
) : Snapshot()
|
||||
|
||||
data class WithoutHeader(
|
||||
override val bitmap: Bitmap,
|
||||
@Surface.Rotation override val thumbnailRotation: Int,
|
||||
@ColorInt override val backgroundColor: Int,
|
||||
) : Snapshot()
|
||||
}
|
||||
|
||||
data class ThumbnailHeader(
|
||||
val icon: Drawable,
|
||||
val title: String,
|
||||
val clickCloseListener: OnClickListener,
|
||||
data class Snapshot(
|
||||
val bitmap: Bitmap,
|
||||
@Surface.Rotation val thumbnailRotation: Int,
|
||||
@ColorInt val backgroundColor: Int,
|
||||
)
|
||||
}
|
||||
@@ -19,32 +19,24 @@ package com.android.quickstep.task.thumbnail
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.Matrix
|
||||
import android.graphics.Outline
|
||||
import android.graphics.Path
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.ShapeDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewOutlineProvider
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.core.view.isInvisible
|
||||
import com.android.launcher3.Flags.enableDesktopExplodedView
|
||||
import com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.util.MultiPropertyFactory
|
||||
import com.android.launcher3.util.ViewPool
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.BackgroundOnly
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.LiveTile
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.Snapshot
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.SnapshotSplash
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.Uninitialized
|
||||
import com.android.quickstep.views.FixedSizeImageView
|
||||
import com.android.quickstep.views.TaskThumbnailViewHeader
|
||||
|
||||
class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
class TaskThumbnailView : FrameLayout {
|
||||
private val scrimView: View by lazy { findViewById(R.id.task_thumbnail_scrim) }
|
||||
private val liveTileView: LiveTileView by lazy { findViewById(R.id.task_thumbnail_live_tile) }
|
||||
private val thumbnailView: FixedSizeImageView by lazy { findViewById(R.id.task_thumbnail) }
|
||||
@@ -53,30 +45,9 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
private val dimAlpha: MultiPropertyFactory<View> by lazy {
|
||||
MultiPropertyFactory(scrimView, VIEW_ALPHA, ScrimViewAlpha.entries.size, ::maxOf)
|
||||
}
|
||||
private val outlinePath = Path()
|
||||
private var onSizeChanged: ((width: Int, height: Int) -> Unit)? = null
|
||||
|
||||
private var taskThumbnailViewHeader: TaskThumbnailViewHeader? = null
|
||||
|
||||
private var uiState: TaskThumbnailUiState = Uninitialized
|
||||
|
||||
/**
|
||||
* Sets the outline bounds of the view. Default to use view's bound as outline when set to null.
|
||||
*/
|
||||
var outlineBounds: Rect? = null
|
||||
set(value) {
|
||||
field = value
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
private val bounds = Rect()
|
||||
|
||||
var cornerRadius: Float = 0f
|
||||
set(value) {
|
||||
field = value
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||
@@ -87,39 +58,8 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
defStyleAttr: Int,
|
||||
) : super(context, attrs, defStyleAttr)
|
||||
|
||||
override fun onFinishInflate() {
|
||||
super.onFinishInflate()
|
||||
maybeCreateHeader()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
clipToOutline = true
|
||||
outlineProvider =
|
||||
object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
val outlineRect = outlineBounds ?: bounds
|
||||
outlinePath.apply {
|
||||
rewind()
|
||||
addRoundRect(
|
||||
outlineRect.left.toFloat(),
|
||||
outlineRect.top.toFloat(),
|
||||
outlineRect.right.toFloat(),
|
||||
outlineRect.bottom.toFloat(),
|
||||
cornerRadius / scaleX,
|
||||
cornerRadius / scaleY,
|
||||
Path.Direction.CW,
|
||||
)
|
||||
}
|
||||
outline.setPath(outlinePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRecycle() {
|
||||
fun onRecycle() {
|
||||
uiState = Uninitialized
|
||||
onSizeChanged = null
|
||||
outlineBounds = null
|
||||
resetViews()
|
||||
}
|
||||
|
||||
@@ -130,7 +70,7 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
resetViews()
|
||||
when (state) {
|
||||
is Uninitialized -> {}
|
||||
is LiveTile -> drawLiveWindow(state)
|
||||
is LiveTile -> drawLiveWindow()
|
||||
is SnapshotSplash -> drawSnapshotSplash(state)
|
||||
is BackgroundOnly -> drawBackground(state.backgroundColor)
|
||||
}
|
||||
@@ -155,25 +95,12 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
splashIcon.alpha = value
|
||||
}
|
||||
|
||||
fun doOnSizeChange(action: (width: Int, height: Int) -> Unit) {
|
||||
onSizeChanged = action
|
||||
}
|
||||
|
||||
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
||||
super.onSizeChanged(w, h, oldw, oldh)
|
||||
onSizeChanged?.invoke(width, height)
|
||||
bounds.set(0, 0, w, h)
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
override fun setScaleX(scaleX: Float) {
|
||||
super.setScaleX(scaleX)
|
||||
fun parentScaleXUpdated(scaleX: Float) {
|
||||
// Splash icon should ignore scale on TTV
|
||||
splashIcon.scaleX = 1 / scaleX
|
||||
}
|
||||
|
||||
override fun setScaleY(scaleY: Float) {
|
||||
super.setScaleY(scaleY)
|
||||
fun parentScaleYUpdated(scaleY: Float) {
|
||||
// Splash icon should ignore scale on TTV
|
||||
splashIcon.scaleY = 1 / scaleY
|
||||
}
|
||||
@@ -187,20 +114,14 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
splashIcon.setImageDrawable(null)
|
||||
scrimView.alpha = 0f
|
||||
setBackgroundColor(Color.BLACK)
|
||||
taskThumbnailViewHeader?.isInvisible = true
|
||||
}
|
||||
|
||||
private fun drawBackground(@ColorInt background: Int) {
|
||||
setBackgroundColor(background)
|
||||
}
|
||||
|
||||
private fun drawLiveWindow(liveTile: LiveTile) {
|
||||
private fun drawLiveWindow() {
|
||||
liveTileView.isInvisible = false
|
||||
|
||||
if (liveTile is LiveTile.WithHeader) {
|
||||
taskThumbnailViewHeader?.isInvisible = false
|
||||
taskThumbnailViewHeader?.setHeader(liveTile.header)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawSnapshotSplash(snapshotSplash: SnapshotSplash) {
|
||||
@@ -212,11 +133,6 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
}
|
||||
|
||||
private fun drawSnapshot(snapshot: Snapshot) {
|
||||
if (snapshot is Snapshot.WithHeader) {
|
||||
taskThumbnailViewHeader?.isInvisible = false
|
||||
taskThumbnailViewHeader?.setHeader(snapshot.header)
|
||||
}
|
||||
|
||||
drawBackground(snapshot.backgroundColor)
|
||||
thumbnailView.setImageBitmap(snapshot.bitmap)
|
||||
thumbnailView.isInvisible = false
|
||||
@@ -232,16 +148,6 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
Log.d(TAG, "[TaskThumbnailView@${Integer.toHexString(hashCode())}] $message")
|
||||
}
|
||||
|
||||
private fun maybeCreateHeader() {
|
||||
if (enableDesktopExplodedView() && taskThumbnailViewHeader == null) {
|
||||
taskThumbnailViewHeader =
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.task_thumbnail_view_header, this, false)
|
||||
as TaskThumbnailViewHeader
|
||||
addView(taskThumbnailViewHeader)
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val TAG = "TaskThumbnailView"
|
||||
private const val MAX_SCRIM_ALPHA = 0.4f
|
||||
|
||||
@@ -192,7 +192,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
taskViewHeight: Int,
|
||||
isPrimaryTaskSplitting: Boolean,
|
||||
) {
|
||||
val snapshot = taskContainer.snapshotView
|
||||
val taskContentView = taskContainer.taskContentView
|
||||
val iconView: View = taskContainer.iconView.asView()
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
builder.add(
|
||||
@@ -241,7 +241,11 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
val centerThumbnailTranslationX: Float = (taskViewWidth - snapshotViewSize.x) / 2f
|
||||
val finalScaleX: Float = taskViewWidth.toFloat() / snapshotViewSize.x
|
||||
builder.add(
|
||||
ObjectAnimator.ofFloat(snapshot, View.TRANSLATION_X, centerThumbnailTranslationX)
|
||||
ObjectAnimator.ofFloat(
|
||||
taskContentView,
|
||||
View.TRANSLATION_X,
|
||||
centerThumbnailTranslationX,
|
||||
)
|
||||
)
|
||||
if (!enableOverviewIconMenu()) {
|
||||
// icons are anchored from Gravity.END, so need to use negative translation
|
||||
@@ -250,15 +254,17 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
ObjectAnimator.ofFloat(iconView, View.TRANSLATION_X, -centerIconTranslationX)
|
||||
)
|
||||
}
|
||||
builder.add(ObjectAnimator.ofFloat(snapshot, View.SCALE_X, finalScaleX))
|
||||
builder.add(ObjectAnimator.ofFloat(taskContentView, View.SCALE_X, finalScaleX))
|
||||
|
||||
// Reset other dimensions
|
||||
// TODO(b/271468547), can't set Y translate to 0, need to account for top space
|
||||
snapshot.scaleY = 1f
|
||||
taskContentView.scaleY = 1f
|
||||
val translateYResetVal: Float =
|
||||
if (!isPrimaryTaskSplitting) 0f
|
||||
else deviceProfile.overviewTaskThumbnailTopMarginPx.toFloat()
|
||||
builder.add(ObjectAnimator.ofFloat(snapshot, View.TRANSLATION_Y, translateYResetVal))
|
||||
builder.add(
|
||||
ObjectAnimator.ofFloat(taskContentView, View.TRANSLATION_Y, translateYResetVal)
|
||||
)
|
||||
} else {
|
||||
val thumbnailSize = taskViewHeight - deviceProfile.overviewTaskThumbnailTopMarginPx
|
||||
// Center view first so scaling happens uniformly, alternatively we can move pivotY to 0
|
||||
@@ -281,18 +287,22 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
}
|
||||
val finalScaleY: Float = thumbnailSize.toFloat() / snapshotViewSize.y
|
||||
builder.add(
|
||||
ObjectAnimator.ofFloat(snapshot, View.TRANSLATION_Y, centerThumbnailTranslationY)
|
||||
ObjectAnimator.ofFloat(
|
||||
taskContentView,
|
||||
View.TRANSLATION_Y,
|
||||
centerThumbnailTranslationY,
|
||||
)
|
||||
)
|
||||
|
||||
if (!enableOverviewIconMenu()) {
|
||||
// icons are anchored from Gravity.END, so need to use negative translation
|
||||
builder.add(ObjectAnimator.ofFloat(iconView, View.TRANSLATION_X, 0f))
|
||||
}
|
||||
builder.add(ObjectAnimator.ofFloat(snapshot, View.SCALE_Y, finalScaleY))
|
||||
builder.add(ObjectAnimator.ofFloat(taskContentView, View.SCALE_Y, finalScaleY))
|
||||
|
||||
// Reset other dimensions
|
||||
snapshot.scaleX = 1f
|
||||
builder.add(ObjectAnimator.ofFloat(snapshot, View.TRANSLATION_X, 0f))
|
||||
taskContentView.scaleX = 1f
|
||||
builder.add(ObjectAnimator.ofFloat(taskContentView, View.TRANSLATION_X, 0f))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ import com.android.quickstep.recents.di.get
|
||||
import com.android.quickstep.recents.domain.model.DesktopTaskBoundsData
|
||||
import com.android.quickstep.recents.ui.viewmodel.DesktopTaskViewModel
|
||||
import com.android.quickstep.recents.ui.viewmodel.TaskData
|
||||
import com.android.quickstep.task.thumbnail.TaskContentView
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailView
|
||||
import com.android.quickstep.util.DesktopTask
|
||||
import com.android.quickstep.util.RecentsOrientedState
|
||||
@@ -69,27 +70,14 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
) {
|
||||
private val contentViewFullscreenParams = FullscreenDrawParams(context)
|
||||
|
||||
private val taskThumbnailViewDeprecatedPool =
|
||||
if (!enableRefactorTaskThumbnail()) {
|
||||
ViewPool<TaskThumbnailViewDeprecated>(
|
||||
context,
|
||||
this,
|
||||
R.layout.task_thumbnail_deprecated,
|
||||
VIEW_POOL_MAX_SIZE,
|
||||
VIEW_POOL_INITIAL_SIZE,
|
||||
)
|
||||
} else null
|
||||
|
||||
private val taskThumbnailViewPool =
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
ViewPool<TaskThumbnailView>(
|
||||
context,
|
||||
this,
|
||||
R.layout.task_thumbnail,
|
||||
VIEW_POOL_MAX_SIZE,
|
||||
VIEW_POOL_INITIAL_SIZE,
|
||||
)
|
||||
} else null
|
||||
private val taskContentViewPool =
|
||||
ViewPool<TaskContentView>(
|
||||
context,
|
||||
this,
|
||||
R.layout.task_content_view,
|
||||
VIEW_POOL_MAX_SIZE,
|
||||
VIEW_POOL_INITIAL_SIZE,
|
||||
)
|
||||
|
||||
private val tempPointF = PointF()
|
||||
private val lastComputedTaskSize = Rect()
|
||||
@@ -239,7 +227,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
// for all cases where the progress is non-zero.
|
||||
if (explodeProgress == 0.0f || explodeProgress == 1.0f) {
|
||||
// Reset scaling and translation that may have been applied during animation.
|
||||
it.snapshotView.apply {
|
||||
it.taskContentView.apply {
|
||||
scaleX = 1.0f
|
||||
scaleY = 1.0f
|
||||
translationX = 0.0f
|
||||
@@ -247,7 +235,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
}
|
||||
|
||||
// Position the task to the same position as it would be on the desktop
|
||||
it.snapshotView.updateLayoutParams<LayoutParams> {
|
||||
it.taskContentView?.updateLayoutParams<LayoutParams> {
|
||||
gravity = Gravity.LEFT or Gravity.TOP
|
||||
width = taskWidth.toInt()
|
||||
height = taskHeight.toInt()
|
||||
@@ -258,7 +246,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
if (
|
||||
enableDesktopRecentsTransitionsCornersBugfix() && enableRefactorTaskThumbnail()
|
||||
) {
|
||||
it.thumbnailView.outlineBounds =
|
||||
it.taskContentView?.outlineBounds =
|
||||
if (intersects(overviewTaskPosition, screenRect))
|
||||
Rect(overviewTaskPosition).apply {
|
||||
intersectUnchecked(screenRect)
|
||||
@@ -275,7 +263,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
} else {
|
||||
// During the animation, apply translation and scale such that the view is
|
||||
// transformed to where we want, without triggering layout.
|
||||
it.snapshotView.apply {
|
||||
it.taskContentView.apply {
|
||||
pivotX = 0.0f
|
||||
pivotY = 0.0f
|
||||
translationX = taskLeft - left
|
||||
@@ -308,17 +296,19 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
val backgroundViewIndex = contentView.indexOfChild(backgroundView)
|
||||
taskContainers =
|
||||
tasks.map { task ->
|
||||
val taskContentView = taskContentViewPool.view
|
||||
contentView.addView(taskContentView, backgroundViewIndex + 1)
|
||||
val snapshotView =
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
taskThumbnailViewPool!!.view
|
||||
taskContentView.findViewById<TaskThumbnailView>(R.id.snapshot)
|
||||
} else {
|
||||
taskThumbnailViewDeprecatedPool!!.view
|
||||
taskContentView.findViewById<TaskThumbnailViewDeprecated>(R.id.snapshot)
|
||||
}
|
||||
contentView.addView(snapshotView, backgroundViewIndex + 1)
|
||||
|
||||
TaskContainer(
|
||||
this,
|
||||
task,
|
||||
taskContentView,
|
||||
snapshotView,
|
||||
iconView,
|
||||
TransformingTouchDelegate(iconView.asView()),
|
||||
@@ -465,12 +455,8 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
}
|
||||
|
||||
private fun removeAndRecycleThumbnailView(taskContainer: TaskContainer) {
|
||||
contentView.removeView(taskContainer.snapshotView)
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
taskThumbnailViewPool!!.recycle(taskContainer.thumbnailView)
|
||||
} else {
|
||||
taskThumbnailViewDeprecatedPool!!.recycle(taskContainer.thumbnailViewDeprecated)
|
||||
}
|
||||
contentView.removeView(taskContainer.taskContentView)
|
||||
taskContentViewPool.recycle(taskContainer.taskContentView)
|
||||
}
|
||||
|
||||
private fun updateTaskPositions() {
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.view.View
|
||||
import android.view.ViewStub
|
||||
import com.android.internal.jank.Cuj
|
||||
import com.android.launcher3.Flags.enableOverviewIconMenu
|
||||
import com.android.launcher3.Flags.enableRefactorTaskThumbnail
|
||||
import com.android.launcher3.R
|
||||
import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.util.RunnableList
|
||||
@@ -78,8 +77,8 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
val splitBoundsConfig = splitBoundsConfig ?: return
|
||||
val inSplitSelection = getThisTaskCurrentlyInSplitSelection() != INVALID_TASK_ID
|
||||
pagedOrientationHandler.measureGroupedTaskViewThumbnailBounds(
|
||||
leftTopTaskContainer.snapshotView,
|
||||
rightBottomTaskContainer.snapshotView,
|
||||
leftTopTaskContainer.taskContentView,
|
||||
rightBottomTaskContainer.taskContentView,
|
||||
widthSize,
|
||||
heightSize,
|
||||
splitBoundsConfig,
|
||||
@@ -95,12 +94,8 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
|
||||
override fun inflateViewStubs() {
|
||||
super.inflateViewStubs()
|
||||
findViewById<ViewStub>(R.id.bottomright_snapshot)
|
||||
?.apply {
|
||||
layoutResource =
|
||||
if (enableRefactorTaskThumbnail()) R.layout.task_thumbnail
|
||||
else R.layout.task_thumbnail_deprecated
|
||||
}
|
||||
findViewById<ViewStub>(R.id.bottomright_task_content_view)
|
||||
?.apply { layoutResource = R.layout.task_content_view }
|
||||
?.inflate()
|
||||
findViewById<ViewStub>(R.id.bottomRight_icon)
|
||||
?.apply {
|
||||
@@ -128,6 +123,7 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
listOf(
|
||||
createTaskContainer(
|
||||
primaryTask,
|
||||
R.id.task_content_view,
|
||||
R.id.snapshot,
|
||||
R.id.icon,
|
||||
R.id.show_windows,
|
||||
@@ -137,7 +133,8 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
),
|
||||
createTaskContainer(
|
||||
secondaryTask,
|
||||
R.id.bottomright_snapshot,
|
||||
R.id.bottomright_task_content_view,
|
||||
R.id.snapshot,
|
||||
R.id.bottomRight_icon,
|
||||
R.id.show_windows_right,
|
||||
R.id.bottomRight_digital_wellbeing_toast,
|
||||
@@ -240,8 +237,8 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
leftTopTaskContainer.iconView.asView(),
|
||||
rightBottomTaskContainer.iconView.asView(),
|
||||
taskIconHeight,
|
||||
leftTopTaskContainer.snapshotView.measuredWidth,
|
||||
leftTopTaskContainer.snapshotView.measuredHeight,
|
||||
leftTopTaskContainer.taskContentView.measuredWidth,
|
||||
leftTopTaskContainer.taskContentView.measuredHeight,
|
||||
measuredHeight,
|
||||
measuredWidth,
|
||||
isRtl,
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.quickstep.TaskOverlayFactory
|
||||
import com.android.quickstep.ViewUtils.addAccessibleChildToList
|
||||
import com.android.quickstep.recents.ui.mapper.TaskUiStateMapper
|
||||
import com.android.quickstep.recents.ui.viewmodel.TaskData
|
||||
import com.android.quickstep.task.thumbnail.TaskContentView
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailView
|
||||
import com.android.systemui.shared.recents.model.Task
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData
|
||||
@@ -36,6 +37,7 @@ import com.android.systemui.shared.recents.model.ThumbnailData
|
||||
class TaskContainer(
|
||||
val taskView: TaskView,
|
||||
val task: Task,
|
||||
val taskContentView: TaskContentView,
|
||||
val snapshotView: View,
|
||||
val iconView: TaskViewIcon,
|
||||
/**
|
||||
@@ -104,8 +106,8 @@ class TaskContainer(
|
||||
|
||||
fun destroy() {
|
||||
digitalWellBeingToast?.destroy()
|
||||
snapshotView.scaleX = 1f
|
||||
snapshotView.scaleY = 1f
|
||||
taskContentView.scaleX = 1f
|
||||
taskContentView.scaleY = 1f
|
||||
overlay.destroy()
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
isThumbnailValid = false
|
||||
@@ -136,13 +138,9 @@ class TaskContainer(
|
||||
hasHeader: Boolean,
|
||||
clickCloseListener: OnClickListener?,
|
||||
) {
|
||||
thumbnailView.setState(
|
||||
TaskUiStateMapper.toTaskThumbnailUiState(
|
||||
state,
|
||||
liveTile,
|
||||
hasHeader,
|
||||
clickCloseListener,
|
||||
),
|
||||
taskContentView.setState(
|
||||
TaskUiStateMapper.toTaskHeaderState(state, hasHeader, clickCloseListener),
|
||||
TaskUiStateMapper.toTaskThumbnailUiState(state, liveTile),
|
||||
state?.taskId,
|
||||
)
|
||||
thumbnailData = if (state is TaskData.Data) state.thumbnailData else null
|
||||
|
||||
+16
-6
@@ -22,19 +22,29 @@ import android.widget.FrameLayout
|
||||
import android.widget.ImageButton
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isGone
|
||||
import com.android.launcher3.R
|
||||
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.ThumbnailHeader
|
||||
import com.android.quickstep.task.thumbnail.TaskHeaderUiState
|
||||
|
||||
class TaskThumbnailViewHeader
|
||||
@JvmOverloads
|
||||
constructor(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) {
|
||||
class TaskHeaderView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
FrameLayout(context, attrs) {
|
||||
|
||||
private val headerTitleView: TextView by lazy { findViewById(R.id.header_app_title) }
|
||||
private val headerIconView: ImageView by lazy { findViewById(R.id.header_app_icon) }
|
||||
private val headerCloseButton: ImageButton by lazy { findViewById(R.id.header_close_button) }
|
||||
|
||||
fun setHeader(header: ThumbnailHeader) {
|
||||
headerTitleView.setText(header.title)
|
||||
fun setState(taskHeaderState: TaskHeaderUiState) {
|
||||
when (taskHeaderState) {
|
||||
is TaskHeaderUiState.ShowHeader -> {
|
||||
setHeader(taskHeaderState.header)
|
||||
isGone = false
|
||||
}
|
||||
TaskHeaderUiState.HideHeader -> isGone = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun setHeader(header: TaskHeaderUiState.ThumbnailHeader) {
|
||||
headerTitleView.text = header.title
|
||||
headerIconView.setImageDrawable(header.icon)
|
||||
headerCloseButton.setOnClickListener(header.clickCloseListener)
|
||||
}
|
||||
@@ -84,6 +84,7 @@ import com.android.quickstep.recents.di.inject
|
||||
import com.android.quickstep.recents.ui.viewmodel.TaskData
|
||||
import com.android.quickstep.recents.ui.viewmodel.TaskTileUiState
|
||||
import com.android.quickstep.recents.ui.viewmodel.TaskViewModel
|
||||
import com.android.quickstep.task.thumbnail.TaskContentView
|
||||
import com.android.quickstep.util.ActiveGestureErrorDetector
|
||||
import com.android.quickstep.util.ActiveGestureLog
|
||||
import com.android.quickstep.util.BorderAnimator
|
||||
@@ -736,13 +737,10 @@ constructor(
|
||||
}
|
||||
|
||||
protected open fun inflateViewStubs() {
|
||||
findViewById<ViewStub>(R.id.snapshot)
|
||||
?.apply {
|
||||
layoutResource =
|
||||
if (enableRefactorTaskThumbnail()) R.layout.task_thumbnail
|
||||
else R.layout.task_thumbnail_deprecated
|
||||
}
|
||||
findViewById<ViewStub>(R.id.task_content_view)
|
||||
?.apply { layoutResource = R.layout.task_content_view }
|
||||
?.inflate()
|
||||
|
||||
findViewById<ViewStub>(R.id.icon)
|
||||
?.apply {
|
||||
layoutResource =
|
||||
@@ -857,6 +855,7 @@ constructor(
|
||||
listOf(
|
||||
createTaskContainer(
|
||||
task,
|
||||
R.id.task_content_view,
|
||||
R.id.snapshot,
|
||||
R.id.icon,
|
||||
R.id.show_windows,
|
||||
@@ -886,8 +885,9 @@ constructor(
|
||||
taskContainers.forEach { container ->
|
||||
container.bind()
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
container.thumbnailView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
|
||||
container.thumbnailView.doOnSizeChange { width, height ->
|
||||
container.taskContentView.cornerRadius =
|
||||
thumbnailFullscreenParams.currentCornerRadius
|
||||
container.taskContentView.doOnSizeChange { width, height ->
|
||||
updateThumbnailValidity(container)
|
||||
updateThumbnailMatrix(container, width, height)
|
||||
}
|
||||
@@ -913,6 +913,7 @@ constructor(
|
||||
|
||||
protected fun createTaskContainer(
|
||||
task: Task,
|
||||
@IdRes taskContentViewId: Int,
|
||||
@IdRes thumbnailViewId: Int,
|
||||
@IdRes iconViewId: Int,
|
||||
@IdRes showWindowViewId: Int,
|
||||
@@ -921,10 +922,12 @@ constructor(
|
||||
taskOverlayFactory: TaskOverlayFactory,
|
||||
): TaskContainer {
|
||||
val iconView = findViewById<View>(iconViewId) as TaskViewIcon
|
||||
val taskContentView = findViewById<TaskContentView>(taskContentViewId)
|
||||
return TaskContainer(
|
||||
this,
|
||||
task,
|
||||
findViewById(thumbnailViewId),
|
||||
taskContentView,
|
||||
taskContentView.findViewById(thumbnailViewId),
|
||||
iconView,
|
||||
TransformingTouchDelegate(iconView.asView()),
|
||||
stagePosition,
|
||||
@@ -1012,7 +1015,7 @@ constructor(
|
||||
protected open fun updateThumbnailSize() {
|
||||
// TODO(b/271468547), we should default to setting translations only on the snapshot instead
|
||||
// of a hybrid of both margins and translations
|
||||
firstTaskContainer?.snapshotView?.updateLayoutParams<LayoutParams> {
|
||||
firstTaskContainer?.taskContentView?.updateLayoutParams<LayoutParams> {
|
||||
topMargin = container.deviceProfile.overviewTaskThumbnailTopMarginPx
|
||||
}
|
||||
taskContainers.forEach { it.digitalWellBeingToast?.setupLayout() }
|
||||
@@ -1026,11 +1029,11 @@ constructor(
|
||||
val thumbnailBounds = Rect()
|
||||
if (relativeToDragLayer) {
|
||||
container.dragLayer.getDescendantRectRelativeToSelf(
|
||||
it.snapshotView,
|
||||
it.taskContentView,
|
||||
thumbnailBounds,
|
||||
)
|
||||
} else {
|
||||
thumbnailBounds.set(it.snapshotView)
|
||||
thumbnailBounds.set(it.taskContentView)
|
||||
}
|
||||
bounds.union(thumbnailBounds)
|
||||
}
|
||||
@@ -1717,7 +1720,7 @@ constructor(
|
||||
updateFullscreenParams(thumbnailFullscreenParams)
|
||||
taskContainers.forEach {
|
||||
if (enableRefactorTaskThumbnail()) {
|
||||
it.thumbnailView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
|
||||
it.taskContentView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
|
||||
} else {
|
||||
it.thumbnailViewDeprecated.setFullscreenParams(thumbnailFullscreenParams)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user