From 8f92a067f3dec55d39181435dc5fe8ac6ca65089 Mon Sep 17 00:00:00 2001 From: rdatta95 Date: Wed, 4 Nov 2020 21:32:04 +0530 Subject: [PATCH] Getting correct value of "gameSolved" key (Found when working on Issue #37) Observation: savedInstanceState.getInt("gameSolved") ALWAYS returned 0 (default). The key "gameSolved" is set with putBoolean, which is correct. A ClassCastException was thrown in getInt and the catch block returned the default 0-value. Issues before change: Multiple statements that are supposed to be executed based on gameSolved (like disabling the special keys and the sudoku grid), were skipped. Because of that, after finishing a game, if someone changed the screen orientation, the keys and the grid became active again and the grid could be modified. Changes done: 1. Changed it to getBoolean("gameSolved") 2. Removed the " == 1" part because that is redundant for a boolean. --- .../java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java index 1655b24..34a6025 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/GameActivity.java @@ -306,7 +306,7 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig finish(); overridePendingTransition(0, 0); } - gameSolved = savedInstanceState.getInt("gameSolved") == 1; + gameSolved = savedInstanceState.getBoolean("gameSolved"); }