From 54fc5f1f3b00982b588e335d2eb80a16def836d9 Mon Sep 17 00:00:00 2001 From: Stanisalv Date: Fri, 27 Sep 2019 21:49:55 +0300 Subject: [PATCH] review --- .../tabbarnavigation_new/BottomNavigationController.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tabbar-navigation-new/src/main/java/ru/touchin/roboswag/components/tabbarnavigation_new/BottomNavigationController.kt b/tabbar-navigation-new/src/main/java/ru/touchin/roboswag/components/tabbarnavigation_new/BottomNavigationController.kt index d532b88..6b57924 100644 --- a/tabbar-navigation-new/src/main/java/ru/touchin/roboswag/components/tabbarnavigation_new/BottomNavigationController.kt +++ b/tabbar-navigation-new/src/main/java/ru/touchin/roboswag/components/tabbarnavigation_new/BottomNavigationController.kt @@ -37,7 +37,7 @@ class BottomNavigationController( callback = object : FragmentManager.FragmentLifecycleCallbacks() { override fun onFragmentViewCreated(fragmentManager: FragmentManager, fragment: Fragment, view: View, savedInstanceState: Bundle?) { fragments.forEach { itemId, (fragmentClass, _) -> - if (isViewControllerFragment(fragment, fragmentClass)) { + if (isFragment(fragment, fragmentClass)) { navigationTabsContainer.children.forEach { itemView -> itemView.isActivated = itemView.id == itemId } } } @@ -48,7 +48,7 @@ class BottomNavigationController( navigationTabsContainer.children.forEach { itemView -> fragments[itemView.id]?.let { (viewControllerClass, _) -> itemView.setOnClickListener { - if (!isViewControllerFragment(fragmentManager.primaryNavigationFragment, viewControllerClass)) { + if (!isFragment(fragmentManager.primaryNavigationFragment, viewControllerClass)) { navigateTo(itemView.id) } else { onReselectListener?.invoke() @@ -116,7 +116,7 @@ class BottomNavigationController( false } - private fun isViewControllerFragment(fragment: Fragment?, fragmentClass: Class>) = + private fun isFragment(fragment: Fragment?, fragmentClass: Class>) = if (wrapWithNavigationContainer) { (fragment as NavigationContainerFragment).getFragmentClass() } else {