Skip to content

Commit

Permalink
Updated project to Android Navigation v 1.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Prasan Pani <prasannajeet89@gmail.com>
  • Loading branch information
Prasan Pani committed Jun 22, 2019
1 parent 91e7b8e commit be42ae5
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 49 deletions.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/markdown-navigator/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
defaultConfig {
applicationId "com.example.prasa.navsample"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -25,16 +25,16 @@ android {
}

dependencies {
def nav_version = "1.0.0-alpha06"
def nav_version = "1.0.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AskMyAgeFragment : androidx.fragment.app.Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
name = AskMyAgeFragmentArgs.fromBundle(arguments).myname
name = AskMyAgeFragmentArgs.fromBundle(arguments!!).myname
helloEnterAge.hint = "Hello $name! What's your age?"

buttonWelcomeWithAge.setOnClickListener {
Expand All @@ -36,8 +36,8 @@ class AskMyAgeFragment : androidx.fragment.app.Fragment() {
helloEnterAge.error = "Please enter age"
} else {
val action = AskMyAgeFragmentDirections.actionAgeFragmentToWelcomeWithAgeFragment()
action.setMyage(age)
action.setMyname(name)
action.myage = age
action.myname = name
findNavController().navigate(action)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WelcomeMeFragment : androidx.fragment.app.Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val name = WelcomeMeFragmentArgs.fromBundle(arguments).myname
val name = WelcomeMeFragmentArgs.fromBundle(arguments!!).myname
welcomeName.text = "Welcome $name!"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WelcomeMeWithAgeFragment : androidx.fragment.app.Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val fragmentArgs = WelcomeMeWithAgeFragmentArgs.fromBundle(arguments)
val fragmentArgs = WelcomeMeWithAgeFragmentArgs.fromBundle(arguments!!)
val name = fragmentArgs.myname
val age = fragmentArgs.myage

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.MainActivity" >
tools:context=".ui.main.MainActivity">

<!--<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mainFragment"
app:navGraph="@navigation/welcome_nav"
android:name="androidx.navigation.fragment.NavHostFragment"
app:defaultNavHost="true"/>-->
app:defaultNavHost="true" />-->
</FrameLayout>
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.0'
ext.kotlin_version = '1.3.40'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-beta03'
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07'
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Nov 08 19:48:19 CST 2018
#Sat Jun 22 10:30:34 CDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0 comments on commit be42ae5

Please sign in to comment.