Uh oh!
There was an error while loading. Please reload this page.
fix: align currency and calc widget with ios - #884
Conversation
Made-with: Cursor
Made-with: Cursor
Uh oh!
There was an error while loading. Please reload this page.
…onents/CalculatorCard.kt Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Most of the logic added to the |
ovitrif
commented
May 7, 2026
Addressing in: |
There was a problem hiding this comment.
LGTM, but I found some issues in fiat input.
issuesFiat.mp4
- Delete key deletes all decimals
- Delete key when value is
0adds a decimal first - Can't add decimal if it shows only one
- Needs lots of taps on delete key when decimals are hidden
Issue seems to be that, while it doesn't show the 2nd decimal in cases like 1.9, the value is there: 1.90.
| 1 & 2 | 3 & 4 |
|---|---|
issuesFiat.mp4 | issuesFiat2.mp4 |
| internal fun sanitizeDecimalInput( | ||
| raw: String, | ||
| locale: Locale = Locale.getDefault(), | ||
| maxDecimalPlaces: Int? = null, | ||
| ): String { | ||
| val localDecimal = DecimalFormatSymbols.getInstance(locale).decimalSeparator | ||
| val normalized = if (localDecimal == ',') raw.replace(',', '.') else raw | ||
| val filtered = normalized.filter { it.isDigit() || it == '.' } | ||
| val dotIndex = filtered.indexOf('.') | ||
| val singleDot = if (dotIndex == -1) { | ||
| filtered | ||
| } else { | ||
| filtered.substring(0, dotIndex + 1) + | ||
| filtered.substring(dotIndex + 1).replace(".", "") | ||
| } | ||
| if (maxDecimalPlaces == null) return singleDot | ||
| val cappedDot = singleDot.indexOf('.') | ||
| if (cappedDot == -1) return singleDot | ||
| val fraction = singleDot.substring(cappedDot + 1) | ||
| if (fraction.length <= maxDecimalPlaces) return singleDot | ||
| return singleDot.substring(0, cappedDot + 1) + fraction.take(maxDecimalPlaces) | ||
| } |
There was a problem hiding this comment.
nit: would've been nice to add unit tests, even if it's low complexity, it's still logic.
ovitrif
commented
May 7, 2026
I will add the fixes in my PR which also moves logic to viewmodel: |
Uh oh!
There was an error while loading. Please reload this page.
Fixes#881
Description
This PR:
Preview
Screen.Recording.2026-04-03.at.17.45.25.mov
QA Notes
1. Currency settings symbols
2. Calculator widget symbol truncation
Screen_recording_20260423_071500.webm
3. Calculator widget default value
Screen_recording_20260423_073524.webm
4. Calculator input behavior
Screen_recording_20260423_080014.webm
5. Calculator paste and clear edge cases
1000087188..........,,,,,)08into the empty fiat field in CLASSIC denomination and verify it behaves consistentlyScreen_recording_20260423_081652.webm