File tree Expand file tree Collapse file tree 6 files changed +14
-9
lines changed
java/com/sijanneupane/mvvmnews/ui Expand file tree Collapse file tree 6 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,14 @@ dependencies {
3737 implementation fileTree(dir : ' libs' , include : [' *.jar' ])
3838 implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version "
3939 implementation ' androidx.appcompat:appcompat:1.3.0'
40- implementation ' androidx.core:core-ktx:1.5 .0'
40+ implementation ' androidx.core:core-ktx:1.6 .0'
4141 implementation ' androidx.constraintlayout:constraintlayout:2.0.4'
4242 testImplementation ' junit:junit:4.13.2'
43- androidTestImplementation ' androidx.test.ext:junit:1.1.2'
44- androidTestImplementation ' androidx.test.espresso:espresso-core:3.3.0'
45- implementation ' com.google.android.material:material:1.3.0'
43+ androidTestImplementation ' androidx.test.ext:junit:1.1.3'
44+ androidTestImplementation ' androidx.test.espresso:espresso-core:3.4.0'
45+ implementation ' com.google.android.material:material:1.4.0'
46+ implementation ' androidx.fragment:fragment-ktx:1.3.5'
47+
4648
4749 // Architectural Components
4850 implementation " androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
Original file line number Diff line number Diff line change 1111 android : roundIcon =" @mipmap/ic_launcher_round"
1212 android : supportsRtl =" true"
1313 android : theme =" @style/Theme.MVVMNews" >
14+
1415 <activity android : name =" .ui.MainActivity" >
1516 <intent-filter >
1617 <action android : name =" android.intent.action.MAIN" />
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.sijanneupane.mvvmnews.ui
33import androidx.appcompat.app.AppCompatActivity
44import android.os.Bundle
55import androidx.lifecycle.ViewModelProvider
6+ import androidx.navigation.fragment.NavHostFragment
67import androidx.navigation.fragment.findNavController
78import androidx.navigation.ui.setupWithNavController
89import com.sijanneupane.mvvmnews.R
@@ -21,8 +22,9 @@ class MainActivity : AppCompatActivity() {
2122 val repository= NewsRepository (ArticleDatabase (this ))
2223 val viewModelProviderFactory= NewsViewModelProviderFactory (repository)
2324 viewModel= ViewModelProvider (this , viewModelProviderFactory).get(NewsViewModel ::class .java)
24-
25- bottomNavigationView.setupWithNavController(newsNavHostFrag.findNavController())
25+ val navHostFragment= supportFragmentManager.findFragmentById(R .id.newsNavHostFrag) as NavHostFragment
26+ val navController= navHostFragment.navController
27+ bottomNavigationView.setupWithNavController(navController)
2628
2729
2830 }
Original file line number Diff line number Diff line change 1616 app : layout_constraintStart_toStartOf =" parent"
1717 app : layout_constraintTop_toTopOf =" parent" >
1818
19- <fragment
19+ <androidx . fragment.app.FragmentContainerView
2020 android : id =" @+id/newsNavHostFrag"
2121 android : name =" androidx.navigation.fragment.NavHostFragment"
2222 android : layout_width =" match_parent"
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<navigation xmlns : android =" http://schemas.android.com/apk/res/android"
33 xmlns : app =" http://schemas.android.com/apk/res-auto"
4- android : id =" @+id/news_nav_graph.xml "
4+ android : id =" @+id/news_nav_graph"
55 app : startDestination =" @id/breakingNewsFragment" >
66
77 <fragment
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ buildscript {
66 mavenCentral()
77 }
88 dependencies {
9- classpath " com.android.tools.build:gradle:4.2.1 "
9+ classpath ' com.android.tools.build:gradle:4.2.2 '
1010 classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
1111 classpath " androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
1212
You can’t perform that action at this time.
0 commit comments