From 0f4b6d7d9f1af7a12b16aadedfc2c8833b11c906 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:22:52 +0100 Subject: [PATCH] Improved code readablity --- .../schabi/newpipe/settings/NotificationsSettingsFragment.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/settings/NotificationsSettingsFragment.kt b/app/src/main/java/org/schabi/newpipe/settings/NotificationsSettingsFragment.kt index e1f7ed2c2..04f5a9b56 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/NotificationsSettingsFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/settings/NotificationsSettingsFragment.kt @@ -47,6 +47,7 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen override fun onResume() { super.onResume() + val enabled = NotificationHelper.areNotificationsEnabledOnDevice(requireContext()) preferenceScreen.isEnabled = enabled if (!enabled) { @@ -73,6 +74,8 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen notificationWarningSnackbar?.dismiss() notificationWarningSnackbar = null } + + // (Re-)Create loader loader?.dispose() loader = SubscriptionManager(requireContext()) .subscriptions() @@ -83,6 +86,7 @@ class NotificationsSettingsFragment : BasePreferenceFragment(), OnSharedPreferen override fun onPause() { loader?.dispose() loader = null + super.onPause() }