public class NewTransactionFragment extends Fragment {
private NewTransactionItemsAdapter listAdapter;
private NewTransactionModel viewModel;
- private RecyclerView list;
private FloatingActionButton fab;
private OnNewTransactionFragmentInteractionListener mListener;
private MobileLedgerProfile mProfile;
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);
});
if (isSubmittable) {
if (fab != null) {
fab.show();
- fab.setEnabled(true);
}
}
else {
// p.setVisibility(View.VISIBLE);
//
// }, 10);
- p.setVisibility(View.VISIBLE);
+ p.setVisibility(View.VISIBLE);
}
else
p.setVisibility(View.INVISIBLE);
outState.putInt("focused", focusedItem);
}
private void onFabPressed() {
- fab.setEnabled(false);
+ fab.hide();
Misc.hideSoftKeyboard(this);
if (mListener != null) {
SimpleDate date = viewModel.getDate();