Skip to content

Issue 7 modernize sdk and deps - #15

Merged
atorch merged 6 commits into
mainfrom
issue-7-modernize-sdk-and-deps
Nov 14, 2026
Merged

atorch merged 6 commits into
mainfrom
issue-7-modernize-sdk-and-deps

Conversation

@atorch

@atorch atorch commented Nov 14, 2026

Copy link
Copy Markdown
Owner

#13

claude and others added 6 commits November 3, 2026 20:03
When Android recreates SolvePuzzle, onCreate's savedInstanceState != null
branch never calls setContentView, so the user gets an empty screen
under the action bar. This happens after the app is killed in the
background, or after a setting change the manifest doesn't list in
configChanges (dark mode, font size, language, split-screen resizing).

Robolectric tests, run on the JVM as part of ./gradlew build, cover both
cases: a configuration change, and process death (a brand new activity
built from the saved state alone). Each test enters one correct
country, recreates the activity, and checks that the same puzzle and
progress are shown and that the next correct country is still accepted.

Both tests fail at this commit. The fix follows in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwXCddsMirbBTNqxSqT6iv
CI only keeps the build log, and Gradle's default test output there is
one line per failure, which isn't enough to diagnose anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwXCddsMirbBTNqxSqT6iv
Both tests failed before running any test code. Robolectric's
FileDescriptorInterceptor (used by ApplicationSharedMemory.create
while setting up the Android 16 environment) calls
jdk.internal.access.SharedSecrets through reflection, which JDK 17+
refuses unless that package is exported. Export it, and open java.io
for the interceptor's fallback path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwXCddsMirbBTNqxSqT6iv
onCreate now always calls setContentView. It used to skip it when
savedInstanceState != null, leaving a blank screen.

- The puzzle state moves from static fields to instance fields. Statics
  don't survive the app being killed in the background, and the static
  TextView/ImageView fields leaked the activity.
- onSaveInstanceState saves the start and destination indices and the
  countries entered so far.
- On restore, onCreate reloads that puzzle's paths and replays the
  entered countries (moveTo), without repeating the toasts or database
  updates. A solved puzzle comes back solved.
- The answer check uses equals() instead of ==. Strings restored from a
  Bundle are new objects, so == would reject correct answers.
- path_length_inner comes from the stored path itself. Every puzzle in
  graph_paths_summary.csv has paths in graph_paths_subset.csv whose
  length matches, so this doesn't change new puzzles.

Makes SolvePuzzleRecreationTest pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwXCddsMirbBTNqxSqT6iv
Fix blank puzzle screen after the app is recreated
@atorch
atorch merged commit 6792bd0 into main Nov 14, 2026
1 check 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.

2 participants