From 08d5dfa49c676a2e94860a2c8dcf337b5411bb4d Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Fri, 16 Jul 2021 21:04:32 +0200 Subject: [PATCH 1/2] Removed updateRelativeTimeViews when the activity is paused We don't need to call ``updateRelativeTimeViews`` when the activity is paused, because the user likely won't notice it. Despite that onResume already calls ``updateRelativeTimeViews`` so there is no need to do that twice. --- .../java/org/schabi/newpipe/local/feed/FeedFragment.kt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index c235b22df..a64ffee1e 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -167,14 +167,6 @@ class FeedFragment : BaseStateFragment() { } } - override fun setUserVisibleHint(isVisibleToUser: Boolean) { - super.setUserVisibleHint(isVisibleToUser) - - if (!isVisibleToUser && view != null) { - updateRelativeTimeViews() - } - } - override fun initListeners() { super.initListeners() feedBinding.refreshRootView.setOnClickListener { reloadContent() } From f4e2eca256bc7072ac4f1360713d8aa7c748fe05 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Fri, 16 Jul 2021 21:21:10 +0200 Subject: [PATCH 2/2] Simplified code and adjusted the style so that it's similar to FeedFragment --- .../local/subscription/SubscriptionFragment.kt | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt index 5b5bda498..a92e4f1fc 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt @@ -112,13 +112,6 @@ class SubscriptionFragment : BaseStateFragment() { setupInitialLayout() } - override fun setUserVisibleHint(isVisibleToUser: Boolean) { - super.setUserVisibleHint(isVisibleToUser) - if (activity != null && isVisibleToUser) { - setTitle(activity.getString(R.string.tab_subscriptions)) - } - } - override fun onAttach(context: Context) { super.onAttach(context) subscriptionManager = SubscriptionManager(requireContext()) @@ -156,11 +149,8 @@ class SubscriptionFragment : BaseStateFragment() { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { super.onCreateOptionsMenu(menu, inflater) - val supportActionBar = activity.supportActionBar - if (supportActionBar != null) { - supportActionBar.setDisplayShowTitleEnabled(true) - setTitle(getString(R.string.tab_subscriptions)) - } + activity.supportActionBar?.setDisplayShowTitleEnabled(true) + activity.supportActionBar?.setTitle(R.string.tab_subscriptions) } private fun setupBroadcastReceiver() {