Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces reliance on globally-scoped theme dimension tokens by trimming MihomoDimens down to only the shared/common spacing values, and migrating screen-specific spacing/sizing to local dp constants (or inlined values) within each screen.
Changes:
- Shrink
MihomoDimens/DefaultMihomoDimensto a minimal set of common tokens and remove unused imports. - Replace removed
mihomoDimens.*usages across Settings, Proxy, Profile, Log, and Home UI with localdpvalues/constants. - Introduce a few screen-local constants (e.g.,
gridContentPadding, Home layout constants) to keep spacing readable after the theme token removal.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/main/kotlin/com/github/kr328/clash/ui/theme/Theme.kt | Removes many screen-specific dimension tokens from MihomoDimens, keeping only shared/common ones. |
| ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/EditableTextMapScreen.kt | Replaces dialog button bar padding from theme dimens with local dp values. |
| ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/EditableTextListScreen.kt | Same as above; adds required dp import and uses local padding values. |
| ui/proxy/src/main/kotlin/com/github/kr328/clash/proxy/ui/ProxyScreen.kt | Replaces proxy layout sizing/padding tokens with local values and adds gridContentPadding. |
| ui/profile/src/main/kotlin/com/github/kr328/clash/profile/ui/ProvidersScreen.kt | Replaces removed middle-margin/divider/trailing-size tokens with local dp values. |
| ui/profile/src/main/kotlin/com/github/kr328/clash/profile/ui/PropertiesScreen.kt | Replaces toolbar action progress sizing and horizontal content padding with local dp values. |
| ui/profile/src/main/kotlin/com/github/kr328/clash/profile/ui/ProfilesScreen.kt | Replaces toolbar progress sizing and middle-margin spacing with local dp values. |
| ui/log/src/main/kotlin/com/github/kr328/clash/log/ui/LogcatScreen.kt | Replaces log message padding tokens with a local dp value. |
| ui/home/src/main/kotlin/com/github/kr328/clash/home/ui/HomeScreen.kt | Replaces home screen spacing tokens with file-local constants for reuse within the screen. |
Comments suppressed due to low confidence (1)
ui/profile/src/main/kotlin/com/github/kr328/clash/profile/ui/ProfilesScreen.kt:317
- Several layout values here (e.g.,
10.dppadding around the updated-at text and1.dpdivider width) are now raw numbers. To improve readability and make later design adjustments safer, consider introducing named constants local to this screen (similar to what was done in HomeScreen) for these spacing tokens.
Text(
text = (currentTime - profile.updatedAt).elapsedIntervalString(context),
style = MaterialTheme.typography.labelSmall,
modifier = Modifier.padding(horizontal = 10.dp),
)
Box(
modifier =
Modifier.width(1.dp).height(itemMinHeight).background(MaterialTheme.colorScheme.outline)
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
148
to
150
| if (processing) { | ||
| CircularProgressIndicator( | ||
| modifier = Modifier.size(dimens.itemTrailingComponentSize / 2), | ||
| strokeWidth = dimens.toolbarImageActionPadding / 2, | ||
| ) | ||
| CircularProgressIndicator(modifier = Modifier.size(15.dp), strokeWidth = 2.5.dp) | ||
| } else { |
Comment on lines
201
to
204
| IconButton(onClick = onUpdateAll, enabled = !allUpdating) { | ||
| if (allUpdating) { | ||
| val dimens = mihomoDimens | ||
| CircularProgressIndicator( | ||
| modifier = Modifier.size(dimens.itemTrailingComponentSize / 2), | ||
| strokeWidth = dimens.toolbarImageActionPadding / 2, | ||
| ) | ||
| CircularProgressIndicator(modifier = Modifier.size(15.dp), strokeWidth = 2.5.dp) | ||
| } else { |
Comment on lines
145
to
161
| @@ -158,10 +157,7 @@ private fun ProviderItem(state: ProviderItemState, currentTime: Long, onUpdate: | |||
| modifier = Modifier.padding(horizontal = 4.dp), | |||
| ) { | |||
| if (state.updating) { | |||
| CircularProgressIndicator( | |||
| modifier = Modifier.size(dimens.itemTrailingComponentSize), | |||
| strokeWidth = 2.dp, | |||
| ) | |||
| CircularProgressIndicator(modifier = Modifier.size(30.dp), strokeWidth = 2.dp) | |||
| } else { | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.