Skip to content

🎨 Palette: 提升配对按钮的过渡动画和加载状态对比度 - #202

Open
01luyicheng wants to merge 1 commit into
devfrom
palette/pairing-btn-transition-13258300211204111737
Open

01luyicheng wants to merge 1 commit into
devfrom
palette/pairing-btn-transition-13258300211204111737

Conversation

@01luyicheng

Copy link
Copy Markdown
Owner

💡 What: 为配对按钮的加载状态添加了 AnimatedContent 平滑过渡,并将加载动画颜色改为 LocalContentColor.current以修复禁用状态的对比度。
🎯 Why: 在异步操作期间,按钮状态的突然切换会带来突兀的视觉体验;硬编码颜色在按钮禁用时会导致加载动画对比度不足。
📸 Before/After: 之前是生硬的文本/图标替换和不匹配的禁用状态颜色。现在状态切换有平滑的过渡动画,禁用时的加载动画颜色对比度正确。
♿ Accessibility: 确保了按钮在禁用状态下加载动画的视觉对比度,符合无障碍色彩对比度标准,同时平滑的动画减少了认知和视觉干扰。


PR created automatically by Jules for task 13258300211204111737 started by @01luyicheng

Co-authored-by: 01luyicheng <172185967+01luyicheng@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 11, 2026 12:54
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • 新功能

    • 配对按钮新增内容过渡动画,在“配对中”和普通状态之间平滑切换。
    • 配对进行中显示加载指示器及状态提示,提升操作反馈和视觉对比度。
  • 文档

    • 新增 Jetpack Compose 按钮动画与加载状态显示相关的学习记录。

Walkthrough

配对按钮现在使用 AnimatedContent 在普通状态和配对进行状态之间过渡。学习记录补充了 RowScope 保留方式和加载指示器颜色设置方式。

Changes

配对按钮动画

Layer / File(s) Summary
配对按钮内容与 Compose 实践
android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt, .Jules/palette.md
AnimatedContent 根据 uiState.isPairingInProgress 显示进度指示器、间距和进行中提示,或显示配对文本。学习记录说明使用 Row 保留布局作用域,并使用 LocalContentColor.current 设置加载指示器颜色。

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Poem

