Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Update navigation dependencies #329

Merged
merged 2 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update navigation dependencies
Update navigation library version to 2.3.0.
  • Loading branch information
android-dev-lxl committed Aug 19, 2020
commit 12504c791af21c00b09eed38fd6bfc99c15982e2
5 changes: 2 additions & 3 deletions AndroidTrivia/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ android {
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -51,9 +50,9 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.appcompat:appcompat:$supportlibVersion"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.google.android.material:material:1.0.0-rc01"
implementation "com.google.android.material:material:1.2.0"
implementation"android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"
implementation "com.google.android.material:material:$supportlibVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GameWonFragment : Fragment() {
binding.nextMatchButton.setOnClickListener { view: View ->
view.findNavController().navigate(GameWonFragmentDirections.actionGameWonFragmentToGameFragment())
}
val args = GameWonFragmentArgs.fromBundle(arguments!!)
val args = GameWonFragmentArgs.fromBundle(requireArguments())
Toast.makeText(context, "NumCorrect: ${args.numCorrect}, NumQuestions: ${args.numQuestions}", Toast.LENGTH_LONG).show()

setHasOptionsMenu(true)
Expand All @@ -45,7 +45,7 @@ class GameWonFragment : Fragment() {

// Creating our Share Intent
private fun getShareIntent() : Intent {
val args = GameWonFragmentArgs.fromBundle(arguments!!)
val args = GameWonFragmentArgs.fromBundle(requireArguments())
val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.setType("text/plain")
.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_success_text, args.numCorrect, args.numQuestions))
Expand All @@ -58,19 +58,19 @@ class GameWonFragment : Fragment() {
}

// Showing the Share Menu Item Dynamically
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater?.inflate(R.menu.winner_menu, menu)
inflater.inflate(R.menu.winner_menu, menu)
// check if the activity resolves
if (null == getShareIntent().resolveActivity(activity!!.packageManager)) {
if (null == getShareIntent().resolveActivity(requireActivity().packageManager)) {
// hide the menu item if it doesn't resolve
menu?.findItem(R.id.share)?.setVisible(false)
menu.findItem(R.id.share)?.isVisible = false
}
}

// Sharing from the Menu
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when (item!!.itemId) {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.share -> shareSuccess()
}
return super.onOptionsItemSelected(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class TitleFragment : Fragment() {
}


override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater?.inflate(R.menu.options_menu,menu)
inflater.inflate(R.menu.options_menu,menu)
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return NavigationUI.onNavDestinationSelected(item!!,view!!.findNavController())
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return NavigationUI.onNavDestinationSelected(item,requireView().findNavController())
||super.onOptionsItemSelected(item)
}

Expand Down
6 changes: 3 additions & 3 deletions AndroidTrivia/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ buildscript {
kotlin_version = '1.3.72'
archLifecycleVersion = '1.1.1'
gradleVersion = '4.0.1'
supportlibVersion = '1.0.0-rc03'
supportlibVersion = '1.2.0'
dataBindingCompilerVersion = gradleVersion // Always need to be the same.
navigationVersion = '1.0.0-rc02'
navigationVersion = '2.3.0'
}
repositories {
google()
Expand All @@ -31,7 +31,7 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:$gradleVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
5 changes: 2 additions & 3 deletions AndroidTriviaFragment/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ android {
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -50,7 +49,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.appcompat:appcompat:$supportlibVersion"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.google.android.material:material:1.3.0-alpha02"
implementation "com.google.android.material:material:1.2.0"
}
4 changes: 2 additions & 2 deletions AndroidTriviaFragment/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ buildscript {
kotlin_version = '1.3.72'
archLifecycleVersion = '1.1.1'
gradleVersion = '4.0.1'
supportlibVersion = '1.0.0-rc03'
supportlibVersion = '1.2.0'
dataBindingCompilerVersion = gradleVersion // Always need to be the same.
navigationVersion = '1.0.0-rc02'
navigationVersion = '2.3.0'
}
repositories {
google()
Expand Down
4 changes: 2 additions & 2 deletions AndroidTriviaNavigation/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "androidx.appcompat:appcompat:$supportlibVersion"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.google.android.material:material:1.0.0-rc01"
implementation "com.google.android.material:material:1.2.0"
implementation"android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"
implementation "com.google.android.material:material:$supportlibVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ class TitleFragment : Fragment() {
}


override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
inflater?.inflate(R.menu.options_menu,menu)
inflater.inflate(R.menu.options_menu,menu)
}

override fun onOptionsItemSelected(item: MenuItem?): Boolean {
return NavigationUI.onNavDestinationSelected(item!!,view!!.findNavController())
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return NavigationUI.onNavDestinationSelected(item,view!!.findNavController())
||super.onOptionsItemSelected(item)
}

Expand Down
4 changes: 2 additions & 2 deletions AndroidTriviaNavigation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ buildscript {
kotlin_version = '1.3.72'
archLifecycleVersion = '1.1.1'
gradleVersion = '4.0.1'
supportlibVersion = '1.0.0-rc03'
supportlibVersion = '1.2.0'
dataBindingCompilerVersion = gradleVersion // Always need to be the same.
navigationVersion = '1.0.0-rc02'
navigationVersion = '2.3.0'
}
repositories {
google()
Expand Down