From 56f4f8a38d1b2e9cae2d1c6165b2152d904340eb Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sun, 21 Jun 2020 19:52:27 +0200 Subject: [PATCH] fix MainActivity title when coming from a notification (#1844) --- app/src/main/java/com/keylesspalace/tusky/MainActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index da818b2c..4cb737f3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -488,8 +488,8 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje val pageMargin = resources.getDimensionPixelSize(R.dimen.tab_page_margin) viewPager.setPageTransformer(MarginPageTransformer(pageMargin)) - val uswSwipeForTabs = preferences.getBoolean("enableSwipeForTabs", true) - viewPager.isUserInputEnabled = uswSwipeForTabs + val enableSwipeForTabs = preferences.getBoolean("enableSwipeForTabs", true) + viewPager.isUserInputEnabled = enableSwipeForTabs onTabSelectedListener?.let { activeTabLayout.removeOnTabSelectedListener(it) @@ -516,7 +516,8 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje activeTabLayout.addOnTabSelectedListener(it) } - mainToolbar.title = tabs[0].title(this@MainActivity) + val activeTabPosition = if (selectNotificationTab) notificationTabPosition else 0 + mainToolbar.title = tabs[activeTabPosition].title(this@MainActivity) }