]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListFragment.java
hook the observer after the activity creation
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / transaction_list / TransactionListFragment.java
index 505c4063855eb9719a99f5947827c61b21f7fad7..dcb2d0cedf419712e5245de59be93fac2287211d 100644 (file)
@@ -56,8 +56,6 @@ public class TransactionListFragment extends MobileLedgerListFragment {
     public void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setHasOptionsMenu(true);
-        Data.backgroundTasksRunning.observe(getViewLifecycleOwner(),
-                this::onBackgroundTaskRunningChanged);
     }
     @Override
     public void onAttach(@NotNull Context context) {
@@ -90,6 +88,9 @@ public class TransactionListFragment extends MobileLedgerListFragment {
         debug("flow", "TransactionListFragment.onActivityCreated called");
         super.onActivityCreated(savedInstanceState);
 
+        Data.backgroundTasksRunning.observe(getViewLifecycleOwner(),
+                this::onBackgroundTaskRunningChanged);
+
         swiper = mActivity.findViewById(R.id.transaction_swipe);
         if (swiper == null)
             throw new RuntimeException("Can't get hold on the swipe layout");