Repository navigation
ホーム画面ウィジェットをライブアクティビティ踏襲の路線色グラデーション背景へ刷新 - #6593
Conversation
iOS/Androidのホーム画面ウィジェット(乗車中・プリセット)の背景を、watchOS向け ライブアクティビティ(SmartStackLiveActivityContentView)と同じ路線色のベタ塗り + グラデーションに揃え、路線色で縁取っていたナンバリングサークルを前景色で塗り潰した 反転バッジへ置き換えた。文字色は路線色の知覚輝度で白黒を切り替え、判定式と閾値は iOS(lineForegroundColor)とAndroid(WidgetTheme.onLineColor)で共通にしている。 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LjYtNqqj5ec4uzM25eUb7C
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAndroidとiOSのホーム画面ウィジェットを、路線色の全面背景、輝度に応じた前景色、番号バッジ、グラデーション、チップ型ブランド表示へ更新しました。プリセット表示の背景と行レイアウトも変更しました。 Changes共通デザイン仕様
Androidテーマと乗車中ウィジェット
Androidプリセットウィジェット
iOSウィジェット
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant WidgetEntry
participant LineColorTheme
participant WidgetLayout
WidgetEntry->>LineColorTheme: 路線色を渡す
LineColorTheme-->>WidgetEntry: 前景色と副次色を返す
WidgetEntry->>WidgetLayout: 背景、バッジ、文字、ブランド表示へ色を適用
WidgetLayout-->>WidgetEntry: レイアウトを表示
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@docs/home-screen-widgets.md`:
- Around line 35-39: Update the documentation’s luminance rule to state that R,
G, and B are normalized 0.0–1.0 values, with implementations dividing each
channel by 255 before comparing against 0.7. Since this heuristic does not
guarantee WCAG contrast for every route color, either validate all route colors
and choose foreground colors by the applicable contrast standard, or revise the
badge description from guaranteeing contrast to improving visibility.
In `@ios/RideSessionActivity/HomeScreenWidget.swift`:
- Around line 204-208: In LockScreenEntry.current() and the surrounding
HomeScreenWidget display flow, add displayLineSymbol with fallback order
lineSymbol, the first character of lineName, then "?"; update both
LineNumberingBadge instances to use displayLineSymbol instead of lineSymbol.
🪄 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: 10d6347e-57df-494f-b600-8e4b460d1665
📒 Files selected for processing (25)
android/app/src/main/java/me/tinykitten/trainlcd/PresetsWidgetService.ktandroid/app/src/main/java/me/tinykitten/trainlcd/RideWidgetProvider.ktandroid/app/src/main/java/me/tinykitten/trainlcd/WidgetTheme.ktandroid/app/src/main/res/drawable/widget_background.xmlandroid/app/src/main/res/drawable/widget_background_circle.xmlandroid/app/src/main/res/drawable/widget_background_circle_shade.xmlandroid/app/src/main/res/drawable/widget_background_shade.xmlandroid/app/src/main/res/drawable/widget_chip_background.xmlandroid/app/src/main/res/drawable/widget_line_bar.xmlandroid/app/src/main/res/drawable/widget_numbering_badge.xmlandroid/app/src/main/res/drawable/widget_numbering_circle.xmlandroid/app/src/main/res/drawable/widget_preset_numbering_circle.xmlandroid/app/src/main/res/drawable/widget_preset_row_background.xmlandroid/app/src/main/res/layout/widget_presets.xmlandroid/app/src/main/res/layout/widget_presets_row.xmlandroid/app/src/main/res/layout/widget_ride_circular.xmlandroid/app/src/main/res/layout/widget_ride_inline.xmlandroid/app/src/main/res/layout/widget_ride_rectangular.xmlandroid/app/src/main/res/layout/widget_ride_small.xmlandroid/app/src/main/res/values-night/colors.xmlandroid/app/src/main/res/values/colors.xmlandroid/app/src/main/res/values/dimens.xmldocs/home-screen-widgets.mdios/RideSessionActivity/HomeScreenWidget.swiftios/RideSessionActivity/PresetsWidget.swift
💤 Files with no reviewable changes (4)
- android/app/src/main/res/values-night/colors.xml
- android/app/src/main/res/drawable/widget_line_bar.xml
- android/app/src/main/res/drawable/widget_preset_numbering_circle.xml
- android/app/src/main/res/drawable/widget_numbering_circle.xml
CodeRabbitのレビュー指摘に対応。LockScreenEntryに displayLineSymbol を追加し、 路線記号・路線名がともに空でもホーム画面ウィジェットのバッジが空にならないようにした (プリセット・Android版と同じ順のフォールバック)。あわせて知覚輝度の式に正規化を明記し、 WCAGのコントラスト比を保証するものではない旨をドキュメントとコメントへ追記した。 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LjYtNqqj5ec4uzM25eUb7C
概要
iOS / Android のホーム画面ウィジェットの見た目が全体的に地味だったため、watchOS 向けライブアクティビティ(
SmartStackLiveActivityContentView)の「路線色のベタ塗り + グラデーション」を踏襲したデザインへ作り替えました。ロック画面や watchOS のアクセサリ系はシステムが着色するため路線色を面で出せませんが、ホーム画面はウィジェット側が背景を持てます。面全体を路線色にすることで、文字を読む前に色でどの路線に乗っているかを判別できるようになります。
変更の種類
変更内容
topLeading→bottomTrailing、Android はangle="315")(0.299R + 0.587G + 0.114B) / 255、閾値0.7)で白黒切り替え。式と閾値は iOS のlineForegroundColorと Android のWidgetTheme.onLineColorで共通にしているLineColorBackground/LineNumberingBadge/LineColorChipをHomeScreenWidget.swiftに新設しPresetsWidgetと共有。既存ファイル内に置いているため Xcode プロジェクトへのファイル追加は不要systemSmallのみ、その 1 件の路線色をそのまま面に使うLockScreenEntryにdisplayLineSymbol(lineSymbol→lineNameの先頭 1 文字 →"?")を追加し、路線記号・路線名がともに空でもバッジが空にならないようにした。フォールバックの順序は既存のPresetsWidgetItemおよび Android のRideWidgetProviderと共通widget_background・実行時に路線色へ着色)+ グラデーション(widget_background_shade)の 2 枚重ねで実現。Bitmap を使わないため、どのウィジェットサイズでも角丸が歪まないRideWidgetProviderが実行時に設定するため、レイアウト XML のtextColor/tintはウィジェットギャラリーのプレビュー用の既定値。既定値は未乗車時と同じブランドカラー(@color/widget_brand)に揃えたvalues-nightの widget 用カラーを廃止。未使用になったwidget_line_bar/widget_numbering_circle/widget_preset_numbering_circleと関連 dimen も削除docs/home-screen-widgets.mdに「デザイン」節を追加し、前景色の判定式と閾値を iOS / Android で必ず揃える旨を明記前景色の判定について
閾値
0.7は、ライブアクティビティ譲りの白文字を基本に保ったまま#FFD400クラスの明るい路線色だけを救うためのヒューリスティックで、全路線色で WCAG のコントラスト比を満たすことは保証しません(例:#80C241は白を選ぶが白とのコントラスト比は 2.16)。相対輝度でコントラスト比の高い方を選ぶ実装にすると中間色の路線が軒並み黒文字へ倒れ、踏襲元のデザインから大きく外れるため採用していません。この判断と、切り替える場合の実装方針はドキュメントとWidgetTheme.LIGHT_LINE_LUMINANCEの KDoc に書き残しています。未実施の確認
実行環境に Xcode / Android SDK が無いため、実機・シミュレータでのビルドと目視確認は未実施です。スクリーンショットも未取得のため「スクリーンショット」節は空のままにしています。ネイティブのビルドが通るかは CI の結果を確認してください。
テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることローカルで実行したコマンドと結果:
npm run lint— 624 ファイル、指摘なしnpm test— 212 スイート / 2219 テスト すべて成功npx tsc --noEmit— エラーなし本 PR に JS/TS の変更は含まれないため、上記は既存への影響が無いことの確認です。
リグレッションリスクと緩和策
FrameLayoutに変えているが、widget_rootの ID・setOnClickPendingIntentの対象・プリセット行のsetOnClickFillInIntentの対象は据え置きLineColorChipに載せた関係でheaderHeightを 18 → 22 に広げており、端末によっては 1 行減る可能性がある。行数計算の式自体は従来どおり実測ベースdisplayLineSymbolの追加で"?"まで倒れるようにし、iOS / Android / プリセットの 3 経路で同じ挙動に揃えた関連Issue
スクリーンショット(任意)