File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed
java/com/example/android/navigation Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ apply plugin: 'kotlin-android'
2020
2121apply plugin : ' kotlin-kapt'
2222apply plugin : ' kotlin-android-extensions'
23+ apply plugin : ' androidx.navigation.safeargs'
24+
2325
2426android {
2527 compileSdkVersion 28
Original file line number Diff line number Diff line change @@ -99,10 +99,11 @@ class GameFragment : Fragment() {
9999 binding.invalidateAll()
100100 } else {
101101 // We've won! Navigate to the gameWonFragment.
102- view.findNavController().navigate(R .id.action_gameFragment_to_gameWonFragment )
102+ view.findNavController().navigate(GameFragmentDirections .actionGameFragmentToGameWonFragment(numQuestions, questionIndex) )
103103 }
104104 } else {
105- view.findNavController().navigate(R .id.action_gameFragment_to_gameOverFragment2)
105+ // We've lost! Navigate to the gameLostFragment
106+ view.findNavController().navigate(GameFragmentDirections .actionGameFragmentToGameOverFragment2())
106107 }
107108 }
108109 }
Original file line number Diff line number Diff line change 4747 android : id =" @+id/action_gameWonFragment_to_gameFragment"
4848 app : destination =" @id/gameFragment"
4949 app : popUpTo =" @id/gameFragment" />
50+ <argument
51+ android : name =" numQuestions"
52+ app : argType =" integer" />
53+ <argument
54+ android : name =" numCorrect"
55+ app : argType =" integer" />
5056 </fragment >
5157 <fragment
5258 android : id =" @+id/aboutFragment"
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ buildscript {
3131 dependencies {
3232 classpath ' com.android.tools.build:gradle:3.3.0'
3333 classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin "
34+ classpath " android.arch.navigation:navigation-safe-args-gradle-plugin:$version_navigation "
3435
3536 // NOTE: Do not place your application dependencies here; they belong
3637 // in the individual module build.gradle files
You can’t perform that action at this time.
0 commit comments