Android: Close via clearing the fragment
Once again, background support requires special consideration. Closing the application does not remove it from the background stack (thus not clearing view)
This commit is contained in:
parent
79e4e261c4
commit
4c8b8f2df2
|
@ -15,6 +15,8 @@ import android.support.constraint.ConstraintLayout;
|
|||
import android.support.design.widget.Snackbar;
|
||||
import android.support.graphics.drawable.VectorDrawableCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Gravity;
|
||||
|
@ -580,7 +582,6 @@ public class OptionsFragment extends Fragment {
|
|||
b.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
resetEmuSettings();
|
||||
getActivity().finishAffinity();
|
||||
}
|
||||
});
|
||||
b.setNegativeButton(android.R.string.no, null);
|
||||
|
@ -727,6 +728,18 @@ public class OptionsFragment extends Fragment {
|
|||
mPrefs.edit().remove(Emulator.pref_nosound).apply();
|
||||
mPrefs.edit().remove(Config.pref_renderdepth).apply();
|
||||
mPrefs.edit().remove(Config.pref_theme).apply();
|
||||
|
||||
Emulator app = (Emulator) getActivity().getApplicationContext();
|
||||
app.getConfigurationPrefs(mPrefs);
|
||||
|
||||
FragmentManager manager = getActivity().getSupportFragmentManager();
|
||||
FragmentTransaction ft = manager.beginTransaction();
|
||||
Fragment newFragment = this;
|
||||
this.onDestroy();
|
||||
ft.remove(this);
|
||||
ft.replace(R.id.fragment_container,newFragment);
|
||||
ft.addToBackStack(null);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
private void showToastMessage(String message, int duration) {
|
||||
|
|
Loading…
Reference in New Issue