package Ġdev . k xx cn . mar u . view . splash Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . View Ċ import Ġandroidx . fragment . app . view Models Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . navigation . fragment . find Nav Controller Ċ import Ġdagger . android . support . D agger Fragment Ċ import Ġdev . k xx cn . mar u . R Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠSpl ash Fragment Ġ: ĠD agger Fragment ( R . layout . splash _ fragment ) Ġ{ ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar ĠviewModel Factory : ĠViewModel Provider . Factory ĊĊĠĠĠ Ġprivate Ġval ĠviewModel Ġby Ġview Models < Splash ViewModel > Ġ{ ĠviewModel Factory Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon View Created ( view : ĠView , ĠsavedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on View Created ( view , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġsetup Navigation () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Navigation () Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel . register . observe ( view Lifecycle Owner , Ġ{ Ġnavigate ( it ) Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate ( logged In : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( logged In ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSpl ash Fragment Directions . action Splash Fragment To Home Fragment () ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSpl ash Fragment Directions . action Splash Fragment ToInt ro Fragment () ĊĠĠĠĠĠĠĠ Ġ}. also Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfind Nav Controller (). navigate ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