Loading packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/CastDetailsContent.kt +20 −1 Original line number Diff line number Diff line Loading @@ -17,10 +17,14 @@ package com.android.systemui.qs.tiles.dialog import android.view.LayoutInflater import android.view.ViewGroup import android.widget.LinearLayout import android.widget.ListView import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.material3.Button import androidx.compose.material3.Text import androidx.compose.runtime.Composable Loading @@ -28,12 +32,15 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.internal.R import com.android.internal.app.MediaRouteChooserContentManager import com.android.internal.app.MediaRouteControllerContentManager private val MAX_CAST_LIST_HEIGHT = 5000.dp @Composable fun CastDetailsContent(castDetailsViewModel: CastDetailsViewModel) { if (castDetailsViewModel.shouldShowChooserDialog()) { Loading Loading @@ -65,7 +72,12 @@ fun CastDetailsContent(castDetailsViewModel: CastDetailsViewModel) { @Composable fun CastChooserView(contentManager: MediaRouteChooserContentManager) { AndroidView( modifier = Modifier.fillMaxWidth().testTag(CastDetailsViewModel.CHOOSER_VIEW_TEST_TAG), // Use heightIn on this AndroidView to ensure it measures to a non-zero height that works // within the scrollable area in the `TileDetails`. modifier = Modifier.fillMaxWidth() .heightIn(max = MAX_CAST_LIST_HEIGHT) .testTag(CastDetailsViewModel.CHOOSER_VIEW_TEST_TAG), factory = { context -> // Inflate with the existing dialog xml layout val view = Loading @@ -73,6 +85,13 @@ fun CastChooserView(contentManager: MediaRouteChooserContentManager) { contentManager.bindViews(view) contentManager.onAttachedToWindow() val listView = view.findViewById<ListView>(R.id.media_route_list) (listView.layoutParams as? LinearLayout.LayoutParams)?.apply { weight = 0.0f height = ViewGroup.LayoutParams.WRAP_CONTENT listView.layoutParams = this } view }, onRelease = { contentManager.onDetachedFromWindow() }, Loading Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/dialog/CastDetailsContent.kt +20 −1 Original line number Diff line number Diff line Loading @@ -17,10 +17,14 @@ package com.android.systemui.qs.tiles.dialog import android.view.LayoutInflater import android.view.ViewGroup import android.widget.LinearLayout import android.widget.ListView import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.material3.Button import androidx.compose.material3.Text import androidx.compose.runtime.Composable Loading @@ -28,12 +32,15 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.testTag import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import com.android.compose.ui.graphics.painter.rememberDrawablePainter import com.android.internal.R import com.android.internal.app.MediaRouteChooserContentManager import com.android.internal.app.MediaRouteControllerContentManager private val MAX_CAST_LIST_HEIGHT = 5000.dp @Composable fun CastDetailsContent(castDetailsViewModel: CastDetailsViewModel) { if (castDetailsViewModel.shouldShowChooserDialog()) { Loading Loading @@ -65,7 +72,12 @@ fun CastDetailsContent(castDetailsViewModel: CastDetailsViewModel) { @Composable fun CastChooserView(contentManager: MediaRouteChooserContentManager) { AndroidView( modifier = Modifier.fillMaxWidth().testTag(CastDetailsViewModel.CHOOSER_VIEW_TEST_TAG), // Use heightIn on this AndroidView to ensure it measures to a non-zero height that works // within the scrollable area in the `TileDetails`. modifier = Modifier.fillMaxWidth() .heightIn(max = MAX_CAST_LIST_HEIGHT) .testTag(CastDetailsViewModel.CHOOSER_VIEW_TEST_TAG), factory = { context -> // Inflate with the existing dialog xml layout val view = Loading @@ -73,6 +85,13 @@ fun CastChooserView(contentManager: MediaRouteChooserContentManager) { contentManager.bindViews(view) contentManager.onAttachedToWindow() val listView = view.findViewById<ListView>(R.id.media_route_list) (listView.layoutParams as? LinearLayout.LayoutParams)?.apply { weight = 0.0f height = ViewGroup.LayoutParams.WRAP_CONTENT listView.layoutParams = this } view }, onRelease = { contentManager.onDetachedFromWindow() }, Loading