# Lemenzo Calculator v1.5 Production Candidate

First-party offline calculator for LemenzoOS / Android 16.

## Core modes
- Basic calculator with calculator-style percentage semantics
- Scientific calculator with DEG/RAD/GRAD
- 2nd-layer scientific keypad to reduce visual density
- AUTO / SCI / ENG display notation
- Local ordered calculation history
- MC / MR / MS / M+ / M− memory
- Offline unit converter with 14 categories and one-tap unit swap
- Programmer calculator with BIN/OCT/DEC/HEX, bitwise operations and 8/16/32/64-bit word sizes

## v1.3 UX improvements
- Scientific functions split into primary and secondary layers instead of one oversized keypad
- Locale-aware decimal and grouping display while the engine remains locale-neutral internally
- Editable expression with cursor insertion, selection replacement and token-aware backspace
- Programmer HEX/DEC/OCT/BIN summary shown together; binary output grouped in 4-bit blocks
- Invalid programmer digits disabled for BIN/OCT/DEC modes
- Cleaner selected states for programmer base/word size and scientific 2nd/format controls
- Converter labels for category/from/to plus a dedicated Swap units button
- Minimum 48dp interactive targets for top navigation/history and 60dp calculator keys
- Better content descriptions for TalkBack and dynamic result announcements
- Clear-history confirmation
- Result copy uses canonical numeric value rather than localized display text
- Activity state preserves mode, memory, angle mode, word size, base, 2nd-layer and notation

## v1.4 correctness / reliability fixes
- Correct scientific precedence: `-2^2 = -4`, `(-2)^2 = 4`, while `2^-3 = 0.125` still works
- Right-associative powers retained: `2^3^2 = 512`
- Expression length bounded to protect the UI from pathological pasted input
- Integer exponent range bounded and zero-to-negative powers return a controlled math error
- Programmer shift counts constrained to the selected word size
- Converter input parsing now respects locale grouping/decimal separators instead of blindly turning commas into decimal points
- Converter mode hides the unrelated calculator display panel for a cleaner single-purpose screen
- ± now targets the selected/current operand instead of negating the entire expression by default
- Removed stray temporary test source and made the JUnit dependency explicit in Soong
- Runtime calculation paths catch expected math/input exceptions instead of swallowing every `Throwable`

## Privacy / security
- Zero Android permissions
- No INTERNET permission
- No analytics, ads, account, cloud sync or Google Play Services dependency
- `allowBackup=false`
- `usesCleartextTraffic=false`
- Uses public Android SDK APIs; no `platform_apis` and no platform certificate requirement

## Math implementation
- BigDecimal decimal arithmetic with 34-digit MathContext
- Exact integer powers, factorial, nCr and nPr within configured limits
- Calculator percentage behavior, e.g. `200 + 10% = 220`
- Scientific functions with normalized display noise for common results
- BigDecimal-based unit conversions

## Final ROM verification still required
Run the real Soong build in the LemenzoOS Android 16 tree and test on target Pixel hardware. Static/package checks and standalone engine regression tests do not replace the final ROM build and instrumentation run.


## v1.5 production hardening
- Locale-safe expression codec: decimal-comma locales display function arguments with semicolons, preventing `nCr` / `nPr` argument separators from colliding with decimal commas.
- Converter selection/input state survives Activity recreation.
- `abs`, `floor` and `ceil` stay in BigDecimal instead of dropping to Double precision.
- Tangent singularities such as `tan(90°)` return a controlled math error.
- History expressions are displayed using the active locale syntax.
- Core accessibility action labels moved to string resources.
- Added regression tests for locale expression syntax and exact BigDecimal unary functions.

- Adaptive launcher icon with monochrome layer for modern Android launchers/themed icons.
- Clipboard results are marked sensitive to suppress system clipboard previews where supported.
- Converter restore indices are clamped to current adapters to avoid stale-state selection errors.

## v1.6 production finalization
- Basic and Scientific now share and preserve the same working calculation.
- Programmer mode has an independent working expression.
- History schema v3 stores mode, angle mode, programmer base and word size and migrates v2 history.
- History restores the original expression rather than replacing it with only the result.
- Added compact landscape resources, accessibility live regions and label relationships.
- Added explicit app version metadata and LemenzoOS PRODUCT_PACKAGES integration guidance.
- Added Danish plus German, Swedish, Norwegian, Dutch, French, Spanish and Italian resource overlays.
- Expanded regression coverage for exponent associativity, unary precedence, angle modes, combinatoric bounds and divide-by-zero.

A final release must still pass `m LemenzoCalculator` and on-device/emulator UI verification in the actual Android 16 LemenzoOS tree.


## v1.7 Premium UX
- Replaces horizontally scrolling mode navigation with a fixed four-segment control so every primary mode is always discoverable.
- Adds branded top-bar icon and compact icon-only History action.
- Refines display hierarchy, spacing, typography and panel sizing for a calmer premium layout.
- Uses consistent Lemenzo dark spinner/input styling instead of platform-default dropdown visuals.
- Removes permanent privacy marketing text from the main calculator surface to reduce visual clutter.
- Keeps the equals key as the strongest blue action while operators use a quieter blue surface.
- Removes default Button elevation/animation for a consistent flat LemenzoOS design.
- Uses slightly tighter scientific keys and larger basic/programmer keys.
- Retains 48dp+ accessibility targets and dark high-contrast UI.
