Skip to content

Android: add visual affordance to amount input#643

Open
pradhyum6144 wants to merge 2 commits into
bitcoinppl:masterfrom
pradhyum6144:fix-515-amount-input-affordance
Open

Android: add visual affordance to amount input#643
pradhyum6144 wants to merge 2 commits into
bitcoinppl:masterfrom
pradhyum6144:fix-515-amount-input-affordance

Conversation

@pradhyum6144

@pradhyum6144 pradhyum6144 commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Combines the three directions from the design discussion on #515. The amount field on Android is a BasicTextField with no Material chrome, so users had no visual cue that it was tappable.

Adds a "Tap to enter amount" placeholder centered in the Box when the value is empty or "0" and the field isn't focused. The underlying text is drawn transparent in that state so the default "0" doesn't bleed through behind the placeholder. Wraps the amount Box in .clickable { focusRequester.requestFocus() } so taps on the empty area around the glyphs give a Material ripple and focus the field BasicTextField still consumes taps within its own bounds, so the wrapper only fires for the outer area. Drops a HorizontalDivider under the amount row as a subtle bottom border, matching the conventional "this is an input" look.

Falls back to a locally-remembered FocusRequester when the caller doesn't provide one, so the clickable wrapper always has a target.

Closes #515

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Enhanced the amount input field in the Send flow with improved interaction responsiveness and expanded tap targets for easier focus activation.
    • Added placeholder guidance text when the input field is empty.
    • Refined visual layout with a divider separating the input area from controls below.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 39 minutes and 32 seconds.

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 71ef3f06-3013-41e3-888c-63e044ffc162

📥 Commits

Reviewing files that changed from the base of the PR and between bcc46a8 and 78823ec.

📒 Files selected for processing (1)
  • android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/EnterAmountView.kt
📝 Walkthrough

Walkthrough

This PR enhances the amount input field in the SendFlow by adding visual affordances and improving focus management. Changes include introducing a clickable modifier for tap feedback, adding a "Tap to enter amount" placeholder, refining focus handling, and inserting a divider for visual separation.

Changes

Cohort / File(s) Summary
Amount Input Field Enhancements
android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/EnterAmountView.kt
Added local FocusRequester with effectiveFocusRequester fallback; wrapped Box with .clickable() modifier to expand tap target; made default "0" text transparent when unfocused and empty; added conditional placeholder text "Tap to enter amount"; inserted HorizontalDivider between input row and toggle area.
String Resources
android/app/src/main/res/values/strings.xml
Added new string resource placeholder_tap_to_enter_amount with value "Tap to enter amount".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

android

Poem

🐰 A rabbit hops through fields of code,
Where amount fields now gently show,
"Tap here!" they whisper, clear and bright,
With focus magic, all feels right,
Users smile—the way is now in sight! ✨

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Android: add visual affordance to amount input' clearly summarizes the main change of making the Android amount input field more visually tappable.
Linked Issues check ✅ Passed The PR fully implements the coding requirements from issue #515: adds a clickable modifier with focus behavior, includes a 'Tap to enter amount' placeholder label, adds a bottom divider for input affordance, and handles null focusRequester.
Out of Scope Changes check ✅ Passed All changes are directly related to the issue objectives: EnterAmountView.kt modifications and string resource addition for the placeholder are both in scope.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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 the current code and only fix it if needed.

Inline comments:
In
`@android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/EnterAmountView.kt`:
- Around line 137-144: The placeholder is not using the same horizontal offset
as the input text, causing a jump when focus changes; update the placeholder
rendering in EnterAmountView (the block that decides color using amount,
isFocused, exceedsBalance, CoveColor.WarningOrange,
MaterialTheme.colorScheme.onSurface) to apply the same offset/padding used for
the input text at line where the text offset is set (the amount input
composable) so the placeholder and amount share identical horizontal
positioning; ensure the placeholder composable reuses the same modifier/padding
or offset value rather than a separate default so focus transitions remain
visually stable.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ee801982-e8b0-4ca1-97ed-41fc5dd50b6a

📥 Commits

Reviewing files that changed from the base of the PR and between ea30e0c and bcc46a8.

📒 Files selected for processing (2)
  • android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/EnterAmountView.kt
  • android/app/src/main/res/values/strings.xml

@greptile-apps

greptile-apps Bot commented Apr 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds three UI improvements to the amount input on Android: a "Tap to enter amount" placeholder (visible when unfocused and amount is "0" or empty), a clickable wrapper on the amount Box for a ripple and expanded tap target, and a HorizontalDivider beneath the amount row to signal it is an editable field.

  • The transparent-text + overlay Text approach for the placeholder is clean, and the added clearAndSetSemantics {} on the AutoSizeTextField prevents TalkBack from announcing both the hidden "0" and the placeholder simultaneously.
  • A localFocusRequester fallback ensures requestFocus() is always bound to the field even when the parent omits the optional focusRequester parameter — this correctly prevents the IllegalStateException that would have occurred in the old code if the outer clickable fired with an unattached requester.
  • The placeholder Text applies the same amountOffset as the AutoSizeTextField, so both items are visually centred at the same x-position in all denomination modes.

