Skip to content

Commit

Permalink
Issues boostcampwm-2022#287 feat: 각 모듈별 nav_graph 정의
Browse files Browse the repository at this point in the history
  • Loading branch information
audxo112 committed Feb 28, 2023
1 parent ed54480 commit 2accfca
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/src/main/java/com/lighthouse/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.databinding.DataBindingUtil
import androidx.navigation.findNavController
import com.lighthouse.beep.R
import com.lighthouse.beep.databinding.ActivityMainBinding
import com.lighthouse.features.common.ext.repeatOnStarted
Expand All @@ -26,7 +25,7 @@ class MainActivity : AppCompatActivity() {
}

private fun setUpIsLogin() {
val navController = findNavController(R.id.fcv)
// val navController = findNavController(R.id.fcv)
repeatOnStarted {
viewModel.isLogin().collect { isLogin ->
if (isLogin) {
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/bnv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:navGraph="@navigation/main_graph"/>
</layout>
1 change: 1 addition & 0 deletions app/src/main/res/navigation/main_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_graph">


</navigation>
2 changes: 2 additions & 0 deletions features/ui-gifticonlist/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dependencies {
implementation(libs.androidX.appcompat)
implementation(libs.androidX.constraintlayout)
implementation(libs.androidX.fragment.ktx)
implementation(libs.androidX.navigation.fragment.ktx)
implementation(libs.androidX.navigation.ui.ktx)

implementation(libs.material)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.lighthouse.features.gifticonlist.ui

import androidx.fragment.app.Fragment

class GifticonListFragment : Fragment()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/gifticon_list_nav_graph"
app:startDestination="@id/gifticon_list_fragment">

<fragment
android:id="@+id/gifticon_list_fragment"
android:name="com.lighthouse.features.gifticonlist.ui.GifticonListFragment" />
</navigation>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.lighthouse.features.home.ui

import androidx.fragment.app.Fragment

class HomeLoadingFragment : Fragment()
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/home_container_nav_graph"
app:startDestination="@id/home_loading_fragment">

<fragment
android:id="@+id/home_loading_fragment"
android:name="com.lighthouse.features.home.ui.HomeLoadingFragment"/>

<fragment
android:id="@+id/home_fragment"
android:name="com.lighthouse.features.home.ui.HomeFragment"/>

<fragment
android:id="@+id/home_empty_fragment"
android:name="com.lighthouse.features.home.ui.HomeEmptyFragment"/>
</navigation>
6 changes: 5 additions & 1 deletion features/ui-home/src/main/res/navigation/home_nav_graph.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/home_nav_graph">
android:id="@+id/home_nav_graph"
app:startDestination="@id/home_container_fragment">

<fragment
android:id="@+id/home_container_fragment"
android:name="com.lighthouse.features.home.ui.HomeContainerFragment"/>
</navigation>
2 changes: 2 additions & 0 deletions features/ui-intro/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dependencies {
implementation(libs.androidX.appcompat)
implementation(libs.androidX.constraintlayout)
implementation(libs.androidX.fragment.ktx)
implementation(libs.androidX.navigation.fragment.ktx)
implementation(libs.androidX.navigation.ui.ktx)

implementation(libs.material)

Expand Down
10 changes: 10 additions & 0 deletions features/ui-intro/src/main/res/navigation/intro_nav_graph.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/intro_nav_graph"
app:startDestination="@id/intro_fragment">

<fragment
android:id="@+id/intro_fragment"
android:name="com.lighthouse.features.intro.ui.IntroFragment" />
</navigation>
10 changes: 10 additions & 0 deletions features/ui-main/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_nav_graph"
app:startDestination="@id/main_container_fragment">

<fragment
android:id="@+id/main_container_fragment"
android:name="com.lighthouse.features.main.ui.MainContainerFragment" />
</navigation>
2 changes: 2 additions & 0 deletions features/ui-setting/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ dependencies {
implementation(libs.androidX.appcompat)
implementation(libs.androidX.constraintlayout)
implementation(libs.androidX.fragment.ktx)
implementation(libs.androidX.navigation.fragment.ktx)
implementation(libs.androidX.navigation.ui.ktx)

implementation(libs.material)

Expand Down
10 changes: 10 additions & 0 deletions features/ui-setting/src/main/res/navigation/setting_nav_graph.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/setting_nav_graph"
app:startDestination="@id/setting_fragment">

<fragment
android:id="@+id/setting_fragment"
android:name="com.lighthouse.features.setting.ui.SettingFragment" />
</navigation>

0 comments on commit 2accfca

Please sign in to comment.