]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryFragment.java
use getViewLifecycleOwner when observing LiveData from fragments
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / account_summary / AccountSummaryFragment.java
index bb484929d9f221236bde6b05209cc5b07f5c25d4..6482dfd1397389d5c4eb4a75770c960a5e1d88fc 100644 (file)
@@ -54,7 +54,8 @@ public class AccountSummaryFragment extends MobileLedgerListFragment {
         debug("flow", "AccountSummaryFragment.onCreate()");
         setHasOptionsMenu(true);
 
-        Data.backgroundTasksRunning.observe(this, this::onBackgroundTaskRunningChanged);
+        Data.backgroundTasksRunning.observe(this.getViewLifecycleOwner(),
+                this::onBackgroundTaskRunningChanged);
     }
     public void onAttach(@NotNull Context context) {
         super.onAttach(context);
@@ -93,7 +94,7 @@ public class AccountSummaryFragment extends MobileLedgerListFragment {
         manageFabOnScroll();
 
         swiper = mActivity.findViewById(R.id.account_swiper);
-        Colors.themeWatch.observe(this, this::themeChanged);
+        Colors.themeWatch.observe(getViewLifecycleOwner(), this::themeChanged);
         swiper.setOnRefreshListener(() -> {
             debug("ui", "refreshing accounts via swipe");
             Data.scheduleTransactionListRetrieval(mActivity);