Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
Navigation Component with Login / Register / Home flow

I would like to use the new Navigation Component for my next application but I can't quite wrap my head around the overall flow of navigation. The Android team recommends a single activity as an entry point. They also suggest that conditional elements like a login / register should not be the entry point. But then how do you display the login and register buttons if the entry screen is supposed to be the home screen?

Another idea is to use a Splash screen, have the logic there to determine if the user is already logged in, if so go to the home screen, if not show the login / register screen(s).

My other issue is with the single activity. My home screen would need to be a screen with a Bottom Navigation.

How do you tie all of this the "right way"? Do I need to have a separate navigation graph for the Home view, with the Bottom Navigation and the many screens that will flow from there?

All the examples I have found have been very straightforward, and the few I have seen with a Splash screen splitting into Home and Login have a very simple Home fragment, which in my case would be . more complex with the Bottom Nav.

Thanks.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

One way to do this, you hide the bottom navigation in the login and popup the homepage when you navigate to the login page so the user would not be able to go back to the splash screen

1-you can hide the bottom naviagtion bar in the login fragment like this

val toolbar = activity!!.findViewById<Toolbar>(R.id.toolbar)
val bottombar = activity!!.findViewById<BottomNavigationView>(R.id.bottomNavigationView)
        toolbar.visibility = View.GONE
        bottombar.visibility = View.GONE

2- popup the splash fragment when you navigate to the login page

<action
            android:id="@+id/action_splashFragment_to_loginFragment"
            app:destination="@id/loginFragment"
            app:popUpTo="@+id/splashFragment"
            app:popUpToInclusive="true"/>

Hopefully it will work for you

over 4 years ago · Santiago Trujillo Relatório

0

Simple example =

Single activity, Multi fragment with bottom navigation bar and with Android Navigation comp.

Plan:

  • Show a splash screen with a timer like 3000 milis.
  • End of the milis navigate the user to login screen if already logged (check it on splash) navigate user to home screen
  • Now you can show a bottom nav. bar. For example "Home" "News"
  • You can handle backPresses in navigation. Handle for home (Disable to returning splash)

That's all folks!

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda