Change task content view to be a constraint layout.

This is for child cl to be able to place dwb inline in it.

Bug: 405359383
Flag: com.android.launcher3.enable_refactor_task_content_view
Test: Screenshot tests
Change-Id: Id3252fff5776c199ae2a0c7e89d96c423241478c
This commit is contained in:
Shamali P authored and Shamali Patwa committed 2025-04-23 09:43:48 -07:00
1 parent a7b69dc3d5
commit 3519785d79
3 files changed
+38 -9

No files matched your search

+13 -4
View File
@@ -14,21 +14,30 @@
~ limitations under the License.
-->
<com.android.quickstep.task.thumbnail.TaskContentView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/task_content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:importantForAccessibility="no">
<ViewStub
android:id="@+id/task_header_view"
android:inflatedId="@+id/task_header_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<ViewStub
android:id="@+id/snapshot"
android:inflatedId="@+id/snapshot"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
</com.android.quickstep.task.thumbnail.TaskContentView>
@@ -24,7 +24,8 @@ import android.util.AttributeSet
import android.view.View
import android.view.ViewOutlineProvider
import android.view.ViewStub
import android.widget.LinearLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isInvisible
import com.android.launcher3.R
import com.android.launcher3.util.ViewPool
@@ -35,7 +36,7 @@ import com.android.quickstep.views.TaskHeaderView
* DWB, AiAi (TaskOverlay).
*/
class TaskContentView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
LinearLayout(context, attrs), ViewPool.Reusable {
ConstraintLayout(context, attrs), ViewPool.Reusable {
private var taskHeaderView: TaskHeaderView? = null
private var taskThumbnailView: TaskThumbnailView? = null
@@ -123,6 +124,16 @@ class TaskContentView @JvmOverloads constructor(context: Context, attrs: Attribu
findViewById<ViewStub>(R.id.task_header_view)
.apply { layoutResource = R.layout.task_header_view }
.inflate() as TaskHeaderView
// TODO: Move to layout xml when moving away from view stubs.
val constraintSet = ConstraintSet().apply { clone(this@TaskContentView) }
constraintSet.connect(
R.id.snapshot,
ConstraintSet.TOP,
R.id.task_header_view,
ConstraintSet.BOTTOM,
)
constraintSet.applyTo(this@TaskContentView)
}
}
@@ -61,7 +61,10 @@ class TaskContentViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
@Test
fun taskContentView_recyclesToUninitialized() {
screenshotRule.screenshotTest("taskContentView_uninitialized") { activity ->
screenshotRule.screenshotTest(
"taskContentView_uninitialized",
ViewScreenshotTestRule.Mode.MatchSize,
) { activity ->
activity.actionBar?.hide()
val taskContentView = createTaskContentView(activity)
taskContentView.setState(
@@ -76,7 +79,10 @@ class TaskContentViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
@Test
fun taskContentView_shows_thumbnail_and_header() {
screenshotRule.screenshotTest("taskContentView_shows_thumbnail_and_header") { activity ->
screenshotRule.screenshotTest(
"taskContentView_shows_thumbnail_and_header",
ViewScreenshotTestRule.Mode.MatchSize,
) { activity ->
activity.actionBar?.hide()
createTaskContentView(activity).apply {
setState(
@@ -95,7 +101,10 @@ class TaskContentViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
@Test
fun taskContentView_scaled_roundRoundedCorners() {
screenshotRule.screenshotTest("taskContentView_scaledRoundedCorners") { activity ->
screenshotRule.screenshotTest(
"taskContentView_scaledRoundedCorners",
ViewScreenshotTestRule.Mode.MatchSize,
) { activity ->
activity.actionBar?.hide()
createTaskContentView(activity).apply {
scaleX = 0.75f