Skip to content

Commit 8df1571

Browse files
removed the toast message and put the args bundle to be instantiated in the share intent
1 parent 360b981 commit 8df1571

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/src/main/java/com/example/android/navigation/GameWonFragment.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ class GameWonFragment : Fragment() {
3838
GameWonFragmentDirections.actionGameWonFragmentToGameFragment())
3939
}
4040

41-
Toast.makeText(context,
42-
"NumCorrect: ${args.numCorrect}, NumQuestions: ${args.numQuestions}",
43-
Toast.LENGTH_LONG).show()
4441
setHasOptionsMenu(true)
4542
return binding.root
4643
}
@@ -62,4 +59,11 @@ class GameWonFragment : Fragment() {
6259
private fun shareSuccess() {
6360
startActivity(getShareIntent())
6461
}
62+
63+
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
64+
when (item!!.itemId) {
65+
R.id.share -> shareSuccess()
66+
}
67+
return super.onOptionsItemSelected(item)
68+
}
6569
}

0 commit comments

Comments
 (0)