]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionFragment.java
replace onActivityCreated (deprecated) with onViewCreated
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / NewTransactionFragment.java
index e54e8d6115af6c42c6b07b7020263613b0f7d827..e705d1c102df4a01348d77b57ac118806e4fc13d 100644 (file)
@@ -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;
@@ -107,8 +106,8 @@ public class NewTransactionFragment extends Fragment {
     }
 
     @Override
-    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
+    public void onViewCreated(@NotNull View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
         FragmentActivity activity = getActivity();
         if (activity == null)
             throw new RSInvalidStateException(
@@ -116,11 +115,14 @@ public class NewTransactionFragment extends Fragment {
 
         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);
         });