From: Damyan Ivanov Date: Sun, 24 Nov 2019 21:02:44 +0000 (+0200) Subject: new transaction fragment: survive configuration changes / fragment restart X-Git-Tag: v0.11.0~32 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=ed0b0076b713470b35e3b80219f8d9b231a56ca5;p=mobile-ledger.git new transaction fragment: survive configuration changes / fragment restart --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java index 2775716b..5492d81e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java @@ -166,9 +166,19 @@ public class NewTransactionFragment extends Fragment { // TODO display error } else { - viewModel.reset(); } } + + if (savedInstanceState != null) { + boolean keep = savedInstanceState.getBoolean("keep", true); + if (!keep) + viewModel.reset(); + } + } + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBoolean("keep", true); } private void onFabPressed() { fab.setEnabled(false);