feat: calculator v61 redesign#942
Conversation
48aa6fa to
2183e5d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2183e5d8b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
2183e5d to
5178b8d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5178b8d985
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5178b8d to
635084f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 635084fb43
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
635084f to
286c5d5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 286c5d5b56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
286c5d5 to
4d16994
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d169946b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4d16994 to
85fcf98
Compare
|
Currently tapping the Calculator OS widget just opens Bitkit. For a calculator widget, I believe the users would expect the primary flow to be quick conversion: edit BTC or fiat and see the other value update, without going through the full app. Screen.Recording.2026-05-18.at.12.35.36.mov |
It's not something doable in Android, I'll try in iOS, see if the platform supports it. I agree the widget has very little value…. It still has the value if you want to know, for example what is the equivalent in fiat of your stash, would perhaps keep such a thing on my home or lock screen frankly. Maybe, at best, we could open a dedicated screen, which maybe could have transparent BG, so it feels more like a modal than an app, and there users could play around with values. But that requires designer input too. cc. @aldertnl, to ack that we can't do more than show information in Android OS widgets. Can't add functionality to edit the values, as users would expect. |
|
@piotr-iohk another option which I actually had implemented 1st time is to open the Bitkit app directly on the calculator widget, focused on 1st input, when tapping it. I replaced that with a simple "Launch Bitkit" because it was only working when Bitkit app was in background, and then there was a bit too much code to change for it. |
|
re: platform widgets capabilities:
So, a few buttons at most. Adding a numpad, with very small buttons would constrain the size of the widget to some large shapes, and add issues with touch-targets, there's a reason Material Design recommends 48x48 for the smallest buttons. |
That fallback sounds fine to me, with one caveat: it should not depend on the Calculator widget already existing in the in-app widget list. The Calculator widget is not added by default, so opening Bitkit and focusing the existing home widget would fail for many users. If tapping the OS widget can deep-link into a calculator UI that works independently of whether the in-app Calculator widget is saved, then I think that solves the UX concern well enough. It could be a dedicated calculator screen or a focused calculator preview/editor route. The important part is that users land directly in a usable calculator, not just generic Bitkit home. |
|
The UX for setting a value for OS widget is not good, specially when there is no in-app widget I suggest to hide this widget to give us time to polish and deploy the others while experimenting the best UX for this one, considering each OS constraints Edit: hide just the OS widget Screen_recording_20260518_084055.webm |
I think that is reasonable. |
|
Hiding OS widget for now, will save to a separate branch on remote for tracking/backref as needed in the future. |
|
@piotr-iohk Guess we should do the same for iOS? While redesigning the calculator widget with these constraints in mind, please also incorporate the widget sizes concerns in conformance with the guides provided by Google on grid and sizes enforced by the platform: On Android (here), I had to center the widget UI elements vertically by myself, thus not implement the FIGMA design, because, that would've meant the widget has a lot of uneven gray space below the fiat "input", and a smaller padding to the remaining sides (top, left, right, gap). Here are the guides from official android devs docs:
Maybe this is a good practice for iOS too 🤷🏻, to find their official guides on the topic and apply the specifications in design. |
I believe yes, If you mean hiding OS calc widget for now. Also we should track the further Calc OS widget work under specific ticket(s). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 011c618c42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b555c5c3b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 801dcf10b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private fun CalculatorValues.resolveSatsValue(): Long { | ||
| if (satsValue != null || displayUnit != null || fiatValue.isEmpty()) { | ||
| return resolveCalculatorSatsValue() | ||
| } | ||
| return convertFiatToSats(fiatValue) |
There was a problem hiding this comment.
Preserve legacy BTC instead of stale fiat
For legacy calculator rows where both satsValue and displayUnit are missing, this makes any non-empty stored fiatValue the canonical source of sats. That corrupts saved Bitcoin amounts whenever the exchange rate or selected fiat currency changed before the upgrade: for example, an old btcValue = "10000" sats with fiatValue = "6.25" is migrated by converting the stale $6.25 at today's rate, so if BTC doubled it becomes 5,000 sats and is then persisted/displayed as such. Prefer the unambiguous BTC value when possible, and only fall back to fiat for the specific ambiguous legacy cases it is meant to recover.
Useful? React with 👍 / 👎.
801dcf1 to
0d3ed04
Compare
Fixes #937
Related: #950
Refreshes the in-app Bitcoin Calculator widget for the v6.1 widget design, routes its UI logic through the view model, and improves formatting with locale-aware thousands and decimal separator support.
The Android OS home-screen calculator widget has been removed from this PR for now. The extracted work is preserved on
ovi/calculator-os-widget-v61-backupand tracked in #950. Non-calculator widget polish was split out to #952.Description
Design refs:
Preview
calc_app.mp4
calc_os.mp4
QA Notes
Manual Tests
Dev verified locally:
Reviewer / QA requested:
Automated Tests
Added in this PR:
CalculatorViewModelTest: covers stored value hydration, legacy value backfill, BTC input sanitization/conversion/persistence, fiat input sanitization/conversion/persistence, fiat conversion storage without grouping, currency refresh, and display-unit changes.CalculatorCardStateTest: covers calculator formatting helpers, money separators, fiat placeholder zero behavior, hydration guards, and number-pad input/delete behavior.Related test-lane / integration test PRs:
Automated Checks
./gradlew compileDevDebugKotlin testDevDebugUnitTest --tests to.bitkit.ui.screens.widgets.calculator.CalculatorViewModelTest --tests to.bitkit.ui.screens.widgets.calculator.components.CalculatorCardStateTest