library:ui: adopt Material3 1.5 APIs (menus, searchbar, panes) + cleanup
- Commit
3c83b0ceb5d0e5ae01d804a25195d2fab529368a- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-03 17:38 UTC (3 months ago)
- Parents
b7f634b
Diff
calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterPage.kt
diff --git a/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterPage.kt b/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterPage.ktindex aa7d26d26a..f43c1d6c7a 100644--- a/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterPage.kt+++ b/calculator/src/main/java/com/vayunmathur/calculator/ui/UnitConverterPage.kt@@ -33,14 +33,15 @@ import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.Card import com.vayunmathur.library.ui.Button import com.vayunmathur.library.ui.DropdownMenu-import com.vayunmathur.library.ui.DropdownMenuItem import com.vayunmathur.library.ui.FilledTonalIconButton import com.vayunmathur.library.ui.IconArrowDropDown+import com.vayunmathur.library.ui.IconCheck import com.vayunmathur.library.ui.IconSwapLanguages import com.vayunmathur.library.ui.LoadingIndicator import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.OutlinedTextField+import com.vayunmathur.library.ui.SelectableDropdownMenuItem import com.vayunmathur.library.ui.Spacing import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior@@ -162,12 +163,14 @@ private fun CategoryDropdown( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { categories.forEachIndexed { index, cat ->- DropdownMenuItem(- text = { Text(cat.name) },+ SelectableDropdownMenuItem(+ selected = index == selectedIndex, onClick = { onSelect(index) expanded = false },+ text = { Text(cat.name) },+ selectedLeadingIcon = { IconCheck() }, ) } }@@ -240,12 +243,14 @@ private fun UnitDropdown( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { units.forEach { unit ->- DropdownMenuItem(- text = { Text("${unit.symbol} — ${unit.name}") },+ SelectableDropdownMenuItem(+ selected = unit.token == selectedToken, onClick = { onSelect(unit.token) expanded = false },+ text = { Text("${unit.symbol} — ${unit.name}") },+ selectedLeadingIcon = { IconCheck() }, ) } }
camera/src/main/java/com/vayunmathur/camera/ui/SettingsPage.kt
diff --git a/camera/src/main/java/com/vayunmathur/camera/ui/SettingsPage.kt b/camera/src/main/java/com/vayunmathur/camera/ui/SettingsPage.ktindex aa68ae2975..b02650ceed 100644--- a/camera/src/main/java/com/vayunmathur/camera/ui/SettingsPage.kt+++ b/camera/src/main/java/com/vayunmathur/camera/ui/SettingsPage.kt@@ -28,11 +28,12 @@ import com.vayunmathur.camera.util.CameraViewModel import com.vayunmathur.camera.util.AudioInputSource import com.vayunmathur.camera.util.CodecSupport import com.vayunmathur.camera.util.VideoCodec-import com.vayunmathur.library.ui.DropdownMenuItem import com.vayunmathur.library.ui.ExposedDropdownMenuAnchorType import com.vayunmathur.library.ui.ExposedDropdownMenuBox import com.vayunmathur.library.ui.ExposedDropdownMenuDefaults+import com.vayunmathur.library.ui.IconCheck import com.vayunmathur.library.ui.OutlinedTextField+import com.vayunmathur.library.ui.SelectableDropdownMenuItem import com.vayunmathur.library.ui.rememberPermissionRequest import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack@@ -94,7 +95,12 @@ fun <T : NavKey> SettingsPage(backStack: NavBackStack<T>, viewModel: CameraViewM onDismissRequest = { expanded = false } ) { availableCodecs.forEach { codec ->- DropdownMenuItem(+ SelectableDropdownMenuItem(+ selected = codec == videoCodec,+ onClick = {+ viewModel.setVideoCodec(codec)+ expanded = false+ }, text = { Column { Text(stringResource(codec.labelRes))@@ -105,10 +111,7 @@ fun <T : NavKey> SettingsPage(backStack: NavBackStack<T>, viewModel: CameraViewM ) } },- onClick = {- viewModel.setVideoCodec(codec)- expanded = false- }+ selectedLeadingIcon = { IconCheck() }, ) } }@@ -138,7 +141,12 @@ fun <T : NavKey> SettingsPage(backStack: NavBackStack<T>, viewModel: CameraViewM onDismissRequest = { audioExpanded = false } ) { AudioInputSource.entries.forEach { source ->- DropdownMenuItem(+ SelectableDropdownMenuItem(+ selected = source == audioInputSource,+ onClick = {+ viewModel.setAudioInputSource(source)+ audioExpanded = false+ }, text = { Column { Text(stringResource(source.labelRes))@@ -149,10 +157,7 @@ fun <T : NavKey> SettingsPage(backStack: NavBackStack<T>, viewModel: CameraViewM ) } },- onClick = {- viewModel.setAudioInputSource(source)- audioExpanded = false- }+ selectedLeadingIcon = { IconCheck() }, ) } }
clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmOptionControls.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmOptionControls.kt b/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmOptionControls.ktindex 4107aa2c31..005ed197c3 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmOptionControls.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/components/AlarmOptionControls.kt@@ -18,8 +18,9 @@ import androidx.compose.ui.unit.dp import android.media.RingtoneManager import com.vayunmathur.clock.R import com.vayunmathur.library.ui.DropdownMenu-import com.vayunmathur.library.ui.DropdownMenuItem+import com.vayunmathur.library.ui.IconCheck import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.SelectableDropdownMenuItem import com.vayunmathur.library.ui.Switch import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton@@ -88,12 +89,14 @@ private fun OptionDropdown(value: String, options: List<Pair<Int, String>>, onSe TextButton(onClick = { expanded = true }) { Text(value) } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { options.forEach { (key, text) ->- DropdownMenuItem(- text = { Text(text) },+ SelectableDropdownMenuItem(+ selected = text == value, onClick = { expanded = false onSelect(key) },+ text = { Text(text) },+ selectedLeadingIcon = { IconCheck() }, ) } }
clock/src/main/java/com/vayunmathur/clock/ui/dialogs/NewAlarmDialog.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/dialogs/NewAlarmDialog.kt b/clock/src/main/java/com/vayunmathur/clock/ui/dialogs/NewAlarmDialog.ktindex be3c2fcaba..497b51d92f 100644--- a/clock/src/main/java/com/vayunmathur/clock/ui/dialogs/NewAlarmDialog.kt+++ b/clock/src/main/java/com/vayunmathur/clock/ui/dialogs/NewAlarmDialog.kt@@ -26,7 +26,7 @@ import com.vayunmathur.library.ui.TextButton import com.vayunmathur.library.util.NavBackStack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.TimePicker-import androidx.compose.material3.rememberTimePickerState+import com.vayunmathur.library.ui.rememberTimePickerState import androidx.compose.ui.text.font.FontWeight import kotlinx.datetime.LocalTime import kotlinx.datetime.TimeZone
contacts/src/main/java/com/vayunmathur/contacts/ui/EditContactPage.kt
diff --git a/contacts/src/main/java/com/vayunmathur/contacts/ui/EditContactPage.kt b/contacts/src/main/java/com/vayunmathur/contacts/ui/EditContactPage.ktindex ee3b58e5bd..9264076643 100644--- a/contacts/src/main/java/com/vayunmathur/contacts/ui/EditContactPage.kt+++ b/contacts/src/main/java/com/vayunmathur/contacts/ui/EditContactPage.kt@@ -32,7 +32,6 @@ import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.library.ui.AssistChip import com.vayunmathur.library.ui.Button import com.vayunmathur.library.ui.DropdownMenu-import com.vayunmathur.library.ui.DropdownMenuItem import com.vayunmathur.library.ui.ExperimentalMaterial3Api import com.vayunmathur.library.ui.FilledTonalButton import com.vayunmathur.library.ui.FormDetailGroup@@ -87,12 +86,14 @@ import com.vayunmathur.contacts.util.ContactViewModel import com.vayunmathur.library.ui.IconAddPhoto import com.vayunmathur.library.ui.IconArrowDropDown import com.vayunmathur.library.ui.IconCall+import com.vayunmathur.library.ui.IconCheck import com.vayunmathur.library.ui.IconEdit import com.vayunmathur.library.ui.IconEvent import com.vayunmathur.library.ui.IconGroup import com.vayunmathur.library.ui.IconLocationOn import com.vayunmathur.library.ui.IconMail import com.vayunmathur.library.ui.IconRemoveCircle+import com.vayunmathur.library.ui.SelectableDropdownMenuItem import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.library.util.ResultEffect@@ -305,6 +306,7 @@ fun EditContactPage(backStack: NavBackStack<Route>, viewModel: ContactViewModel, onTypeChange = { idx, opt -> viewModel.updateEditDraft { it.copy(phoneNumbers = it.phoneNumbers.toMutableList().also { l -> l[idx] = l[idx].withType(opt) }) } }, onRemove = { idx -> viewModel.updateEditDraft { it.copy(phoneNumbers = it.phoneNumbers.toMutableList().also { l -> l.removeAt(idx) }) } }, onAdd = { viewModel.updateEditDraft { it.copy(phoneNumbers = it.phoneNumbers + ContactDetail.default<PhoneNumber>()) } },+ currentType = { it.type }, keyboardType = KeyboardType.Phone, isCustom = { it.type == CDKPhone.TYPE_CUSTOM }, customLabel = { it.label },@@ -334,6 +336,7 @@ fun EditContactPage(backStack: NavBackStack<Route>, viewModel: ContactViewModel, onTypeChange = { idx, opt -> viewModel.updateEditDraft { it.copy(emails = it.emails.toMutableList().also { l -> l[idx] = l[idx].withType(opt) }) } }, onRemove = { idx -> viewModel.updateEditDraft { it.copy(emails = it.emails.toMutableList().also { l -> l.removeAt(idx) }) } }, onAdd = { viewModel.updateEditDraft { it.copy(emails = it.emails + ContactDetail.default<Email>()) } },+ currentType = { it.type }, keyboardType = KeyboardType.Email, isCustom = { it.type == CDKEmail.TYPE_CUSTOM }, customLabel = { it.label },@@ -359,6 +362,7 @@ fun EditContactPage(backStack: NavBackStack<Route>, viewModel: ContactViewModel, onTypeChange = { idx, opt -> viewModel.updateEditDraft { it.copy(addresses = it.addresses.toMutableList().also { l -> l[idx] = l[idx].withType(opt) }) } }, onRemove = { idx -> viewModel.updateEditDraft { it.copy(addresses = it.addresses.toMutableList().also { l -> l.removeAt(idx) }) } }, onAdd = { viewModel.updateEditDraft { it.copy(addresses = it.addresses + ContactDetail.default<Address>()) } },+ currentType = { it.type }, isCustom = { it.type == CDKStructuredPostal.TYPE_CUSTOM }, customLabel = { it.label }, onLabelChange = { idx, v -> viewModel.updateEditDraft { it.copy(addresses = it.addresses.toMutableList().also { l -> l[idx] = l[idx].withLabel(v) }) } },@@ -458,27 +462,31 @@ fun AccountChooser( ) DropdownMenu(expanded, { expanded = false }) { if (accounts.none { it.name.isBlank() && it.type.isBlank() }) {- DropdownMenuItem(- text = { Text(onDevice) },+ SelectableDropdownMenuItem(+ selected = accountName.isEmpty() && accountType.isEmpty(), onClick = { onAccountChange("", "") expanded = false- }+ },+ text = { Text(onDevice) },+ selectedLeadingIcon = { IconCheck() }, ) } accounts.forEach { account -> val key = "${account.type}|${account.name}" val label = simLabels[key] ?: account.name.ifEmpty { onDevice }- DropdownMenuItem(+ SelectableDropdownMenuItem(+ selected = currentKey == key,+ onClick = {+ onAccountChange(account.name, account.type)+ expanded = false+ }, text = { Text(when { simLabels.containsKey(key) -> label account.type.isBlank() -> label else -> stringResource(R.string.account_display_format, label, account.type) }) },- onClick = {- onAccountChange(account.name, account.type)- expanded = false- }+ selectedLeadingIcon = { IconCheck() }, ) } }@@ -528,10 +536,16 @@ private fun NameAffixChooser( // The clear option is listed by its localized name but stores an empty affix, so // the contact does not end up with the word "None" as its title. (listOf(none) + options).forEach { option ->- DropdownMenuItem(text = { Text(option) }, onClick = {- onValueChange(if (option == none) "" else option)- expanded = false- })+ val affix = if (option == none) "" else option+ SelectableDropdownMenuItem(+ selected = value == affix,+ onClick = {+ onValueChange(affix)+ expanded = false+ },+ text = { Text(option) },+ selectedLeadingIcon = { IconCheck() },+ ) } } }@@ -642,12 +656,14 @@ private fun ColumnScope.DateDetailsSection( expanded = dropdownExpanded, onDismissRequest = { dropdownExpanded = false }) { options.forEach { option ->- DropdownMenuItem(+ SelectableDropdownMenuItem(+ selected = detail.type == option, onClick = { onDetailsChange(details.toMutableList().also { it[index] = detail.withType(option) }) dropdownExpanded = false },- text = { Text(ContactDetail.default<Event>().withType(option).typeString(context)) }+ text = { Text(ContactDetail.default<Event>().withType(option).typeString(context)) },+ selectedLeadingIcon = { IconCheck() }, ) } }
findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt
diff --git a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.ktindex 6ca2af0d5a..bbaa9ea9d8 100644--- a/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt+++ b/findfamily/src/main/java/com/vayunmathur/findfamily/ui/MainPage.kt@@ -51,9 +51,10 @@ import com.vayunmathur.library.ui.ListItemDefaults import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.ExposedDropdownMenuDefaults import com.vayunmathur.library.ui.DropdownMenu-import com.vayunmathur.library.ui.DropdownMenuItem+import com.vayunmathur.library.ui.IconCheck import com.vayunmathur.library.ui.OutlinedButton import com.vayunmathur.library.ui.OutlinedTextField+import com.vayunmathur.library.ui.SelectableDropdownMenuItem import com.vayunmathur.library.ui.Slider import com.vayunmathur.library.ui.SheetValue import com.vayunmathur.library.ui.Switch@@ -1055,23 +1056,46 @@ fun AutoToggleRow(user: User, waypoints: List<Waypoint>, actions: PersonActions) trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) } ) DropdownMenu(expanded, { expanded = false }) {- // Never option first — disables auto-toggle; others reschedule countdown- DropdownMenuItem({ Text(neverLabel) }, {- expanded = false- actions.setUserAutoToggle(user, null)- })- labelToDuration.forEach { (label, dur) ->- DropdownMenuItem({ Text(label) }, {+ // Never option first — disables auto-toggle; others reschedule countdown.+ // Auto-toggle modes are mutually exclusive, so exactly one option is current:+ // "Never" while nothing is armed, or the arrival waypoint while an arrival+ // trigger is armed. An armed countdown only stores its fire time, not the+ // nominal duration, so the smallest option covering the remaining time is+ // marked (exact while the head of the countdown, a shrinking bucket after).+ val remaining = endAt?.let { it - now }+ SelectableDropdownMenuItem(+ selected = endAt == null && user.sharingAutoToggleWaypointId == null,+ onClick = { expanded = false- actions.setUserAutoToggle(user, dur)- })+ actions.setUserAutoToggle(user, null)+ },+ text = { Text(neverLabel) },+ selectedLeadingIcon = { IconCheck() },+ )+ labelToDuration.forEach { (label, dur) ->+ SelectableDropdownMenuItem(+ selected = user.sharingAutoToggleWaypointId == null && remaining != null &&+ remaining.inWholeSeconds > 0 && dur >= remaining &&+ labelToDuration.values.none { other -> other < dur && other >= remaining },+ onClick = {+ expanded = false+ actions.setUserAutoToggle(user, dur)+ },+ text = { Text(label) },+ selectedLeadingIcon = { IconCheck() },+ ) } // Arrival triggers — flip sharing when "Me" arrives at a saved place (GitHub #406). arrivalWaypoints.forEach { waypoint ->- DropdownMenuItem({ Text(stringResource(R.string.arrival_at, waypoint.name)) }, {- expanded = false- actions.setUserArrivalToggle(user, waypoint.id)- })+ SelectableDropdownMenuItem(+ selected = user.sharingAutoToggleWaypointId == waypoint.id,+ onClick = {+ expanded = false+ actions.setUserArrivalToggle(user, waypoint.id)+ },+ text = { Text(stringResource(R.string.arrival_at, waypoint.name)) },+ selectedLeadingIcon = { IconCheck() },+ ) } } }
gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 0641131dc5..935a5d6c45 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -33,7 +33,7 @@ composeBom = "2026.06.01" # Compose Preview Screenshot Testing (renders @Preview to PNG on the JVM, no device). composeScreenshot = "0.0.1-alpha16" activityCompose = "1.13.0"-material3 = "1.5.0-alpha23"+material3 = "1.5.0-alpha27" material3AdaptiveNavigationSuite = "1.5.0-alpha23" foundation = "1.12.0-beta02" wearComposeMaterial = "1.7.0-alpha05"@@ -42,7 +42,7 @@ tv = "1.1.0" # AndroidX – navigation navigation3 = "1.2.0-alpha05"-adaptiveNavigation3 = "1.3.0-rc01"+adaptiveNavigation3 = "1.3.0" # AndroidX – media, camera & images media3Exoplayer = "1.11.0-beta01"
library/ui/build.gradle.kts
diff --git a/library/ui/build.gradle.kts b/library/ui/build.gradle.ktsindex 90e2bfc41c..ed92d3d734 100644--- a/library/ui/build.gradle.kts+++ b/library/ui/build.gradle.kts@@ -11,6 +11,9 @@ dependencies { api(libs.androidx.compose.material3) // NavigationSuiteScaffold / currentWindowAdaptiveInfo used (via the facade) by openassistant. api(libs.androidx.compose.material3.adaptive.navigation.suite)+ // V2 adaptive info (currentWindowAdaptiveInfoV2) used by the facade in MaterialFunctions.kt.+ // implementation (not api): app modules must use the facade, not name adaptive types directly.+ implementation(libs.androidx.compose.adaptive.navigation3) // Used only internally (editor toolbars); not re-exported to apps. implementation(libs.androidx.compose.material.icons.extended)
library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.ktindex e6d12d0354..b22ba61767 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/AppScaffold.kt@@ -2,7 +2,6 @@ package com.vayunmathur.library.ui import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.RowScope-import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable@@ -52,7 +51,6 @@ enum class AppBarSize { Small, MediumFlexible, LargeFlexible } * [scrollBehavior] is required rather than defaulted so that every screen states how its bar * reacts to scrolling; [appBarScrollBehavior] gives the right one for a [size]. */-@OptIn(ExperimentalMaterial3Api::class) @Composable fun AppScaffold( title: String,@@ -92,7 +90,6 @@ fun AppScaffold( * For the handful of screens whose title needs more than text - a truncated * document name, a styled or two-line heading. Prefer the string overload. */-@OptIn(ExperimentalMaterial3Api::class) @Composable fun AppScaffold( title: @Composable () -> Unit,@@ -132,7 +129,6 @@ fun AppScaffold( } /** [AppScaffold] for a screen that owns a back stack, wiring the back button to it. */-@OptIn(ExperimentalMaterial3Api::class) @Composable fun <T : NavKey> AppScaffold( title: String,@@ -172,7 +168,6 @@ fun <T : NavKey> AppScaffold( * Kept private and shared so the three overloads cannot drift apart. [subtitle] is only rendered * by the flexible sizes - the small bar is a single row and has nowhere to put it. */-@OptIn(ExperimentalMaterial3Api::class) @Composable private fun AppTopBar( title: @Composable () -> Unit,
library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.ktindex 5d120b60c1..2bb4a605be 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/CommonSearchBar.kt@@ -1,15 +1,30 @@+@file:OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)+ package com.vayunmathur.library.ui import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material3.IconButton-import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.unit.dp +/**+ * The app-facing inline search field: an always-visible local filter, not an+ * expandable global-search bar.+ *+ * This is deliberately built on [SearchBarInputField] (M3+ * `SearchBarDefaults.InputField`) rather than the full [SearchBar] (or the newer+ * `SearchBarState` family): every call-site filters an in-memory list live and has+ * no overlay content, so an expand-to-fullscreen bar would hide the very list being+ * filtered, add an expand/collapse cycle on every focus, and fight the `TopAppBar`+ * title slot it usually sits in — pure regression for zero benefit. The input field+ * alone gives real search semantics (IME search action, search text style/colors,+ * a11y role) with the same inline layout footprint as before.+ */ @Composable fun CommonSearchBar( value: String,@@ -18,9 +33,14 @@ fun CommonSearchBar( placeholder: String = "Search", padding: PaddingValues = PaddingValues(16.dp) ) {- OutlinedTextField(- value = value,- onValueChange = onValueChange,+ val focusManager = LocalFocusManager.current+ SearchBarInputField(+ query = value,+ onQueryChange = onValueChange,+ // Live filtering already applied the query; the IME action just dismisses.+ onSearch = { focusManager.clearFocus() },+ expanded = false,+ onExpandedChange = {}, modifier = modifier .fillMaxWidth() .padding(padding),@@ -35,7 +55,5 @@ fun CommonSearchBar( } } } else null,- shape = MaterialTheme.shapes.extraLarge,- singleLine = true ) }
library/ui/src/main/java/com/vayunmathur/library/ui/DetailScaffold.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/DetailScaffold.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/DetailScaffold.ktindex 6c99285be9..43b68347bd 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/DetailScaffold.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/DetailScaffold.kt@@ -28,7 +28,8 @@ import com.vayunmathur.library.util.NavKey * and free-form content; this fills the gap that every detail screen was closing * by hand: `AppScaffold { pad -> Column(fillMaxSize().padding(pad) * .padding(horizontal = 16.dp).verticalScroll(...), spacedBy(12.dp)) { ... } }`.- * The horizontal inset ([Spacing.lg]) and the gap between blocks ([Spacing.md])+ * The horizontal inset ([paneContentMargin], [Spacing.lg] on phones and wider on+ * expanded widths) and the gap between blocks ([Spacing.md]) * are normalised here so detail screens stop drifting apart. * * The content lambda runs in a [ColumnScope] that is already scrolling; use@@ -205,7 +206,7 @@ private fun DetailColumn(pad: PaddingValues, content: @Composable ColumnScope.() modifier = Modifier .fillMaxSize() .padding(pad)- .padding(horizontal = Spacing.lg)+ .padding(horizontal = paneContentMargin()) .verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(Spacing.md), content = content,@@ -215,11 +216,12 @@ private fun DetailColumn(pad: PaddingValues, content: @Composable ColumnScope.() @Composable private fun DetailList(pad: PaddingValues, content: LazyListScope.() -> Unit) { val direction = LocalLayoutDirection.current+ val margin = paneContentMargin() LazyColumn( modifier = Modifier.fillMaxSize(), contentPadding = PaddingValues(- start = pad.calculateStartPadding(direction) + Spacing.lg,- end = pad.calculateEndPadding(direction) + Spacing.lg,+ start = pad.calculateStartPadding(direction) + margin,+ end = pad.calculateEndPadding(direction) + margin, top = pad.calculateTopPadding(), bottom = pad.calculateBottomPadding(), ),
library/ui/src/main/java/com/vayunmathur/library/ui/DynamicTheme.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/DynamicTheme.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/DynamicTheme.ktindex 59db072870..f38c14ca3d 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/DynamicTheme.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/DynamicTheme.kt@@ -1,5 +1,3 @@-@file:OptIn(androidx.compose.material3.ExperimentalMaterial3ExpressiveApi::class)- package com.vayunmathur.library.ui import androidx.compose.foundation.isSystemInDarkTheme
library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.ktindex 25dea767ca..916ff85ac8 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/FormComponents.kt@@ -211,6 +211,10 @@ private fun SharedTextLabeledField( * [optionLabel] formats each dropdown option; when null the row's [typeLabel] * is not used for options (callers that need localized type names should pass * it explicitly, e.g. via `ContactDetail.default<T>().withType(option)`).+ *+ * The type picker is single-choice: the row's current type renders selected+ * via [SelectableDropdownMenuItem], so [T] must expose its type through+ * [currentType]. */ @Composable fun <T> FormDetailGroup(@@ -225,6 +229,7 @@ fun <T> FormDetailGroup( onRemove: (Int) -> Unit, onAdd: () -> Unit, modifier: Modifier = Modifier,+ currentType: (T) -> Int, keyboardType: KeyboardType = KeyboardType.Text, visualTransformation: VisualTransformation = VisualTransformation.None, isCustom: (T) -> Boolean = { false },@@ -273,12 +278,14 @@ fun <T> FormDetailGroup( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { typeOptions.forEach { option ->- DropdownMenuItem(- text = { Text(optionLabel?.invoke(option) ?: option.toString()) },+ SelectableDropdownMenuItem(+ selected = currentType(item) == option, onClick = { onTypeChange(index, option) expanded = false },+ text = { Text(optionLabel?.invoke(option) ?: option.toString()) },+ selectedLeadingIcon = { IconCheck() }, ) } }
library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.ktindex e490449d4d..4a035be7fc 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/GameCenterScreen.kt@@ -11,7 +11,6 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults-import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.LinearProgressIndicator@@ -36,7 +35,6 @@ import com.vayunmathur.library.util.BaseBackupAgent import androidx.compose.ui.res.stringResource import com.vayunmathur.library.ui.R -@OptIn(ExperimentalMaterial3Api::class) @Composable fun GameCenterScreen( backupAgent: BaseBackupAgent,
library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.ktindex 196960f08e..020d8fff0b 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/HistoryScrubber.kt@@ -132,7 +132,7 @@ fun RowScope.HistoryStepButton(label: String, onClick: () -> Unit) { } } -@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class, ExperimentalTime::class)+@OptIn(ExperimentalTime::class) // Floating overlay card with no host bar to defer to: it owns its own nav-bar // inset. Exempt from WindowInsetsInReusableComponent (not a keyboard-tracking bar). @Suppress("WindowInsetsInReusableComponent")
library/ui/src/main/java/com/vayunmathur/library/ui/LazyListScaffold.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/LazyListScaffold.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/LazyListScaffold.ktindex 4afaf24ef5..6daa989c40 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/LazyListScaffold.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/LazyListScaffold.kt@@ -38,6 +38,14 @@ import androidx.compose.ui.unit.dp * the [TopAppBar] for you; with neither, and no [topBar], no bar is drawn. Everything * else matches the shared [Scaffold] wrapper (same param names/types) so it stays a * drop-in replacement.+ *+ * [expandedWidthPadding] is extra horizontal padding applied on top of+ * [horizontalPadding] only on expanded widths - the two-pane tablet/foldable+ * case - so list panes gain the wider gutter there while phone layouts keep+ * exactly the [horizontalPadding] they pass today. It defaults to the adaptive+ * [paneContentMargin], which is [Spacing.lg] on compact widths; callers that+ * already pass their own margin (e.g. 16.dp) can pass [Spacing.lg] explicitly+ * to stay fixed, or `0.dp` to opt out entirely. */ @Composable fun LazyListScaffold(@@ -52,6 +60,7 @@ fun LazyListScaffold( floatingActionButtonPosition: FabPosition = FabPosition.End, state: LazyListState = rememberLazyListState(), horizontalPadding: Dp = 0.dp,+ expandedWidthPadding: Dp = paneContentMargin(), verticalArrangement: Arrangement.Vertical = Arrangement.Top, containerColor: Color = MaterialTheme.colorScheme.background, content: LazyListScope.() -> Unit,@@ -70,12 +79,15 @@ fun LazyListScaffold( containerColor, ) { pad -> val dir = LocalLayoutDirection.current+ // Only the width class above compact adds padding; on phones this is+ // exactly [horizontalPadding], unchanged from before.+ val extra = (expandedWidthPadding - Spacing.lg).coerceAtLeast(0.dp) LazyColumn( modifier = Modifier.fillMaxSize(), state = state, contentPadding = PaddingValues(- start = pad.calculateStartPadding(dir) + horizontalPadding,- end = pad.calculateEndPadding(dir) + horizontalPadding,+ start = pad.calculateStartPadding(dir) + horizontalPadding + extra,+ end = pad.calculateEndPadding(dir) + horizontalPadding + extra, top = pad.calculateTopPadding(), bottom = pad.calculateBottomPadding(), ),
library/ui/src/main/java/com/vayunmathur/library/ui/ListPage.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/ListPage.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/ListPage.ktindex c2eb7c2e01..237c3d9588 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/ListPage.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/ListPage.kt@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.rememberLazyListState-import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem@@ -32,7 +31,6 @@ import com.vayunmathur.library.util.NavKey import com.vayunmathur.library.util.DatabaseItem import kotlinx.coroutines.launch -@OptIn(ExperimentalMaterial3Api::class) @Composable inline fun <reified T : DatabaseItem, Route : NavKey, reified EditPage : Route> ListPage( backStack: NavBackStack<Route>,
library/ui/src/main/java/com/vayunmathur/library/ui/MaterialAliases.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialAliases.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialAliases.ktindex 1cef855b9e..40db4193ba 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialAliases.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialAliases.kt@@ -50,6 +50,7 @@ typealias BottomSheetDefaults = androidx.compose.material3.BottomSheetDefaults typealias ButtonDefaults = androidx.compose.material3.ButtonDefaults typealias CardDefaults = androidx.compose.material3.CardDefaults typealias ExposedDropdownMenuDefaults = androidx.compose.material3.ExposedDropdownMenuDefaults+typealias MenuDefaults = androidx.compose.material3.MenuDefaults typealias FilterChipDefaults = androidx.compose.material3.FilterChipDefaults typealias FloatingActionButtonDefaults = androidx.compose.material3.FloatingActionButtonDefaults typealias ListItemDefaults = androidx.compose.material3.ListItemDefaults@@ -63,6 +64,9 @@ typealias TopAppBarDefaults = androidx.compose.material3.TopAppBarDefaults // --- Colors / elevation / shapes state --- typealias ListItemColors = androidx.compose.material3.ListItemColors+typealias MenuItemColors = androidx.compose.material3.MenuItemColors+typealias SelectableMenuItemColors = androidx.compose.material3.SelectableMenuItemColors+typealias MenuItemShapes = androidx.compose.material3.MenuItemShapes typealias CheckboxColors = androidx.compose.material3.CheckboxColors typealias CheckboxDefaults = androidx.compose.material3.CheckboxDefaults typealias ListItemElevation = androidx.compose.material3.ListItemElevation@@ -93,12 +97,14 @@ typealias SwipeToDismissBoxValue = androidx.compose.material3.SwipeToDismissBoxV typealias SnackbarResult = androidx.compose.material3.SnackbarResult typealias SnackbarDuration = androidx.compose.material3.SnackbarDuration typealias SelectableDates = androidx.compose.material3.SelectableDates+typealias TimePickerSelectionMode = androidx.compose.material3.TimePickerSelectionMode // --- State classes --- typealias SnackbarHostState = androidx.compose.material3.SnackbarHostState typealias DrawerState = androidx.compose.material3.DrawerState typealias SwipeToDismissBoxState = androidx.compose.material3.SwipeToDismissBoxState typealias DatePickerState = androidx.compose.material3.DatePickerState+typealias TimePickerState = androidx.compose.material3.TimePickerState typealias SheetState = androidx.compose.material3.SheetState typealias BottomSheetScaffoldState = androidx.compose.material3.BottomSheetScaffoldState typealias SliderState = androidx.compose.material3.SliderState
library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.ktindex e396eed775..21d817b240 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponents.kt@@ -680,10 +680,68 @@ fun DropdownMenuItem( leadingIcon: (@Composable () -> Unit)? = null, trailingIcon: (@Composable () -> Unit)? = null, enabled: Boolean = true,+ colors: MenuItemColors = MenuDefaults.itemColors(), contentPadding: PaddingValues = MenuDefaults.DropdownMenuItemContentPadding, ) = androidx.compose.material3.DropdownMenuItem( text = text, onClick = onClick, modifier = modifier, leadingIcon = leadingIcon,- trailingIcon = trailingIcon, enabled = enabled, contentPadding = contentPadding,+ trailingIcon = trailingIcon, enabled = enabled, colors = colors, contentPadding = contentPadding,+)++/**+ * A dropdown item for a single choice among [DropdownMenu] siblings.+ *+ * Unlike [DropdownMenuItem], the [selected] item renders with selection colors+ * ([colors]) and an optional [selectedLeadingIcon] that only shows while+ * selected, so a menu reads which option is current without a hand-rolled+ * tick. Pass `MenuDefaults.selectableItemVibrantColors()` for [colors] for+ * the vibrant variant.+ */+@Composable+fun SelectableDropdownMenuItem(+ selected: Boolean,+ onClick: () -> Unit,+ text: @Composable () -> Unit,+ modifier: Modifier = Modifier,+ enabled: Boolean = true,+ leadingIcon: (@Composable () -> Unit)? = null,+ selectedLeadingIcon: (@Composable () -> Unit)? = null,+ trailingContent: (@Composable () -> Unit)? = null,+ supportingText: (@Composable () -> Unit)? = null,+ shapes: MenuItemShapes = MenuDefaults.itemShapes(),+ colors: SelectableMenuItemColors = MenuDefaults.selectableItemColors(),+ contentPadding: PaddingValues = MenuDefaults.DropdownMenuSelectableItemContentPadding,+) = androidx.compose.material3.SelectableDropdownMenuItem(+ selected = selected, onClick = onClick, text = text, shapes = shapes, modifier = modifier,+ leadingIcon = leadingIcon, selectedLeadingIcon = selectedLeadingIcon,+ trailingContent = trailingContent, supportingText = supportingText, enabled = enabled,+ colors = colors, contentPadding = contentPadding,+)++/**+ * A dropdown item for toggling one option on/off, e.g. a multi-choice menu.+ *+ * Mirrors [SelectableDropdownMenuItem] but reports the new [checked] value+ * through [onCheckedChange] and shows [checkedLeadingIcon] while checked.+ */+@Composable+fun CheckableDropdownMenuItem(+ checked: Boolean,+ onCheckedChange: (Boolean) -> Unit,+ text: @Composable () -> Unit,+ modifier: Modifier = Modifier,+ enabled: Boolean = true,+ leadingIcon: (@Composable () -> Unit)? = null,+ checkedLeadingIcon: (@Composable () -> Unit)? = null,+ trailingContent: (@Composable () -> Unit)? = null,+ supportingText: (@Composable () -> Unit)? = null,+ shapes: MenuItemShapes = MenuDefaults.itemShapes(),+ colors: SelectableMenuItemColors = MenuDefaults.selectableItemColors(),+ contentPadding: PaddingValues = MenuDefaults.DropdownMenuSelectableItemContentPadding,+) = androidx.compose.material3.CheckableDropdownMenuItem(+ checked = checked, onCheckedChange = onCheckedChange, text = text, shapes = shapes,+ modifier = modifier, leadingIcon = leadingIcon, checkedLeadingIcon = checkedLeadingIcon,+ trailingContent = trailingContent, supportingText = supportingText, enabled = enabled,+ colors = colors, contentPadding = contentPadding, ) // --- Chips ---
library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponentsExtra.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponentsExtra.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponentsExtra.ktindex 3d480c242c..23d1c533e7 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponentsExtra.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialComponentsExtra.kt@@ -10,6 +10,7 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.RowScope import androidx.compose.material3.BottomSheetDefaults+import androidx.compose.material3.ExposedDropdownMenu as Material3ExposedDropdownMenu import androidx.compose.material3.ExposedDropdownMenuBox as Material3ExposedDropdownMenuBox import androidx.compose.material3.FloatingActionButtonMenuItem as Material3FloatingActionButtonMenuItem import androidx.compose.material3.TabRowDefaults@@ -48,7 +49,9 @@ fun ExposedDropdownMenuBoxScope.ExposedDropdownMenu( onDismissRequest: () -> Unit, modifier: Modifier = Modifier, content: @Composable ColumnScope.() -> Unit,-) = ExposedDropdownMenu(expanded = expanded, onDismissRequest = onDismissRequest, modifier = modifier, content = content)+): Unit = Material3ExposedDropdownMenu(+ expanded = expanded, onDismissRequest = onDismissRequest, modifier = modifier, content = content,+) // --- Navigation drawer item --- @Composable@@ -84,7 +87,7 @@ fun FlexibleBottomAppBar( fun ModalBottomSheet( onDismissRequest: () -> Unit, modifier: Modifier = Modifier,- sheetState: SheetState = rememberModalBottomSheetState(),+ sheetState: SheetState = rememberBottomSheetState(), containerColor: Color = BottomSheetDefaults.ContainerColor, content: @Composable ColumnScope.() -> Unit, ) = androidx.compose.material3.ModalBottomSheet(@@ -308,7 +311,7 @@ fun NavigationSuiteScaffold( navigationSuiteItems: NavigationSuiteScope.() -> Unit, modifier: Modifier = Modifier, layoutType: NavigationSuiteType = androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffoldDefaults- .calculateFromAdaptiveInfo(androidx.compose.material3.adaptive.currentWindowAdaptiveInfo()),+ .calculateFromAdaptiveInfo(androidx.compose.material3.adaptive.currentWindowAdaptiveInfoV2()), content: @Composable () -> Unit, ) = androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold( navigationSuiteItems = navigationSuiteItems, modifier = modifier, layoutType = layoutType, content = content,
library/ui/src/main/java/com/vayunmathur/library/ui/MaterialFunctions.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialFunctions.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialFunctions.ktindex 2e6a3513a0..c04bc01a2c 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialFunctions.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/MaterialFunctions.kt@@ -38,11 +38,22 @@ fun rememberDrawerState( ) = androidx.compose.material3.rememberDrawerState(initialValue, confirmStateChange) @Composable-fun rememberTimePickerState(initialHour: Int = 0, initialMinute: Int = 0) =- androidx.compose.material3.rememberTimePickerState(+fun rememberTimePickerState(+ initialHour: Int = 0,+ initialMinute: Int = 0,+ is24Hour: Boolean = true,+ initialSelection: TimePickerSelectionMode = TimePickerSelectionMode.Hour,+): TimePickerState {+ val state = androidx.compose.material3.rememberTimePickerState( initialHour = initialHour, initialMinute = initialMinute,+ is24Hour = is24Hour, )+ // M3 alpha27 exposes selection only as a mutable property, so apply the initial+ // value once when the state is created — never on recomposition, or user taps+ // on the minute dial would be stomped back.+ return remember(state) { state.apply { selection = initialSelection } }+} @Composable fun rememberDatePickerState(initialSelectedDateMillis: Long? = null) =@@ -111,7 +122,7 @@ fun rememberSliderState( // --- Adaptive --- @Composable-fun currentWindowAdaptiveInfo() = androidx.compose.material3.adaptive.currentWindowAdaptiveInfo()+fun currentWindowAdaptiveInfo() = androidx.compose.material3.adaptive.currentWindowAdaptiveInfoV2() @Composable fun rememberSwipeToDismissBoxState(
library/ui/src/main/java/com/vayunmathur/library/ui/PaneMargins.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/PaneMargins.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/PaneMargins.ktnew file mode 100644index 0000000000..0d287b312b--- /dev/null+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/PaneMargins.kt@@ -0,0 +1,38 @@+package com.vayunmathur.library.ui++import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi+import androidx.compose.runtime.Composable+import androidx.compose.ui.unit.Dp+import androidx.window.core.layout.WindowSizeClass++/**+ * Width-aware horizontal content margin for list and detail panes.+ *+ * Phones keep the standard [Spacing.lg] margin; on expanded widths panes gain+ * the wider [Spacing.xl] gutter so content does not sit against the outer+ * screen edges. The threshold is the same+ * [WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND] breakpoint at which the Nav3+ * list-detail strategy in `MainNavigation` starts showing two panes side by+ * side, so single-pane and two-pane layouts never disagree about which margin+ * applies (a landscape phone wide enough for two panes gets the wide gutter in+ * both).+ *+ * There is no directive-level margin API to hook into: `PaneScaffoldDirective`+ * carries only partition counts, spacer sizes and preferred pane widths, and+ * `ListDetailPaneScaffoldDefaults` only pane order plus adapt strategies. The+ * shared scaffolds therefore apply this directly - see `DetailScaffold` and+ * `LazyListScaffold`. Inset handling is deliberately untouched here; the+ * manual chain in `MainNavigation` (disabled automatic insets, snackbar+ * re-padding, consume plus IME padding) stays exactly as it is.+ */+@OptIn(ExperimentalMaterial3AdaptiveApi::class)+@Composable+fun paneContentMargin(): Dp =+ if (+ currentWindowAdaptiveInfo().windowSizeClass+ .isWidthAtLeastBreakpoint(WindowSizeClass.WIDTH_DP_MEDIUM_LOWER_BOUND)+ ) {+ Spacing.xl+ } else {+ Spacing.lg+ }
library/ui/src/main/java/com/vayunmathur/library/ui/SelectionMode.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/SelectionMode.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/SelectionMode.ktindex ad08d55637..2c00e9d840 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/SelectionMode.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/SelectionMode.kt@@ -2,7 +2,6 @@ package com.vayunmathur.library.ui import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.RowScope-import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable@@ -63,7 +62,6 @@ fun <T> rememberSelectionState(): SelectionState<T> { * leaving the screen, which is what a user expects and what some of the * hand-rolled versions missed. */-@OptIn(ExperimentalMaterial3Api::class) @Composable fun <T> SelectionTopAppBar( state: SelectionState<T>,
library/ui/src/main/java/com/vayunmathur/library/ui/SettingsComponents.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/SettingsComponents.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/SettingsComponents.ktindex 71fad7ed52..488029c7ca 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/SettingsComponents.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/SettingsComponents.kt@@ -173,13 +173,14 @@ fun <T> SettingsSelectRow( ) DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { options.forEach { option ->- DropdownMenuItem(- text = { Text(label(option)) },+ SelectableDropdownMenuItem(+ selected = option == selected, onClick = { expanded = false onSelect(option) },- trailingIcon = if (option == selected) ({ IconCheck() }) else null,+ text = { Text(label(option)) },+ selectedLeadingIcon = { IconCheck() }, ) } }@@ -195,7 +196,6 @@ fun <T> SettingsSelectRow( * [itemSupporting] adds a second line under each option (e.g. a codec's * description). */-@OptIn(ExperimentalMaterial3Api::class) @Composable fun <T> SettingsExposedSelectRow( label: String,@@ -224,7 +224,9 @@ fun <T> SettingsExposedSelectRow( .fillMaxWidth() .menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable), )- ExposedDropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) {+ ExposedDropdownMenu(+ expanded = expanded, onDismissRequest = { expanded = false }+ ) { options.forEach { option -> DropdownMenuItem( text = {
library/ui/src/main/java/com/vayunmathur/library/ui/game/GameModeChooser.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/game/GameModeChooser.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/game/GameModeChooser.ktindex 68551a3527..e051acdfdc 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/game/GameModeChooser.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/game/GameModeChooser.kt@@ -10,9 +10,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.style.TextOverflow import com.vayunmathur.library.ui.DropdownMenu-import com.vayunmathur.library.ui.DropdownMenuItem import com.vayunmathur.library.ui.IconArrowDropDown+import com.vayunmathur.library.ui.IconCheck import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.SelectableDropdownMenuItem import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TextButton @@ -56,12 +57,14 @@ fun <T> GameModeChooser( } DropdownMenu(expanded = expanded, onDismissRequest = { expanded = false }) { for (option in options) {- DropdownMenuItem(- text = { Text(menuLabel(option)) },+ SelectableDropdownMenuItem(+ selected = option == selected, onClick = { expanded = false onSelect(option) },+ text = { Text(menuLabel(option)) },+ selectedLeadingIcon = { IconCheck() }, ) } }