Skip to content

Fix oversized dialogs in iOS Modern and Android Material themes#4856

Merged
shai-almog merged 2 commits intomasterfrom
fix-dialog-position-native-themes
May 3, 2026
Merged

Fix oversized dialogs in iOS Modern and Android Material themes#4856
shai-almog merged 2 commits intomasterfrom
fix-dialog-position-native-themes

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • Dialog.show() in the iOS Modern and Android Material native themes produced a ~60%×70% screen-sized dialog even when empty, because dialogPosition was unset.
  • Without dialogPosition, Dialog.showImpl falls through to Form.showDialog which applies hard-coded 20%/10%/20% screen-edge margins regardless of content (Form.java:2705-2712). Setting dialogPosition: Center routes through showPacked so the dialog sizes to its content's preferred size.
  • Updated the surrounding CSS comments — the previous note attributed the ballooning to the booleans (hideEmptyTitleBool, dialogButtonCommandsBool, dlgCommandGridBool, shrinkPopupTitleBool), but those only tune button-area rendering and don't affect outer sizing.

Test plan

  • Run a sample app with iOSModernTheme.res; call Dialog.show("Title", "Body", "OK", null) and confirm the dialog hugs its content instead of filling most of the screen.
  • Repeat with AndroidMaterialTheme.res.
  • Verify an empty new Dialog().show() is small.
  • Confirm a dialog with a large body still expands and remains readable.

🤖 Generated with Claude Code

Dialog.show() was producing ~60%x70% screen-sized dialogs even when
empty. Without dialogPosition, Dialog.showImpl falls through to
Form.showDialog which applies hard-coded 20%/10%/20% screen-edge
margins regardless of content. Setting dialogPosition: Center routes
through showPacked so the dialog sizes to its content's preferred
size.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 3, 2026

Compared 86 screenshots: 86 matched.

Native Android coverage

  • 📊 Line coverage: 9.88% (5370/54372 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 7.75% (26337/339651), branch 3.59% (1169/32602), complexity 4.54% (1416/31210), method 7.96% (1160/14574), class 13.02% (254/1951)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 9.88% (5370/54372 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 7.75% (26337/339651), branch 3.59% (1169/32602), complexity 4.54% (1416/31210), method 7.96% (1160/14574), class 13.02% (254/1951)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 845.000 ms
Base64 CN1 encode 212.000 ms
Base64 encode ratio (CN1/native) 0.251x (74.9% faster)
Base64 native decode 1101.000 ms
Base64 CN1 decode 327.000 ms
Base64 decode ratio (CN1/native) 0.297x (70.3% faster)
Image encode benchmark status skipped (SIMD unsupported)

The instrumentation test runner already retries decode-only failures
(logcat occasionally drops a chunk line, breaking PNG reassembly) by
restarting the app and re-emitting from the on-device suite. The retry
itself was failing in two ways:

1. After `adb install -r`, `am start -W -a MAIN -c LAUNCHER -p <pkg>`
   returned "Activity not started, unable to resolve Intent" because
   PackageManager hadn't finished indexing the freshly-installed APK.
   The script gave up immediately and skipped the 10-minute retry wait,
   so the failed test never got a second chance.

2. The original logcat capture used the device's default ring buffer
   (256K-1M), which can wrap mid-suite when 90+ tests each emit ~70
   chunk lines. That's the root cause of the decode flakes the retry
   was supposed to recover from.

Changes:

- Bump the device-side logcat ring buffer to 16M with `adb logcat -G`
  before clearing it. Mitigates buffer wrap during long suites.
- After `adb install`, poll `cmd package resolve-activity --brief`
  (max 30s) until pm reports the launcher activity is registered.
- Retry `am start` up to 3 times with a 2s backoff to absorb residual
  indexing race.
- Fall back to `monkey -p <pkg> -c LAUNCHER 1` if `am start` still
  refuses to resolve the Intent. `pidof` after launch remains the
  source of truth for whether the app actually came up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 3, 2026

Compared 86 screenshots: 86 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 272 seconds

Build and Run Timing

Metric Duration
Simulator Boot 63000 ms
Simulator Boot (Run) 2000 ms
App Install 16000 ms
App Launch 9000 ms
Test Execution 282000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1814.000 ms
Base64 CN1 encode 2240.000 ms
Base64 encode ratio (CN1/native) 1.235x (23.5% slower)
Base64 native decode 1590.000 ms
Base64 CN1 decode 1881.000 ms
Base64 decode ratio (CN1/native) 1.183x (18.3% slower)
Base64 SIMD encode 805.000 ms
Base64 encode ratio (SIMD/native) 0.444x (55.6% faster)
Base64 encode ratio (SIMD/CN1) 0.359x (64.1% faster)
Base64 SIMD decode 745.000 ms
Base64 decode ratio (SIMD/native) 0.469x (53.1% faster)
Base64 decode ratio (SIMD/CN1) 0.396x (60.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 82.000 ms
Image createMask (SIMD on) 13.000 ms
Image createMask ratio (SIMD on/off) 0.159x (84.1% faster)
Image applyMask (SIMD off) 240.000 ms
Image applyMask (SIMD on) 148.000 ms
Image applyMask ratio (SIMD on/off) 0.617x (38.3% faster)
Image modifyAlpha (SIMD off) 251.000 ms
Image modifyAlpha (SIMD on) 117.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.466x (53.4% faster)
Image modifyAlpha removeColor (SIMD off) 376.000 ms
Image modifyAlpha removeColor (SIMD on) 202.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.537x (46.3% faster)
Image PNG encode (SIMD off) 1597.000 ms
Image PNG encode (SIMD on) 1348.000 ms
Image PNG encode ratio (SIMD on/off) 0.844x (15.6% faster)
Image JPEG encode 888.000 ms

@shai-almog shai-almog merged commit 1066c76 into master May 3, 2026
16 checks passed
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