Status Update
Comments
an...@gmail.com <an...@gmail.com> #2
Related to
ra...@google.com <ra...@google.com>
sa...@gmail.com <sa...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Galhardo <
Link:
Add MutableStateSerializer
for serializing MutableState
Expand for full commit details
Add `MutableStateSerializer` for serializing `MutableState`
- Introduced an inline `MutableStateSerializer` function to infer and retrieve the appropriate `KSerializer` for `MutableState` of a serializable type.
- Added an overload of `MutableStateSerializer` that accepts an explicit `KSerializer` for the wrapped type, allowing for customizing the `KSerializer`.
- Implemented `MutableStateSerializerImpl`, a private class that handles the serialization and deserialization logic for `MutableState`, delegating inner value processing to the provided `KSerializer`.
- Only `KSerializer<MutableState<T>>` is exposed; the `MutableStateSerializerImpl` remains private.
RelNote: "Add `MutableStateSerializer` for serializing `androidx.compose.runtime.MutableState`."
Test: MutableStateSerializerTest
Bug: 378895074
Change-Id: Idfc489d9313461bddd0046052d0f6a41644e7712
Files:
- M
lifecycle/lifecycle-viewmodel-compose/api/current.txt
- M
lifecycle/lifecycle-viewmodel-compose/api/restricted_current.txt
- M
lifecycle/lifecycle-viewmodel-compose/build.gradle
- A
lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/serialization/serializers/MutableStateSerializerTest.android.kt
- A
lifecycle/lifecycle-viewmodel-compose/src/commonMain/kotlin/androidx/lifecycle/viewmodel/compose/serialization/serializers/MutableStateSerializer.kt
Hash: d628386123647d7f90b6efb2ddde93621c7cc7db
Date: Fri Jan 17 11:18:40 2025
ni...@gmail.com <ni...@gmail.com> #4
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Galhardo <
Link:
Move KMP compatible test dependencies to commonTest
Expand for full commit details
Move KMP compatible test dependencies to `commonTest`
Test: N/A
Bug: 378895074
Change-Id: I77d03d1da41808e03d5e2978b768dc3ef6649211
Files:
- M
lifecycle/lifecycle-viewmodel-compose/build.gradle
Hash: e266fa197c54fe55955b2de9acc1c1d9894e6376
Date: Fri Jan 17 14:25:48 2025
ra...@gmail.com <ra...@gmail.com> #5
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Galhardo <
Link:
Move MutableStateSerializer
to savedstate-compose
Expand for full commit details
Move `MutableStateSerializer` to `savedstate-compose`
- This change moves `MutableStateSerializer` from `lifecycle-viewmodel-compose` to `savedstate-compose`. This corrects its previous misplacement and aligns with the design outlined in go/savedstate-compose, which specifies that all `savedstate-compose` related APIs should reside within the `savedstate-compose` module.
RelNote: "Move `MutableStateSerializer` to `savedstate-compose`."
Test: MutableStateSerializerTest
Bug: 378895074
Change-Id: I4f690e41dc5619d185784409170943abeb0f0550
Files:
- M
lifecycle/lifecycle-viewmodel-compose/api/current.txt
- M
lifecycle/lifecycle-viewmodel-compose/api/restricted_current.txt
- M
savedstate/savedstate-compose/api/current.txt
- M
savedstate/savedstate-compose/api/restricted_current.txt
- M
savedstate/savedstate-compose/src/androidInstrumentedTest/kotlin/androidx/savedstate/compose/serialization/serializers/MutableStateSerializerTest.android.kt
- M
savedstate/savedstate-compose/src/commonMain/kotlin/androidx/savedstate/compose/serialization/serializers/MutableStateSerializer.kt
Hash: f845eabb6c5e3b138059839e59f383f70304d792
Date: Wed Jan 29 11:31:04 2025
se...@gmail.com <se...@gmail.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha10
androidx.lifecycle:lifecycle-viewmodel-compose-android:2.9.0-alpha10
androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.9.0-alpha10
androidx.savedstate:savedstate-compose:1.3.0-alpha08
androidx.savedstate:savedstate-compose-android:1.3.0-alpha08
androidx.savedstate:savedstate-compose-jvmstubs:1.3.0-alpha08
androidx.savedstate:savedstate-compose-linuxx64stubs:1.3.0-alpha08
Description
Jetpack Compose component used: TabRow
Android Studio Build: Android Studio Chipmunk | 2021.2.1 Patch 1
Kotlin version: 1.6.10
I am using TabRow composible where I am expected to create tabrow with fixed spacing in between tab items (see the "expected" image). I am finding that all the tab items are getting divided equally in the specified width (see the "actual" image) and so not distanced as per my required specifications. The padding I am adding is making it even worse.
Is there any way to achieve fixed specified spacing between tabs in TabRow? My TabRow is not expected to scroll so ScrollableTabRow cannot be used (not sure if that can fix this issue though)
Steps to Reproduce or Code Sample to Reproduce:
1. @Composable
fun HomeCategoryTabIndicator(
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colors.onSurface
) {
Spacer(
modifier
.padding(horizontal = 10.dp)
.height(4.dp)
.background(color, RoundedCornerShape(topStartPercent = 100, topEndPercent = 100))
)
}
@Composable
fun MyTab(
onClick: (String) -> Unit,
title: String
) {
Column(
Modifier
.padding(10.dp)
.wrapContentHeight()
.wrapContentWidth()
.clickable {onClick(title)},
verticalArrangement = Arrangement.SpaceBetween
) {
Text(
text = title,
style = MaterialTheme.typography.body1,
modifier = Modifier.align(Alignment.CenterHorizontally)
)
}
}
@Composable
private fun HomeCategoryTabs(
categories: List<HomeCategory>,
selectedCategory: HomeCategory,
onCategorySelected: (HomeCategory) -> Unit
) {
val selectedIndex = categories.indexOfFirst { it == selectedCategory }
val indicator = @Composable { tabPositions: List<TabPosition> ->
HomeCategoryTabIndicator(
Modifier.tabIndicatorOffset(tabPositions[selectedIndex]),
color = MaterialTheme.ts.colors.primary,
)
}
TabRow(
modifier = Modifier.width(330.dp),
selectedTabIndex = selectedIndex,
indicator = indicator,
) {
categories.forEach { category ->
MyTab(
onClick = {
onCategorySelected(category)
},
title = when (category) {
HomeCategory.Market -> "Market"
HomeCategory.Sector -> "Sector"
HomeCategory.News -> "News"
HomeCategory.Ideas -> "Ideas"
HomeCategory.Events -> "Events"
}
)
}
}
}
2.
3.
Stack trace (if applicable):