Android: Don't allow fragment restoration

This commit is contained in:
Connor McLaughlin 2021-06-07 18:12:49 +10:00
parent e09a9ff846
commit 141fac0481
5 changed files with 5 additions and 35 deletions

View file

@ -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.

View file

@ -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) {

View file

@ -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");

View file

@ -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);

View file

@ -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) {