Skip to content

ADFA-3952 | Add dedicated text box for dropdown titles#1294

Merged
jatezzz merged 2 commits into
stagefrom
feat/ADFA-3952-dropdown-title-widget-experimental
May 12, 2026
Merged

ADFA-3952 | Add dedicated text box for dropdown titles#1294
jatezzz merged 2 commits into
stagefrom
feat/ADFA-3952-dropdown-title-widget-experimental

Conversation

@jatezzz
Copy link
Copy Markdown
Collaborator

@jatezzz jatezzz commented May 12, 2026

Description

This PR fixes the issue where dropdown titles were missing in the generated XML. The logic now extracts text from boxes labeled as "dropdown", cleans up common UI arrow symbols, and creates a separate TextView widget to serve as a title appearing immediately before the dropdown widget itself.

Details

  • Modified WidgetFactory.kt to replace single-widget creation with a list-based creation method (createWidgetsForBox).
  • Implemented extractDropdownTitle using regex to strip decorative characters (arrows, "v" markers) from the raw text.
  • Added logic to generate a bolded TextView with standard margins when a title is detected.
Screen.Recording.2026-05-12.at.12.12.54.PM.mov

Ticket

ADFA-3952

Observation

The createWidgetsForBox method is designed to be extensible if other widget types require multi-part generation in the future. The title extraction includes a check to ensure the label "dropdown" itself isn't used as the title text.

@jatezzz jatezzz requested review from a team, Daniel-ADFA and avestaadfa May 12, 2026 17:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Review Change Stack

Warning

Rate limit exceeded

@jatezzz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 8 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13f4cc32-3fa0-4c57-9067-b9e6b215b197

📥 Commits

Reviewing files that changed from the base of the PR and between 0d328ac and c6a9416.

📒 Files selected for processing (1)
  • cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/WidgetFactory.kt
📝 Walkthrough

Walkthrough

WidgetFactory adds dropdown-specific widget creation through a new createWidgetsForBox helper that extracts cleaned dropdown titles and emits separate bold text and spinner widgets for dropdown boxes, while horizontal rows now support multi-widget output per child box using flatMapIndexed.

Changes

Dropdown Widget Creation

Layer / File(s) Summary
Dropdown title extraction and imports
cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/WidgetFactory.kt
AttributeKey import added for dropdown-title widget attributes; extractDropdownTitle helper trims and normalizes raw dropdown text by removing indicator characters and filtering blank/literal "dropdown" values.
Widget creation with dropdown support
cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/WidgetFactory.kt
createWidgets routes LayoutItem.SimpleView through new createWidgetsForBox helper; createHorizontalRow now uses flatMapIndexed and createWidgetsForBox per child for multi-widget output; createWidgetsForBox emits bold title + spinner for dropdown boxes, otherwise standard widget.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • appdevforall/CodeOnTheGo#1177: Introduces GenericBoxResolver and labels producing/renaming detections to "dropdown", which are now handled by this PR's dropdown-specific widget creation logic.
  • appdevforall/CodeOnTheGo#1261: Improves spinner attribute parsing and trailing-glyph cleanup in AndroidWidget, complementing this PR's dropdown/spinner generation pipeline.
  • appdevforall/CodeOnTheGo#1274: Changes spinner/AndroidWidget entry parsing and placeholder handling, directly related to the spinner widget emission in this PR's widget creation path.

Suggested reviewers

  • avestaadfa
  • Daniel-ADFA
  • itsaky-adfa

Poem

🐰 A factory springs to life with care,
Dropdowns now get titles fair!
Bold text and spinner, side by side,
Widgets multiply with pride. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and specifically describes the main change: adding a dedicated text box for dropdown titles in the generated XML output.
Description check ✅ Passed The description is well-related to the changeset, explaining the problem, solution, implementation details, and design considerations for dropdown title widget generation.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ADFA-3952-dropdown-title-widget-experimental

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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
`@cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/WidgetFactory.kt`:
- Around line 58-63: The parsed attributes for the spinner can still contain
"android:text" from the original dropdown annotation, causing a duplicate title
when you clear box.text for the spinner; after computing baseParsedAttrs (from
parsedAttrsOverride or FuzzyAttributeParser.parse) remove the "android:text"
entry (e.g., baseParsedAttrs.remove("android:text")) before creating spinnerBox
and calling createSimpleWidget(spinnerBox, ...), so the spinner uses only the
cleared text field and not the inherited attribute.
🪄 Autofix (Beta)

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: a2bfecb5-7f17-486c-bca9-a0f516bdb0d7

📥 Commits

Reviewing files that changed from the base of the PR and between 3f8ac50 and 0d328ac.

📒 Files selected for processing (1)
  • cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/xml/WidgetFactory.kt

jatezzz added 2 commits May 12, 2026 13:20
Extract labels from dropdown boxes and render them as separate title widgets.
@jatezzz jatezzz force-pushed the feat/ADFA-3952-dropdown-title-widget-experimental branch from 0d328ac to c6a9416 Compare May 12, 2026 18:20
@jatezzz jatezzz merged commit c9205d3 into stage May 12, 2026
2 checks passed
@jatezzz jatezzz deleted the feat/ADFA-3952-dropdown-title-widget-experimental branch May 12, 2026 21:26
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