Confidence Score: 5/5

Safe to merge — the change is a self-contained UI enhancement with no business logic impact.

The three-part visual affordance is implemented cleanly. The localFocusRequester fallback correctly prevents a crash that would have occurred if the outer clickable fired without an attached requester. The clearAndSetSemantics guard addresses the accessibility double-announcement concern. No data paths, validation logic, or existing behavior are altered.

No files require special attention.

Important Files Changed

Filename Overview
android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/EnterAmountView.kt Adds placeholder text, clickable tap target, transparent text hiding, clearAndSetSemantics for accessibility, and a HorizontalDivider; logic is sound and the localFocusRequester fallback is correctly wired.
android/app/src/main/res/values/strings.xml Adds the placeholder_tap_to_enter_amount string resource used by the new placeholder overlay.

Reviews (3): Last reviewed commit: "Fix placeholder offset and accessibility..." | Re-trigger Greptile

Comment thread android/app/src/main/java/org/bitcoinppl/cove/flows/SendFlow/EnterAmountView.kt Outdated
@praveenperera

Copy link
Copy Markdown
Contributor

looks good @pradhyum6144 can you include a video showing what it looks like now, thanks

@pradhyum6144

Copy link
Copy Markdown
Collaborator Author

looks good @pradhyum6144 can you include a video showing what it looks like now, thanks

Hey @praveenperera, I tried running the app on my device to record the video but it crashes on startup with cloud storage is not initialized looks like it needs Google cloud credentials configured which I don't have set up locally. Is there a way to disable cloud storage for local dev builds? Also if possible can you test on your device.??

@praveenperera

praveenperera commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@pradhyum6144 ill fix this and let you know, whats the error you get?

@praveenperera

Copy link
Copy Markdown
Contributor

@coderabbitai review
@greptileai

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get the PR diff
gh pr view 643 --repo bitcoinppl/cove --json files,body
gh pr diff 643 --repo bitcoinppl/cove

Length of output: 8489



Review of PR #643 — Android: add visual affordance to amount input

The overall approach is solid — a ripple-enabled tap target, transparent "ghost" text, a placeholder label, and a divider are all standard Android affordance patterns. A few items worth discussing:


1. Fragile zero check (amount == "0")

val showTapPlaceholder = !isFocused && (amount.isEmpty() || amount == "0")

This works for the current default value but will break if the amount is ever formatted differently (e.g. "0.00", "0,00" on locale-sensitive devices, or a trimmed decimal). Consider a helper or a normalised check:

val isEffectivelyZero = amount.isEmpty() ||
    amount.toBigDecimalOrNull()?.compareTo(java.math.BigDecimal.ZERO) == 0
val showTapPlaceholder = !isFocused && isEffectivelyZero

Or at minimum document that the caller contract guarantees exactly "0" as the empty-state default.


2. Placeholder font size vs. AutoSizeTextField (16.sp vs. up to 48.sp)

Text(
    text = stringResource(R.string.placeholder_tap_to_enter_amount),
    fontSize = 16.sp,           // ← fixed, small
    fontWeight = FontWeight.Medium,
    ...
)

The AutoSizeTextField scales from minimumScaleFactor = 0.01f up to maxFontSize = 48.sp. A 16 sp placeholder will feel significantly smaller than what a user types — especially on larger screens. Consider bumping this to match the resting size of the auto-sizing field, or at least a more prominent size like 24.sp32.sp.


3. Accessibility: placeholder Text is not linked to the field

clearAndSetSemantics {} correctly hides the transparent AutoSizeTextField from TalkBack when the placeholder is shown. However the overlay Text composable has no explicit semantics role, so TalkBack will announce its string as a static label rather than an input hint. For a better screen-reader experience, wrap the Box with:

.semantics(mergeDescendants = true) {
    contentDescription = if (showTapPlaceholder)
        stringResource(R.string.placeholder_tap_to_enter_amount)
    else amount
}

or add role = Role.Button on the Box to signal interactivity.


4. Minor: clickable vs. Indication (cosmetic)

The default Material ripple on .clickable {} is fine. Just worth confirming the ripple is visually bounded to the Box and not clipped unexpectedly by a parent clip or shape modifier — not a code change needed, just a visual check when testing.


Summary

Item Severity
Fragile amount == "0" check Medium
Placeholder font size mismatch Low–Medium
Accessibility role / semantics Low
Ripple clipping Cosmetic / test-only

The strings.xml change (placeholder_tap_to_enter_amount) is correct. Once a demo video is available (per the discussion with @praveenperera) it'll be easier to validate the layout in context.

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.

Android: Add visual affordance to amount input field

2 participants