Skip to content

Reuse mihomoDimens#109

Merged
Goooler merged 4 commits into
trunkfrom
add-dimens
Apr 23, 2026
Merged

Reuse mihomoDimens#109
Goooler merged 4 commits into
trunkfrom
add-dimens

Conversation

@Goooler
Copy link
Copy Markdown
Owner

@Goooler Goooler commented Apr 22, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MihomoDimens and exposes a mihomoDimens CompositionLocal accessor for convenient reuse.
  • Replaces various hard-coded dp values and dimensionResource(...) usages with mihomoDimens across 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.

Comment thread app/src/main/kotlin/com/github/kr328/clash/design/SettingsDesign.kt
Comment thread app/src/main/kotlin/com/github/kr328/clash/design/LogsDesign.kt Outdated
Comment thread app/src/main/kotlin/com/github/kr328/clash/design/LogsDesign.kt Outdated
Comment thread app/src/main/kotlin/com/github/kr328/clash/design/PropertiesDesign.kt Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Goooler

This comment was marked as outdated.

@Goooler
Copy link
Copy Markdown
Owner Author

Goooler commented Apr 23, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown

Copilot AI commented Apr 23, 2026

@copilot apply changes based on the comments in this thread

Applied the requested review-thread changes in commit 06a569f (replaced remaining hard-coded Settings/Logs spacing with mihomoDimens tokens).

Screenshot: UI spacing update

@copilot apply changes based on the comments in this thread

Applied the requested review-thread changes in commit 06a569f (replaced remaining hard-coded Settings/Logs spacing with shared mihomoDimens values).

Screenshot: UI spacing update

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:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx4g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)
  • scans-in.gradle.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED -Xmx4g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.xml and replace dimensionResource()/hard-coded dp usage in Compose UI with mihomoDimens tokens.
  • Expose mihomoDimens as a @Composable @ReadOnlyComposable accessor and extend MihomoDimens with a few additional spacing tokens used by settings/dialog UI.
  • Remove the unused bg_bottom_sheet.xml drawable.

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.

@Goooler Goooler enabled auto-merge (squash) April 23, 2026 02:22
@Goooler Goooler merged commit 9d24017 into trunk Apr 23, 2026
7 checks passed
@Goooler Goooler deleted the add-dimens branch April 23, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants