Skip to content

Android: amount field keeps the caret where the user puts it - #1956

Merged
gemcoder21 merged 1 commit into
mainfrom
wt1/android-fiat-amount-caret
Nov 18, 2026
Merged

gemcoder21 merged 1 commit into
mainfrom
wt1/android-fiat-amount-caret

Conversation

@DRadmir

@DRadmir DRadmir commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Why: On Android the Buy, Sell and Send-in-fiat amount field put the caret only at the start or the end of the number: tapping between the digits of $ 50 and typing 7 gave $ 750, and the selection handle could not be dragged between the digits (reported from the dev Telegram group with a screencast). The field drew the currency symbol inside the text through a hand-written visual transformation whose offset mapping for a leading symbol returned only 0 or the text length.

What changed:

  1. The amount field moves to the state-based text field with the existing amount input transformation for sanitising and a one-line output transformation for the "0" placeholder, as Swap and the price alert input already do; the hand-written transformation, its offset mapping and the caret bookkeeping are deleted.
  2. The currency symbol is a separate text beside the field, centred with it as one group and kept left-to-right in every locale, as the price alert input and the iOS currency field already do.
  3. The Buy/Sell and Send view models own the field state; typed text reaches Core through a snapshot flow, and Core-driven amounts (presets, Max, Buy/Sell switch, crypto/fiat switch, prefilled payment) are written back only when the text differs, so a balance refresh no longer moves the caret.

Proof: Before, tapping between the digits of $ 50 and typing 7 gave $ 750 and the handle could not be dragged between the digits; after, it gives $ 570 and the handle lands where it is dropped, in Buy, Sell and Send in both input modes, including German and Arabic locales and font scale 2.0. The field, Buy/Sell and Send view model tests pass; the field test now pins the symbol beside the amount. Not run: Maestro flows, the read-only amount (claim rewards) and the perpetual amount screen on a device.

Behavior change: in right-to-left languages the crypto amount reads 0 USDT instead of the mirrored USDT 0; tapping the currency symbol no longer focuses the field, only the digits do; an empty fiat amount shows the caret before the 0 placeholder.

@DRadmir DRadmir self-assigned this Nov 18, 2026
@gemcoder21
gemcoder21 merged commit 76a095a into main Nov 18, 2026
2 checks passed
@gemcoder21
gemcoder21 deleted the wt1/android-fiat-amount-caret branch November 18, 2026 17:30
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