Skip to content

fix: calculator inputs placeholder#967

Open
ovitrif wants to merge 5 commits into
masterfrom
fix/calc-placeholder
Open

fix: calculator inputs placeholder#967
ovitrif wants to merge 5 commits into
masterfrom
fix/calc-placeholder

Conversation

@ovitrif
Copy link
Copy Markdown
Collaborator

@ovitrif ovitrif commented May 25, 2026

This PR ports calculator widget fixes from:

Description

This PR:

  1. Shows 0 as the empty placeholder for modern bitcoin and fiat calculator inputs.
  2. Shows 0.00000000 for empty classic bitcoin input and keeps the classic decimal placeholder tail for whole bitcoin values.
  3. Preserves the active calculator input as the refresh source when currency, bitcoin unit, or rate data changes.
  4. Updates calculator formatter and ViewModel tests.

Note Didn't add any changelog fragment because this is considered one unit of work in iOS as well and part of the calculator v61 redesign, should've been part of #942 ideally.

Preview

placeholder2x.mp4

QA Notes

Manual Tests

  • 1. Widgets → Calculator → empty modern Bitcoin input: placeholder shows 0.
  • 2. Settings → General → Bitcoin Unit Classic → Widgets → Calculator → empty Bitcoin input: placeholder shows 0.00000000.
  • 3. Widgets → Calculator → enter bitcoin amount → long-delete bitcoin input: fiat input shows 0 placeholder.
  • 4. Widgets → Calculator → select fiat input → enter fiat amount → change currency or Bitcoin unit: fiat text stays fixed while bitcoin recalculates from it.
  • 5. Widgets → Calculator → select Bitcoin input → enter bitcoin amount → rates refresh or currency changes: bitcoin text stays fixed while fiat recalculates from it.

Automated Checks

  • Unit tests updated: cover modern bitcoin, classic bitcoin, and fiat empty placeholders in app/src/test/java/to/bitkit/ui/screens/widgets/calculator/components/CalculatorCardStateTest.kt.
  • Unit tests added: cover active input refresh source selection in app/src/test/java/to/bitkit/ui/screens/widgets/calculator/components/CalculatorCardStateTest.kt and rate/currency refresh handling in app/src/test/java/to/bitkit/ui/screens/widgets/calculator/CalculatorViewModelTest.kt.
  • Local checks: ./gradlew testDevDebugUnitTest --tests to.bitkit.ui.screens.widgets.calculator.CalculatorViewModelTest --tests to.bitkit.ui.screens.widgets.calculator.components.CalculatorCardStateTest; ./gradlew compileDevDebugKotlin testDevDebugUnitTest detekt.

@ovitrif ovitrif added this to the 2.3.0 milestone May 25, 2026
@ovitrif ovitrif self-assigned this May 25, 2026
@ovitrif ovitrif changed the title fix: show calculator placeholders fix: calculator inputs placeholder May 25, 2026
@ovitrif ovitrif force-pushed the fix/calc-placeholder branch from 20a10ad to cdc3eb1 Compare May 25, 2026 12:47
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@ovitrif ovitrif force-pushed the fix/calc-placeholder branch from 45852b3 to 88559ff Compare May 25, 2026 13:52
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88559ffe2a

ℹ️ 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".

Comment thread app/src/main/java/to/bitkit/ui/screens/widgets/calculator/CalculatorViewModel.kt Outdated
chatgpt-codex-connector[bot]

This comment was marked as resolved.

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.

1 participant