Android 如何使用底部导航视图进行条件导航
我使用Android 如何使用底部导航视图进行条件导航,android,kotlin,bottomnavigationview,Android,Kotlin,Bottomnavigationview,我使用FirebaseUI在我的应用程序中创建了登录流。 目前我的流量如下-> main片段: login_button.setOnClickListener { launchLoginFlow() } //launch the flow through button view observeAuthState() //observe whether the user is authenticate or not MainViewModel:在mainFragment中激活ob
FirebaseUI
在我的应用程序中创建了登录流。
目前我的流量如下->
main片段
:
login_button.setOnClickListener { launchLoginFlow() } //launch the flow through button view
observeAuthState() //observe whether the user is authenticate or not
MainViewModel
:在mainFragment
中激活observeAuthState
:
val authenticationState = FirebaseUserLiveData().map { user ->
if (user != null) {
AuthState.AUTHENTICATED
} else {
AuthState.UNAUTHENTICATED
} }
我的问题是,如果用户未登录,如何防止用户从main片段导航到其他片段
使用直接导航非常简单,在导航之前,我只需检查他是否登录
但如何使用底部导航视图检查此问题