Settings Screen: Java/XML to Kotlin/Compose migration - #56
Conversation
There was a problem hiding this comment.
UI things I found:
-
I never see the snackbar messages after an Import finishes. Is it only broadcasted in special circumstances?
-
I feel the Settings cells should be lighter and not darker than the background. It helps having a greater contrast with the cell description (onSurfaceVariant). Here's an example from the latest Google Messaging app:
| Messaging | New Contacts |
|---|---|
![]() |
![]() |
Their space between cells is also slightly lower (1 vs 2 dp), which I find pleasant. And also the top padding is slightly lower (8 vs 16 dp). But I'm not 100% sure those are improvements to be honest.
| @@ -0,0 +1,95 @@ | |||
| package com.android.contacts.ui.settings.about.ui | |||
There was a problem hiding this comment.
Not sure this needs the extra ui package.
| ), | ||
| ) { | ||
| SettingsCell( | ||
| title = stringResource(R.string.about_build_version), |
There was a problem hiding this comment.
It's a new requirement, but I always feel build / version numbers should always be at least selectable, if not copy-able.
| sealed interface Host : SettingsEffect | ||
| sealed interface Message : SettingsEffect |
There was a problem hiding this comment.
Nice approach, hadn't seen it before 👍
| ) { currentRoute -> | ||
| when (currentRoute) { | ||
| SettingsNavRoute.Main -> { | ||
| SettingsMainScreen( |
There was a problem hiding this comment.
Naming is definitely hard.
SettingsScreen > SettingsContent > SettingsMainScreen feels a bit weird to me, but do we have an alternative name for this parent Screens than hold navigation inside for other screens? Or maybe we call the inner screens Panes like for adaptive layouts?
| displaySettingsRepository.setSortOrder(sortOrder) | ||
| refreshState() |
There was a problem hiding this comment.
This we're writing the Repository ourselves here, we could also make them reactive instead: return a flow, and the flow automatically updates on a set.
|
Sorry for barging in here. I'd just like to comment on this, since I noticed similar things while making mockups for #37.
The way it is now is in accordance to the MD3E guidelines. Google themself don't always stick to them however and their implementation is inconsistent across their apps. I'd suggest going with the Material Design guidelines over Google's reference when in question. Apart from that I would argue, that there's more separation and emphasis on each settings item here, giving the screen more structure, compared to Google's implementation. Contrast is still sufficient if you ask me.
I think this might be an optical illusion as a result of the color roles being reversed here. |
I feel even the MD3E guidelines has examples with both approaches, that's why I started looking at concrete apps. But you are right that in general the Color guideline is Background (outside) > SurfaceContainer (inside). Maybe I should switch here as well then (#33), since I was matching the Google Contacts app. But maybe we can tone it down a bit? We're defaulting to I tested the text color contrast with the accessibility scanner and
Could be yeah. In the guidelines I only find a mention to a |
|
I also noticed the scroll position it's not kept when returning from AboutScreen to the MainSettingsScreen. Not a big deal, but I sort of expected it. |
Yes, it seems not completely clear cut. I also looked around for more examples. The new Gallery app for example matches the current state. Interestingly the systems settings match the current behavior in dark mode, but in light mode it's reversed and matches Google Messagings implementation.
I wouldn't recommend that. There's quite a bit of thought in those color roles and it might not matter for this screen, but if you want to apply this evenly across all screens and apps, you might end up in a situation where these color roles where reserved for other components and on screen and now you'd have to change those components as well to retain a hierarchy. So I think it's better to pick between the default behavior, how it is now and Google Messagings implementation. Neither is a bad choice, though I would personally lean towards the current one. |
04c125c to
8ba0c2d
Compare
RankoR
left a comment
There was a problem hiding this comment.
Also:
- AppCompat dialogs crash under Theme.Compose, worth adding
<item name="alertDialogTheme">@style/ContactsAlertDialogThemeAppCompat</item>to theme accompanist-drawablepainterandkotlin-parcelizeseem to be dead dependencies nowlint-baseline.xmlreferences deleted files
| private val profile: StateFlow<ProfileData?> = profileRepository.observeProfile() | ||
| .stateIn( | ||
| scope = viewModelScope, | ||
| started = SharingStarted.Eagerly, |
There was a problem hiding this comment.
Maybe WhileSubscribed(STATE_STOP_TIMEOUT_MILLIS)?
| buildVersion = uiState.buildVersion, | ||
| onBuildVersionLongClick = { onAction(Action.BuildVersionLongClicked) }, | ||
| onLicensesClick = { onAction(Action.LicensesClicked) }, | ||
| onNavigateBack = { route = SettingsNavRoute.Main }, |
| effectHandler: SettingsEffectHandler, | ||
| onNavigateBack: () -> Unit, | ||
| modifier: Modifier = Modifier, | ||
| screenModel: SettingsScreenModel = viewModel<SettingsViewModel>(), |
There was a problem hiding this comment.
Should be hiltViewModel<SettingsViewModel>() I guess


Closes #41
Screenshots
Video
Screen_recording_20260808_150325.mp4