From 141fac04817baa36224fd40e274e574197270a47 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 7 Jun 2021 18:12:49 +1000 Subject: [PATCH] Android: Don't allow fragment restoration --- .../stenzek/duckstation/ControllerSettingsActivity.java | 8 +------- .../stenzek/duckstation/GamePropertiesActivity.java | 8 +------- .../java/com/github/stenzek/duckstation/MainActivity.java | 8 +------- .../stenzek/duckstation/MemoryCardEditorActivity.java | 8 +------- .../com/github/stenzek/duckstation/SettingsActivity.java | 8 +------- 5 files changed, 5 insertions(+), 35 deletions(-) diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/ControllerSettingsActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/ControllerSettingsActivity.java index fcc5dd7a4..73448dbc8 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/ControllerSettingsActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/ControllerSettingsActivity.java @@ -20,7 +20,7 @@ public class ControllerSettingsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(null); setContentView(R.layout.settings_activity); fragment = new ControllerSettingsCollectionFragment(); @@ -37,12 +37,6 @@ public class ControllerSettingsActivity extends AppCompatActivity { } } - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.remove("android:support:fragments"); - } - @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/GamePropertiesActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/GamePropertiesActivity.java index 683438621..2ca556229 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/GamePropertiesActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/GamePropertiesActivity.java @@ -42,7 +42,7 @@ public class GamePropertiesActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(null); String path = getIntent().getStringExtra("path"); if (path == null || path.isEmpty()) { @@ -69,12 +69,6 @@ public class GamePropertiesActivity extends AppCompatActivity { setTitle(mGameListEntry.getTitle()); } - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.remove("android:support:fragments"); - } - @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == android.R.id.home) { diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java index 3554eb29e..c849fa1d7 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/MainActivity.java @@ -142,7 +142,7 @@ public class MainActivity extends AppCompatActivity { loadSettings(); setTitle(null); - super.onCreate(savedInstanceState); + super.onCreate(null); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); @@ -168,12 +168,6 @@ public class MainActivity extends AppCompatActivity { completeStartup(); } - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.remove("android:support:fragments"); - } - private void completeStartup() { if (!AndroidHostInterface.hasInstance() && !AndroidHostInterface.createInstance(this)) { Log.i("MainActivity", "Failed to create host interface"); diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/MemoryCardEditorActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/MemoryCardEditorActivity.java index 3c8d645d5..dfe1323b3 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/MemoryCardEditorActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/MemoryCardEditorActivity.java @@ -43,7 +43,7 @@ public class MemoryCardEditorActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(null); setContentView(R.layout.activity_memory_card_editor); Toolbar toolbar = findViewById(R.id.toolbar); @@ -66,12 +66,6 @@ public class MemoryCardEditorActivity extends AppCompatActivity { findViewById(R.id.close_card).setOnClickListener((v) -> closeCard()); } - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.remove("android:support:fragments"); - } - @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_memory_card_editor, menu); diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/SettingsActivity.java b/android/app/src/main/java/com/github/stenzek/duckstation/SettingsActivity.java index 538a58cec..47a9313c9 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/SettingsActivity.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/SettingsActivity.java @@ -14,7 +14,7 @@ public class SettingsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(null); setContentView(R.layout.settings_activity); getSupportFragmentManager() .beginTransaction() @@ -26,12 +26,6 @@ public class SettingsActivity extends AppCompatActivity { } } - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.remove("android:support:fragments"); - } - @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == android.R.id.home) {