X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FNewTransactionFragment.java;h=05b272e8a6d4f27a9577dac5b526c1ce27f83e6d;hb=90a2528c5da0a524701fade91d1a2a45e0fccdc5;hp=e4ac7792eaa7579aa5ec756b909ef1913a9e8b53;hpb=217da55a224e2ae899d0b50604e2e54f882ec04f;p=mobile-ledger.git 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 e4ac7792..05b272e8 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 @@ -63,7 +63,6 @@ import org.jetbrains.annotations.NotNull; public class NewTransactionFragment extends Fragment { private NewTransactionItemsAdapter listAdapter; private NewTransactionModel viewModel; - private RecyclerView list; private FloatingActionButton fab; private OnNewTransactionFragmentInteractionListener mListener; private MobileLedgerProfile mProfile; @@ -114,14 +113,16 @@ public class NewTransactionFragment extends Fragment { throw new RSInvalidStateException( "getActivity() returned null within onActivityCreated()"); - list = activity.findViewById(R.id.new_transaction_accounts); viewModel = new ViewModelProvider(activity).get(NewTransactionModel.class); viewModel.observeDataProfile(this); - mProfile = Data.profile.getValue(); + mProfile = Data.getProfile(); listAdapter = new NewTransactionItemsAdapter(viewModel, mProfile); + + RecyclerView list = activity.findViewById(R.id.new_transaction_accounts); list.setAdapter(listAdapter); list.setLayoutManager(new LinearLayoutManager(activity)); - Data.profile.observe(getViewLifecycleOwner(), profile -> { + + Data.observeProfile(getViewLifecycleOwner(), profile -> { mProfile = profile; listAdapter.setProfile(profile); }); @@ -131,7 +132,6 @@ public class NewTransactionFragment extends Fragment { if (isSubmittable) { if (fab != null) { fab.show(); - fab.setEnabled(true); } } else { @@ -179,7 +179,7 @@ public class NewTransactionFragment extends Fragment { // p.setVisibility(View.VISIBLE); // // }, 10); - p.setVisibility(View.VISIBLE); + p.setVisibility(View.VISIBLE); } else p.setVisibility(View.INVISIBLE); @@ -193,7 +193,7 @@ public class NewTransactionFragment extends Fragment { outState.putInt("focused", focusedItem); } private void onFabPressed() { - fab.setEnabled(false); + fab.hide(); Misc.hideSoftKeyboard(this); if (mListener != null) { SimpleDate date = viewModel.getDate();