Connect Full-width Info Card#3790
Conversation
Add the ConnectInfoCard styleable, its full-width layout, and the connect_dark_grey color used by the card's value text. [AI] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduce a full-width Connect info card that displays a leading value, a title with optional subtitle, and an optional trailing navigation arrow. The card becomes clickable with a ripple foreground and reveals the arrow when marked navigable. [AI] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR introduces a new Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/org/commcare/views/connect/ConnectInfoCard.kt (1)
57-63: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winUse
TypedArray.use { }for guaranteed recycling.
recycle()is only called on the happy path; if an attribute getter throws, theTypedArrayleaks. Kotlin'suseextension recycles automatically via try/finally.♻️ Proposed fix
- context.obtainStyledAttributes(attrs, R.styleable.ConnectInfoCard).apply { - valueText = getString(R.styleable.ConnectInfoCard_valueText) - titleText = getString(R.styleable.ConnectInfoCard_titleText) - subtitleText = getString(R.styleable.ConnectInfoCard_subtitleText) - navigable = getBoolean(R.styleable.ConnectInfoCard_navigable, false) - recycle() - } + context.obtainStyledAttributes(attrs, R.styleable.ConnectInfoCard).use { + valueText = it.getString(R.styleable.ConnectInfoCard_valueText) + titleText = it.getString(R.styleable.ConnectInfoCard_titleText) + subtitleText = it.getString(R.styleable.ConnectInfoCard_subtitleText) + navigable = it.getBoolean(R.styleable.ConnectInfoCard_navigable, false) + }🤖 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 `@app/src/org/commcare/views/connect/ConnectInfoCard.kt` around lines 57 - 63, The attribute parsing in ConnectInfoCard’s init block should use TypedArray.use { } instead of calling recycle() manually. Wrap the obtainStyledAttributes(attrs, R.styleable.ConnectInfoCard) usage in use, keep the valueText/titleText/subtitleText/navigable reads inside that block, and remove the explicit recycle() so the TypedArray is always released even if one of the getters throws.
🤖 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.
Nitpick comments:
In `@app/src/org/commcare/views/connect/ConnectInfoCard.kt`:
- Around line 57-63: The attribute parsing in ConnectInfoCard’s init block
should use TypedArray.use { } instead of calling recycle() manually. Wrap the
obtainStyledAttributes(attrs, R.styleable.ConnectInfoCard) usage in use, keep
the valueText/titleText/subtitleText/navigable reads inside that block, and
remove the explicit recycle() so the TypedArray is always released even if one
of the getters throws.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 51812b89-5207-4bd0-a955-483d1385d165
📒 Files selected for processing (4)
app/res/layout/view_connect_info_card.xmlapp/res/values/attrs.xmlapp/res/values/colors.xmlapp/src/org/commcare/views/connect/ConnectInfoCard.kt
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3790 +/- ##
============================================
- Coverage 26.38% 26.36% -0.02%
- Complexity 4522 4523 +1
============================================
Files 969 972 +3
Lines 57973 58035 +62
Branches 6898 6908 +10
============================================
+ Hits 15296 15301 +5
- Misses 40802 40860 +58
+ Partials 1875 1874 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| useCompatPadding = true | ||
| setCardBackgroundColor(ContextCompat.getColor(context, R.color.white)) | ||
|
|
||
| context.obtainStyledAttributes(attrs, R.styleable.ConnectInfoCard).apply { |
There was a problem hiding this comment.
nit: recommended to use context.withStyledAttributes
db33f77
https://dimagi.atlassian.net/browse/CCCT-2543
Product Description
No visible changes
Technical Summary
Implemented full-width info cards for Connect info screens.
Cards consist of:
Screenshot showing sample cards that were temporarily added to the Learning Progress page:

Safety Assurance
Safety story
The new component is not used anywhere yet so this PR is essentially a no-op.
Tested by adding several demo cards with hard-coded values to the Learning Progress page (see screenshot above).
Automated test coverage
None