compose: search: Force single pane layout for app details while searching
This looks awful on foldables as it still draws based on the window width and not the pane width. I cannot find a simple way to differentiate the width between foldables and tablet to display the side pane here so just disable it for now. Hopefully, Google will add a way to adapt the adaptive layouts based on pane width. Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -91,7 +91,8 @@ fun AppDetailsScreen(
|
||||
packageName: String,
|
||||
onNavigateUp: () -> Unit,
|
||||
onNavigateToAppDetails: (packageName: String) -> Unit,
|
||||
viewModel: AppDetailsViewModel = hiltViewModel(key = packageName)
|
||||
viewModel: AppDetailsViewModel = hiltViewModel(key = packageName),
|
||||
forceSinglePane: Boolean = false
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
@@ -139,7 +140,8 @@ fun AppDetailsScreen(
|
||||
},
|
||||
onTestingSubscriptionChange = { subscribe ->
|
||||
viewModel.updateTestingProgramStatus(packageName, subscribe)
|
||||
}
|
||||
},
|
||||
forceSinglePane = forceSinglePane
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -200,10 +202,16 @@ private fun ScreenContentApp(
|
||||
onUninstall: () -> Unit = {},
|
||||
onOpen: () -> Unit = {},
|
||||
onTestingSubscriptionChange: (subscribe: Boolean) -> Unit = {},
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo()
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo(),
|
||||
forceSinglePane: Boolean = false
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val scaffoldDirective = calculatePaneScaffoldDirective(windowAdaptiveInfo)
|
||||
var scaffoldDirective = calculatePaneScaffoldDirective(windowAdaptiveInfo)
|
||||
|
||||
if (forceSinglePane) {
|
||||
scaffoldDirective = scaffoldDirective.copy(maxHorizontalPartitions = 1)
|
||||
}
|
||||
|
||||
val scaffoldNavigator = rememberSupportingPaneScaffoldNavigator<Screen>(
|
||||
scaffoldDirective = scaffoldDirective,
|
||||
adaptStrategies = SupportingPaneScaffoldDefaults.adaptStrategies(
|
||||
|
||||
@@ -27,6 +27,8 @@ import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SearchBarDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.adaptive.WindowAdaptiveInfo
|
||||
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
|
||||
import androidx.compose.material3.adaptive.layout.AnimatedPane
|
||||
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole
|
||||
import androidx.compose.material3.adaptive.navigation.NavigableListDetailPaneScaffold
|
||||
@@ -59,6 +61,7 @@ import androidx.paging.PagingData
|
||||
import androidx.paging.compose.LazyPagingItems
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import androidx.paging.compose.itemKey
|
||||
import androidx.window.core.layout.WindowSizeClass
|
||||
import coil3.compose.LocalAsyncImagePreviewHandler
|
||||
import com.aurora.gplayapi.SearchSuggestEntry
|
||||
import com.aurora.gplayapi.data.models.App
|
||||
@@ -102,7 +105,8 @@ private fun ScreenContent(
|
||||
onFetchSuggestions: (String) -> Unit = {},
|
||||
onSearch: (String) -> Unit = {},
|
||||
onFilter: (filter: SearchFilter) -> Unit = {},
|
||||
isAnonymous: Boolean = true
|
||||
isAnonymous: Boolean = true,
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo(),
|
||||
) {
|
||||
val textFieldState = rememberTextFieldState()
|
||||
val searchBarState = rememberSearchBarState()
|
||||
@@ -244,6 +248,7 @@ private fun ScreenContent(
|
||||
onNavigateUp = {
|
||||
coroutineScope.launch { scaffoldNavigator.navigateBack() }
|
||||
},
|
||||
forceSinglePane = true
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user