Repository navigation
Issue 7 modernize sdk and deps - #15
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#13