Reuse mihomoDimens#109
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates UI spacing/sizing constants by reusing the Compose MihomoDimens theme tokens across multiple screens/components, removing now-redundant XML resources.
Changes:
- Removes XML-based dimen/drawable resources in favor of Compose theme tokens.
- Extends
MihomoDimensand exposes amihomoDimensCompositionLocal accessor for convenient reuse. - Replaces various hard-coded
dpvalues anddimensionResource(...)usages withmihomoDimensacross screens.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/dimens.xml | Removes legacy XML dimen resources. |
| app/src/main/res/drawable/bg_bottom_sheet.xml | Removes an unused legacy drawable resource. |
| app/src/main/kotlin/com/github/kr328/clash/design/ui/theme/Theme.kt | Adds new dimen tokens and exposes mihomoDimens accessor. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/SettingsPreferenceItem.kt | Uses mihomoDimens for item sizing/padding. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/SettingsPreference.kt | Uses mihomoDimens for dialog button bar padding. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/SettingsCommonScreen.kt | Replaces hard-coded paddings with mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/ModelProgressBarDialog.kt | Uses mihomoDimens for dialog padding/spacing. |
| app/src/main/kotlin/com/github/kr328/clash/design/SettingsDesign.kt | Partially migrates settings entry row sizing to mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/ProxyDesign.kt | Reuses mihomoDimens for proxy grid/card padding and shapes. |
| app/src/main/kotlin/com/github/kr328/clash/design/ProvidersDesign.kt | Replaces dimensionResource with mihomoDimens values. |
| app/src/main/kotlin/com/github/kr328/clash/design/PropertiesDesign.kt | Replaces dimensionResource with mihomoDimens values. |
| app/src/main/kotlin/com/github/kr328/clash/design/ProfilesDesign.kt | Replaces dimensionResource with mihomoDimens values. |
| app/src/main/kotlin/com/github/kr328/clash/design/NewProfileDesign.kt | Replaces dimensionResource with mihomoDimens values. |
| app/src/main/kotlin/com/github/kr328/clash/design/MainDesign.kt | Reuses mihomoDimens for main screen layout spacing/sizing. |
| app/src/main/kotlin/com/github/kr328/clash/design/LogsDesign.kt | Partially migrates logs list spacing to mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/LogcatDesign.kt | Reuses mihomoDimens for log item padding/margins. |
| app/src/main/kotlin/com/github/kr328/clash/design/AccessControlDesign.kt | Replaces dimensionResource with mihomoDimens values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/Goooler/MihomoForAndroid/sessions/6b684a6e-3b28-4ef6-8d65-7cd4bda3b920 Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Applied the requested review-thread changes in commit
Applied the requested review-thread changes in commit Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR removes legacy Android dimen/drawable resources and consolidates spacing/sizing into the existing Compose theme dimension tokens (MihomoDimens), accessed via a new mihomoDimens CompositionLocal property.
Changes:
- Delete
values/dimens.xmland replacedimensionResource()/hard-coded dp usage in Compose UI withmihomoDimenstokens. - Expose
mihomoDimensas a@Composable @ReadOnlyComposableaccessor and extendMihomoDimenswith a few additional spacing tokens used by settings/dialog UI. - Remove the unused
bg_bottom_sheet.xmldrawable.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/res/values/dimens.xml | Removed legacy dimen resources in favor of Compose dimension tokens. |
| app/src/main/res/drawable/bg_bottom_sheet.xml | Removed unused bottom-sheet background drawable. |
| app/src/main/kotlin/com/github/kr328/clash/design/ui/theme/Theme.kt | Adds new MihomoDimens fields and exposes mihomoDimens CompositionLocal accessor. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/SettingsPreferenceItem.kt | Replaces hard-coded layout constants with mihomoDimens values. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/SettingsPreference.kt | Uses mihomoDimens for dialog button bar padding. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/SettingsCommonScreen.kt | Uses mihomoDimens for tips/category/clickable item spacing. |
| app/src/main/kotlin/com/github/kr328/clash/design/component/ModelProgressBarDialog.kt | Uses mihomoDimens for dialog padding and spacing. |
| app/src/main/kotlin/com/github/kr328/clash/design/SettingsDesign.kt | Uses mihomoDimens for settings entry row sizing/padding. |
| app/src/main/kotlin/com/github/kr328/clash/design/ProxyDesign.kt | Uses mihomoDimens for grid padding and proxy card shape/padding tokens. |
| app/src/main/kotlin/com/github/kr328/clash/design/ProvidersDesign.kt | Replaces dimensionResource(R.dimen.*) usage with mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/PropertiesDesign.kt | Replaces dimensionResource(R.dimen.*) usage with mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/ProfilesDesign.kt | Replaces dimensionResource(R.dimen.*) usage with mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/NewProfileDesign.kt | Replaces dimensionResource(R.dimen.*) usage with mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/MainDesign.kt | Replaces repeated dp constants with mihomoDimens tokens. |
| app/src/main/kotlin/com/github/kr328/clash/design/LogsDesign.kt | Aligns history header/action rows using mihomoDimens. |
| app/src/main/kotlin/com/github/kr328/clash/design/LogcatDesign.kt | Uses mihomoDimens for log item padding/margins. |
| app/src/main/kotlin/com/github/kr328/clash/design/AccessControlDesign.kt | Replaces dimensionResource(R.dimen.*) usage with mihomoDimens. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.