Loading packages/SystemUI/src/com/android/systemui/media/MediaProjectionAppSelectorActivity.kt +18 −2 Original line number Diff line number Diff line Loading @@ -206,6 +206,11 @@ class MediaProjectionAppSelectorActivity( override fun bind(recentTasks: List<RecentTask>) { recentsViewController.bind(recentTasks) if (!hasWorkProfile()) { // Make sure to refresh the adapter, to show/hide the recents view depending on whether // there are recents or not. mMultiProfilePagerAdapter.personalListAdapter.notifyDataSetChanged() } } override fun returnSelectedApp(launchCookie: IBinder) { Loading Loading @@ -248,9 +253,20 @@ class MediaProjectionAppSelectorActivity( override fun shouldGetOnlyDefaultActivities() = false override fun shouldShowContentPreview() = true override fun shouldShowContentPreview() = if (hasWorkProfile()) { // When the user has a work profile, we can always set this to true, and the layout is // adjusted automatically, and hide the recents view. true } else { // When there is no work profile, we should only show the content preview if there are // recents, otherwise the collapsed app selector will look empty. recentsViewController.hasRecentTasks } override fun shouldShowContentPreviewWhenEmpty() = shouldShowContentPreview() override fun shouldShowContentPreviewWhenEmpty(): Boolean = true private fun hasWorkProfile() = mMultiProfilePagerAdapter.count > 1 override fun createMyUserIdProvider(): MyUserIdProvider = object : MyUserIdProvider() { Loading packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewController.kt +14 −7 Original line number Diff line number Diff line Loading @@ -35,8 +35,8 @@ import com.android.systemui.util.recycler.HorizontalSpacerItemDecoration import javax.inject.Inject /** * Controller that handles view of the recent apps selector in the media projection activity. * It is responsible for creating and updating recent apps view. * Controller that handles view of the recent apps selector in the media projection activity. It is * responsible for creating and updating recent apps view. */ @MediaProjectionAppSelectorScope class MediaProjectionRecentsViewController Loading @@ -51,15 +51,21 @@ constructor( private var views: Views? = null private var lastBoundData: List<RecentTask>? = null val hasRecentTasks: Boolean get() = lastBoundData?.isNotEmpty() ?: false init { taskViewSizeProvider.addCallback(this) } fun createView(parent: ViewGroup): ViewGroup = views?.root ?: createRecentViews(parent).also { views?.root ?: createRecentViews(parent) .also { views = it lastBoundData?.let { recents -> bind(recents) } }.root } .root fun bind(recentTasks: List<RecentTask>) { views?.apply { Loading Loading @@ -88,7 +94,8 @@ constructor( .inflate(R.layout.media_projection_recent_tasks, parent, /* attachToRoot= */ false) as ViewGroup val container = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_container) val container = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_container) container.setTaskHeightSize() val progress = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_loader) Loading Loading
packages/SystemUI/src/com/android/systemui/media/MediaProjectionAppSelectorActivity.kt +18 −2 Original line number Diff line number Diff line Loading @@ -206,6 +206,11 @@ class MediaProjectionAppSelectorActivity( override fun bind(recentTasks: List<RecentTask>) { recentsViewController.bind(recentTasks) if (!hasWorkProfile()) { // Make sure to refresh the adapter, to show/hide the recents view depending on whether // there are recents or not. mMultiProfilePagerAdapter.personalListAdapter.notifyDataSetChanged() } } override fun returnSelectedApp(launchCookie: IBinder) { Loading Loading @@ -248,9 +253,20 @@ class MediaProjectionAppSelectorActivity( override fun shouldGetOnlyDefaultActivities() = false override fun shouldShowContentPreview() = true override fun shouldShowContentPreview() = if (hasWorkProfile()) { // When the user has a work profile, we can always set this to true, and the layout is // adjusted automatically, and hide the recents view. true } else { // When there is no work profile, we should only show the content preview if there are // recents, otherwise the collapsed app selector will look empty. recentsViewController.hasRecentTasks } override fun shouldShowContentPreviewWhenEmpty() = shouldShowContentPreview() override fun shouldShowContentPreviewWhenEmpty(): Boolean = true private fun hasWorkProfile() = mMultiProfilePagerAdapter.count > 1 override fun createMyUserIdProvider(): MyUserIdProvider = object : MyUserIdProvider() { Loading
packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionRecentsViewController.kt +14 −7 Original line number Diff line number Diff line Loading @@ -35,8 +35,8 @@ import com.android.systemui.util.recycler.HorizontalSpacerItemDecoration import javax.inject.Inject /** * Controller that handles view of the recent apps selector in the media projection activity. * It is responsible for creating and updating recent apps view. * Controller that handles view of the recent apps selector in the media projection activity. It is * responsible for creating and updating recent apps view. */ @MediaProjectionAppSelectorScope class MediaProjectionRecentsViewController Loading @@ -51,15 +51,21 @@ constructor( private var views: Views? = null private var lastBoundData: List<RecentTask>? = null val hasRecentTasks: Boolean get() = lastBoundData?.isNotEmpty() ?: false init { taskViewSizeProvider.addCallback(this) } fun createView(parent: ViewGroup): ViewGroup = views?.root ?: createRecentViews(parent).also { views?.root ?: createRecentViews(parent) .also { views = it lastBoundData?.let { recents -> bind(recents) } }.root } .root fun bind(recentTasks: List<RecentTask>) { views?.apply { Loading Loading @@ -88,7 +94,8 @@ constructor( .inflate(R.layout.media_projection_recent_tasks, parent, /* attachToRoot= */ false) as ViewGroup val container = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_container) val container = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_container) container.setTaskHeightSize() val progress = recentsRoot.requireViewById<View>(R.id.media_projection_recent_tasks_loader) Loading