我是小兔,按钮轻轻跃,
AnimatedContent 让状态相接。
加载图标颜色清晰可见,
Row 保留布局不变。
配对完成,文本重新出现,
胡萝卜为这次改动点赞。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了配对按钮的过渡动画和加载状态对比度改进。
Description check ✅ Passed 描述说明了 AnimatedContent 和 LocalContentColor.current 的变更及其视觉和无障碍目标。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt`:
- Around line 608-615: Update the AnimatedContent block in MainScreen around the
pairing_button_transition label to apply Modifier.fillMaxWidth() and set
contentAlignment to Alignment.Center, ensuring both pairing states remain
centered as their content widths change.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e516beee-2a31-4c4a-905e-252c72138fbb

📥 Commits

Reviewing files that changed from the base of the PR and between b217d54 and 1c4b09a.

📒 Files selected for processing (2)
  • .Jules/palette.md
  • android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
android/app/src/main/java/com/netproxy/gateway/**/*.kt

📄 CodeRabbit inference engine (CLAUDE.md)

android/app/src/main/java/com/netproxy/gateway/**/*.kt: Source of truth for runtime behavior is Kotlin code under android/app/src/main/java/com/netproxy/gateway/. If documentation conflicts with code, code is authoritative and documentation must be updated.
WiFi connection path uses traditional API limited on Android 10+.
MQTT security uses TLS 1.2 and certificate pinning when MQTT_TLS_PUBLIC_KEY_PINS is configured; falls back to default CA validation when empty.
Network egress control: cannot force Socket to use WiFi or mobile data; current protect() bypasses VPN but traffic may be routed to unintended interfaces in vendor scenarios (Link Turbo, dual WiFi acceleration).
Missing native Android multi-network APIs: code does not use Network.bindSocket(), excludeRoute(), or other APIs for true network interface binding.
Multi-network handling is incomplete: code only identifies single network type and cannot properly handle multiple simultaneous networks (dual WiFi, Bluetooth PAN, OTG wired) or network switching scenarios. See docs/TECH_DEBT.md C1 and C3.
Dependency risk: Paho MQTT client maintenance is inactive. New features and bug fixes may be delayed. See docs/ISSUES.md N15.
Deprecated API usage: large amounts of deprecated API usage including EncryptedSharedPreferences, WifiConfiguration, NioEventLoopGroup. See docs/ISSUES.md N13.
Test coverage gap: core business logic (processVpnTraffic, forwardViaSocks5) lacks test coverage. See docs/ISSUES.md N8.

Files:

  • android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt
**/*.{kt,go}

📄 CodeRabbit inference engine (CLAUDE.md)

Critical defect: connection pool cleanup race condition - connection state may change between read and write locks. See docs/ISSUES.md H5.

Files:

  • android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt
android/**

📄 CodeRabbit inference engine (CLAUDE.md)

Build validation gate: make android-build must pass.

Files:

  • android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt
🔇 Additional comments (2)
.Jules/palette.md (1)

9-12: LGTM!

android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt (1)

608-627: 📐 Maintainability & Code Quality

运行 Android 构建门禁。

该文件位于 android/**。当前上下文没有构建结果。合并前请运行 make android-build,并确认 AnimatedContent 改动可以编译。

As per coding guidelines:android/** 文件必须通过 make android-build。

Source: Coding guidelines

Comment on lines +608 to +615
AnimatedContent(
targetState = uiState.isPairingInProgress,
label = "pairing_button_transition"
) { isPairing ->
Row(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
file='android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt'
printf '%s\n' '--- file metadata ---'
wc -l "$file"
printf '%s\n' '--- relevant source ---'
sed -n '560,660p' "$file"
printf '%s\n' '--- alignment and modifier context ---'
rg -n -C 3 'AnimatedContent|fillMaxWidth|contentAlignment|pairing_button_transition|isPairingInProgress' "$file"

Repository: 01luyicheng/NetProxyGateway

Length of output: 14128


🏁 Script executed:

#!/bin/bash
set -e
file='android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt'
wc -l "$file"
sed -n '560,660p' "$file"
rg -n -C 3 'AnimatedContent|fillMaxWidth|contentAlignment|pairing_button_transition|isPairingInProgress' "$file"

Repository: 01luyicheng/NetProxyGateway

Length of output: 14043


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- Compose dependency declarations ---'
rg -n -C 2 'compose|androidx.compose|material3' --glob 'build.gradle*' --glob 'libs.versions.toml' --glob 'gradle.properties' --glob '*.kts' --glob '*.toml' .
printf '%s\n' '--- AnimatedContent call sites and explicit alignment ---'
rg -n -C 5 'AnimatedContent\(' android/app/src/main/java/com/netproxy/gateway --glob '*.kt'

Repository: 01luyicheng/NetProxyGateway

Length of output: 7671


🌐 Web query:

AndroidX Compose AnimatedContent default contentAlignment Alignment.TopStart size transform child alignment official documentation

💡 Result:

In the AndroidX Compose AnimatedContent composable, the contentAlignment parameter defaults to Alignment.TopStart [1][2][3]. This alignment setting determines the positional relationship of the content within the AnimatedContent container [1][2]. Because AnimatedContent can hold multiple sets of content simultaneously during a transition (the outgoing content and the incoming target content), contentAlignment ensures they are positioned consistently relative to the container's coordinates [1][2]. Key details regarding this alignment and size transitions include: 1. Default Behavior: By default, all content pieces are aligned to the Alignment.TopStart of the container [1][2]. The zIndex for all content is 0f by default, but the target content is always placed last in the layout, meaning it appears on top of other content unless a different zIndex is explicitly specified [1][2]. 2. Size Transforms: If the initial and target contents have different sizes, a SizeTransform can be used to manage how the container expands or shrinks during the transition [4][5]. By default, AnimatedContent uses a spring animation for size changes and clips the content to the animated size [4]. This clipping behavior is often coordinated with the alignment to ensure a smooth visual transition [4][5]. 3. Related Modifiers: The Alignment.TopStart default is consistent with other Compose animation components, such as Modifier.animateContentSize, which also defaults to Alignment.TopStart to define how the content is positioned while the container size changes [6]. If you need to change how content is positioned within the container—for example, to center the animating elements—you can override the contentAlignment parameter when calling AnimatedContent [1][3].

Citations:


使配对按钮内容保持居中。

AnimatedContent 默认使用 Alignment.TopStart。内部 Row 未填满容器,因此 Arrangement.Center 只在 Row 内生效。两种状态的内容宽度变化时,内容可能向左偏移。

为 AnimatedContent 添加 Modifier.fillMaxWidth() 和 contentAlignment = Alignment.Center。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@android/app/src/main/java/com/netproxy/gateway/ui/screens/MainScreen.kt`
around lines 608 - 615, Update the AnimatedContent block in MainScreen around
the pairing_button_transition label to apply Modifier.fillMaxWidth() and set
contentAlignment to Alignment.Center, ensuring both pairing states remain
centered as their content widths change.

Source: MCP tools

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.

2 participants