Skip to content

Connect Full-width Info Card#3790

Open
OrangeAndGreen wants to merge 5 commits into
masterfrom
CCCT-2543-connect-info-card
Open

Connect Full-width Info Card#3790
OrangeAndGreen wants to merge 5 commits into
masterfrom
CCCT-2543-connect-info-card

Conversation

@OrangeAndGreen

Copy link
Copy Markdown
Contributor

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:

  • Primary strong text on left
  • One or two lines of smaller description text
  • Arrow icon on right side when the card is (optionally) clickable

Screenshot showing sample cards that were temporarily added to the Learning Progress page:
Screenshot_20260703_182413

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

OrangeAndGreen and others added 2 commits July 5, 2026 14:16
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>
@OrangeAndGreen OrangeAndGreen self-assigned this Jul 5, 2026
@OrangeAndGreen OrangeAndGreen changed the title Ccct 2543 connect info card Connect Full-width Info Card Jul 5, 2026
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a new ConnectInfoCard reusable Android UI component consisting of a layout XML file, custom styleable attributes, a supporting color resource, and a Kotlin CardView subclass. The Kotlin class exposes configurable properties for value/title/subtitle text and a navigable flag that controls clickability, ripple foreground, and arrow visibility, initialized from XML-declared attributes.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • dimagi/commcare-android#3764: Both PRs modify the same core files (view_connect_info_card.xml, ConnectInfoCard.kt, attrs.xml) to build out the ConnectInfoCard component's arrow/navigable and text/icon behavior.

Suggested reviewers: Jignesh-dimagi, shubham1g5, conroy-ricketts

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: introducing the Connect info card component.
Description check ✅ Passed The description covers product impact, technical summary, safety story, and test coverage; only the labels/review checklist is missing.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CCCT-2543-connect-info-card

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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
app/src/org/commcare/views/connect/ConnectInfoCard.kt (1)

57-63: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Use TypedArray.use { } for guaranteed recycling.

recycle() is only called on the happy path; if an attribute getter throws, the TypedArray leaks. Kotlin's use extension 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

📥 Commits

Reviewing files that changed from the base of the PR and between 46393fc and 49e7122.

📒 Files selected for processing (4)
  • app/res/layout/view_connect_info_card.xml
  • app/res/values/attrs.xml
  • app/res/values/colors.xml
  • app/src/org/commcare/views/connect/ConnectInfoCard.kt

shubham1g5
shubham1g5 previously approved these changes Jul 6, 2026
Comment thread app/src/org/commcare/views/connect/ConnectInfoCard.kt
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.36%. Comparing base (e51dabf) to head (bcaad8a).
⚠️ Report is 4 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

conroy-ricketts
conroy-ricketts previously approved these changes Jul 7, 2026
Jignesh-dimagi
Jignesh-dimagi previously approved these changes Jul 8, 2026
useCompatPadding = true
setCardBackgroundColor(ContextCompat.getColor(context, R.color.white))

context.obtainStyledAttributes(attrs, R.styleable.ConnectInfoCard).apply {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: recommended to use context.withStyledAttributes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, makes sense, nice catch: db33f77

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.

4 participants