diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-16 00:46:43 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-16 00:46:43 -0500 |
commit | b6536e110ec706c48bff8728d45634b9d3af71a2 (patch) | |
tree | fb28b5abb8705c84ab6db605fbdd595f1add44b0 /app/src | |
parent | 38907795de2f2903f6e2349d052a8184b538c53d (diff) |
ConfigActivity: Fix restoring layout on resume
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/wireguard/android/ConfigActivity.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/com/wireguard/android/ConfigActivity.java b/app/src/main/java/com/wireguard/android/ConfigActivity.java index 1500e08f..90ba754a 100644 --- a/app/src/main/java/com/wireguard/android/ConfigActivity.java +++ b/app/src/main/java/com/wireguard/android/ConfigActivity.java @@ -26,7 +26,7 @@ public class ConfigActivity extends BaseConfigActivity { private ConfigListFragment listFragment; private int mainContainer; private final PlaceholderFragment placeholderFragment = new PlaceholderFragment(); - private boolean updateWasSkipped; + private boolean wasUpdateSkipped; @Override public void onBackPressed() { @@ -63,11 +63,11 @@ public class ConfigActivity extends BaseConfigActivity { // Avoid performing fragment transactions when it would be illegal or the service is null. if (!isServiceAvailable || isStateSaved) { // Signal that updates need to be performed once the activity is resumed. - updateWasSkipped = true; + wasUpdateSkipped = true; return; } else { // Now that an update is being performed, reset the flag. - updateWasSkipped = false; + wasUpdateSkipped = false; } // If the config change came from the intent or ConfigEditFragment, forward it to the list. // listFragment is guaranteed not to be null at this point by onServiceAvailable(). @@ -107,15 +107,16 @@ public class ConfigActivity extends BaseConfigActivity { startActivity(new Intent(this, SettingsActivity.class)); return true; default: - return false; + return super.onOptionsItemSelected(item); } } @Override public void onPostResume() { super.onPostResume(); + final boolean wasStateSaved = isStateSaved; isStateSaved = false; - if (updateWasSkipped) + if (wasStateSaved || wasUpdateSkipped) onCurrentConfigChanged(getCurrentConfig()); } |