Loading quickstep/res/layout/task_desktop.xml +0 −9 Original line number Diff line number Diff line Loading @@ -36,15 +36,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> <!-- TODO(b249371338): DesktopTaskView extends from TaskView. TaskView expects TaskThumbnailView and IconView with these ids to be present. Need to refactor RecentsView to accept child views that do not inherint from TaskView only or create a generic TaskView that have N number of tasks. --> <include layout="@layout/task_thumbnail" android:visibility="gone" /> <ViewStub android:id="@+id/icon" android:inflatedId="@id/icon" Loading quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailView.kt +12 −6 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.view.View import android.view.ViewOutlineProvider import androidx.annotation.ColorInt import com.android.launcher3.Utilities 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 Loading @@ -42,7 +43,7 @@ import com.android.systemui.shared.system.QuickStepContract import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch class TaskThumbnailView : View { class TaskThumbnailView : View, ViewPool.Reusable { // TODO(b/335649589): Ideally create and obtain this from DI. This ViewModel should be scoped // to [TaskView], and also shared between [TaskView] and [TaskThumbnailView] // This is using a lazy for now because the dependencies cannot be obtained without DI. Loading Loading @@ -71,7 +72,7 @@ class TaskThumbnailView : View { return _measuredBounds } private var cornerRadius: Float = TaskCornerRadius.get(context) private var overviewCornerRadius: Float = TaskCornerRadius.get(context) private var fullscreenCornerRadius: Float = QuickStepContract.getWindowCornerRadius(context) constructor(context: Context?) : super(context) Loading Loading @@ -100,7 +101,7 @@ class TaskThumbnailView : View { invalidate() } } MainScope().launch { viewModel.recentsFullscreenProgress.collect { invalidateOutline() } } MainScope().launch { viewModel.cornerRadiusProgress.collect { invalidateOutline() } } MainScope().launch { viewModel.inheritedScale.collect { viewModelInheritedScale -> inheritedScale = viewModelInheritedScale Loading @@ -117,6 +118,11 @@ class TaskThumbnailView : View { } } override fun onRecycle() { // Do nothing uiState = Uninitialized } override fun onDraw(canvas: Canvas) { when (val uiStateVal = uiState) { is Uninitialized -> drawBackgroundOnly(canvas, Color.BLACK) Loading @@ -138,7 +144,7 @@ class TaskThumbnailView : View { override fun onConfigurationChanged(newConfig: Configuration?) { super.onConfigurationChanged(newConfig) cornerRadius = TaskCornerRadius.get(context) overviewCornerRadius = TaskCornerRadius.get(context) fullscreenCornerRadius = QuickStepContract.getWindowCornerRadius(context) invalidateOutline() } Loading @@ -159,8 +165,8 @@ class TaskThumbnailView : View { private fun getCurrentCornerRadius() = Utilities.mapRange( viewModel.recentsFullscreenProgress.value, cornerRadius, viewModel.cornerRadiusProgress.value, overviewCornerRadius, fullscreenCornerRadius ) / inheritedScale Loading quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewModel.kt +8 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.systemui.shared.recents.model.Task import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flatMapLatest Loading @@ -47,7 +48,13 @@ class TaskThumbnailViewModel( private val task = MutableStateFlow<Flow<Task?>>(flowOf(null)) private var boundTaskIsRunning = false val recentsFullscreenProgress = recentsViewData.fullscreenProgress /** * Progress for changes in corner radius. progress: 0 = overview corner radius; 1 = fullscreen * corner radius. */ val cornerRadiusProgress = if (taskViewData.isOutlineFormedByThumbnailView) recentsViewData.fullscreenProgress else MutableStateFlow(1f).asStateFlow() val inheritedScale = combine(recentsViewData.scale, taskViewData.scale) { recentsScale, taskScale -> recentsScale * taskScale Loading quickstep/src/com/android/quickstep/task/viewmodel/TaskViewData.kt +6 −1 Original line number Diff line number Diff line Loading @@ -16,9 +16,14 @@ package com.android.quickstep.task.viewmodel import com.android.quickstep.views.TaskViewType import kotlinx.coroutines.flow.MutableStateFlow class TaskViewData { class TaskViewData(taskViewType: TaskViewType) { // This is typically a View concern but it is used to invalidate rendering in other Views val scale = MutableStateFlow(1f) // TODO(b/331753115): This property should not be in TaskViewData once TaskView is MVVM. /** Whether outline of TaskView is formed by outline thumbnail view(s). */ val isOutlineFormedByThumbnailView: Boolean = taskViewType != TaskViewType.DESKTOP } quickstep/src/com/android/quickstep/util/DesktopTask.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.quickstep.util; import androidx.annotation.NonNull; import com.android.quickstep.views.TaskView; import com.android.quickstep.views.TaskViewType; import com.android.systemui.shared.recents.model.Task; import java.util.List; Loading @@ -34,7 +34,7 @@ public class DesktopTask extends GroupTask { public final List<Task> tasks; public DesktopTask(@NonNull List<Task> tasks) { super(tasks.get(0), null, null, TaskView.Type.DESKTOP); super(tasks.get(0), null, null, TaskViewType.DESKTOP); this.tasks = tasks; } Loading Loading
quickstep/res/layout/task_desktop.xml +0 −9 Original line number Diff line number Diff line Loading @@ -36,15 +36,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> <!-- TODO(b249371338): DesktopTaskView extends from TaskView. TaskView expects TaskThumbnailView and IconView with these ids to be present. Need to refactor RecentsView to accept child views that do not inherint from TaskView only or create a generic TaskView that have N number of tasks. --> <include layout="@layout/task_thumbnail" android:visibility="gone" /> <ViewStub android:id="@+id/icon" android:inflatedId="@id/icon" Loading
quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailView.kt +12 −6 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.view.View import android.view.ViewOutlineProvider import androidx.annotation.ColorInt import com.android.launcher3.Utilities 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 Loading @@ -42,7 +43,7 @@ import com.android.systemui.shared.system.QuickStepContract import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch class TaskThumbnailView : View { class TaskThumbnailView : View, ViewPool.Reusable { // TODO(b/335649589): Ideally create and obtain this from DI. This ViewModel should be scoped // to [TaskView], and also shared between [TaskView] and [TaskThumbnailView] // This is using a lazy for now because the dependencies cannot be obtained without DI. Loading Loading @@ -71,7 +72,7 @@ class TaskThumbnailView : View { return _measuredBounds } private var cornerRadius: Float = TaskCornerRadius.get(context) private var overviewCornerRadius: Float = TaskCornerRadius.get(context) private var fullscreenCornerRadius: Float = QuickStepContract.getWindowCornerRadius(context) constructor(context: Context?) : super(context) Loading Loading @@ -100,7 +101,7 @@ class TaskThumbnailView : View { invalidate() } } MainScope().launch { viewModel.recentsFullscreenProgress.collect { invalidateOutline() } } MainScope().launch { viewModel.cornerRadiusProgress.collect { invalidateOutline() } } MainScope().launch { viewModel.inheritedScale.collect { viewModelInheritedScale -> inheritedScale = viewModelInheritedScale Loading @@ -117,6 +118,11 @@ class TaskThumbnailView : View { } } override fun onRecycle() { // Do nothing uiState = Uninitialized } override fun onDraw(canvas: Canvas) { when (val uiStateVal = uiState) { is Uninitialized -> drawBackgroundOnly(canvas, Color.BLACK) Loading @@ -138,7 +144,7 @@ class TaskThumbnailView : View { override fun onConfigurationChanged(newConfig: Configuration?) { super.onConfigurationChanged(newConfig) cornerRadius = TaskCornerRadius.get(context) overviewCornerRadius = TaskCornerRadius.get(context) fullscreenCornerRadius = QuickStepContract.getWindowCornerRadius(context) invalidateOutline() } Loading @@ -159,8 +165,8 @@ class TaskThumbnailView : View { private fun getCurrentCornerRadius() = Utilities.mapRange( viewModel.recentsFullscreenProgress.value, cornerRadius, viewModel.cornerRadiusProgress.value, overviewCornerRadius, fullscreenCornerRadius ) / inheritedScale Loading
quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewModel.kt +8 −1 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.systemui.shared.recents.model.Task import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.flatMapLatest Loading @@ -47,7 +48,13 @@ class TaskThumbnailViewModel( private val task = MutableStateFlow<Flow<Task?>>(flowOf(null)) private var boundTaskIsRunning = false val recentsFullscreenProgress = recentsViewData.fullscreenProgress /** * Progress for changes in corner radius. progress: 0 = overview corner radius; 1 = fullscreen * corner radius. */ val cornerRadiusProgress = if (taskViewData.isOutlineFormedByThumbnailView) recentsViewData.fullscreenProgress else MutableStateFlow(1f).asStateFlow() val inheritedScale = combine(recentsViewData.scale, taskViewData.scale) { recentsScale, taskScale -> recentsScale * taskScale Loading
quickstep/src/com/android/quickstep/task/viewmodel/TaskViewData.kt +6 −1 Original line number Diff line number Diff line Loading @@ -16,9 +16,14 @@ package com.android.quickstep.task.viewmodel import com.android.quickstep.views.TaskViewType import kotlinx.coroutines.flow.MutableStateFlow class TaskViewData { class TaskViewData(taskViewType: TaskViewType) { // This is typically a View concern but it is used to invalidate rendering in other Views val scale = MutableStateFlow(1f) // TODO(b/331753115): This property should not be in TaskViewData once TaskView is MVVM. /** Whether outline of TaskView is formed by outline thumbnail view(s). */ val isOutlineFormedByThumbnailView: Boolean = taskViewType != TaskViewType.DESKTOP }
quickstep/src/com/android/quickstep/util/DesktopTask.java +2 −2 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package com.android.quickstep.util; import androidx.annotation.NonNull; import com.android.quickstep.views.TaskView; import com.android.quickstep.views.TaskViewType; import com.android.systemui.shared.recents.model.Task; import java.util.List; Loading @@ -34,7 +34,7 @@ public class DesktopTask extends GroupTask { public final List<Task> tasks; public DesktopTask(@NonNull List<Task> tasks) { super(tasks.get(0), null, null, TaskView.Type.DESKTOP); super(tasks.get(0), null, null, TaskViewType.DESKTOP); this.tasks = tasks; } Loading