From 4a27f0546c94f178bdd4bc2a7f54d2f27dbb91fa Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 9 Jan 2022 10:26:41 -0500 Subject: [PATCH] Fix bottom nav being visible when resuming app (fixes #6012) --- .../kanade/tachiyomi/data/notification/NotificationHandler.kt | 4 ++-- app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 3 +-- .../kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationHandler.kt b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationHandler.kt index 3f74c375d..3aee02141 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationHandler.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/notification/NotificationHandler.kt @@ -20,10 +20,10 @@ object NotificationHandler { */ internal fun openDownloadManagerPendingActivity(context: Context): PendingIntent { val intent = Intent(context, MainActivity::class.java).apply { - flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT + flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP action = MainActivity.SHORTCUT_DOWNLOADS } - return PendingIntent.getActivity(context, 0, intent, 0) + return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT) } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 4af78fd7f..a97d9eb40 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -228,8 +228,6 @@ class MainActivity : BaseViewBindingActivity() { } ) - syncActivityViewWithController() - if (savedInstanceState == null) { // Reset Incognito Mode on relaunch preferences.incognitoMode().set(false) @@ -339,6 +337,7 @@ class MainActivity : BaseViewBindingActivity() { override fun onResume() { super.onResume() checkForUpdates() + syncActivityViewWithController() } private fun checkForUpdates() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt index 4b98a4fb8..dfe220b0f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiBottomNavigationView.kt @@ -89,7 +89,7 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor( * * @param animate True if slide up should be animated */ - fun slideUp(animate: Boolean = true) { + fun slideUp(animate: Boolean = true) = post { currentAnimator?.cancel() clearAnimation() @@ -106,7 +106,7 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor( * * @param animate True if slide down should be animated */ - fun slideDown(animate: Boolean = true) { + fun slideDown(animate: Boolean = true) = post { currentAnimator?.cancel() clearAnimation()