-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:TOP-87 모듈간 이동을 core:navigation 모듈을 통해 진행하도록 변경
- feature모듈은 core:navigation 모듈에 의존해서 모듈간 이동 진행 - core:navigation 모듈에 feature별 navigation interface를 정의, 각 feature에서 구현체 구현 - app 모듈에 navigation di 코드 작성 - 불필요한 코드 제거
- Loading branch information
Showing
12 changed files
with
125 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/tht/tht/navigation/HomeNavigationImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.tht.tht.navigation | ||
|
||
import android.content.Context | ||
import com.tht.tht.HomeActivity | ||
import tht.core.navigation.HomeNavigation | ||
import javax.inject.Inject | ||
|
||
class HomeNavigationImpl @Inject constructor() : HomeNavigation { | ||
|
||
override fun navigateHome(context: Context) { | ||
context.startActivity(HomeActivity.newIntent(context)) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/tht/tht/navigation/NavigationModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.tht.tht.navigation | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import tht.core.navigation.HomeNavigation | ||
import tht.core.navigation.SignupNavigation | ||
import tht.core.navigation.ToHotNavigation | ||
import tht.feature.signin.navigation.SignupNavigationImpl | ||
import tht.feature.tohot.navigation.ToHotNavigationImpl | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class NavigationModule { | ||
|
||
@Binds | ||
abstract fun bindHomeNavigation(impl: HomeNavigationImpl): HomeNavigation | ||
|
||
@Binds | ||
abstract fun bindSignupNavigation(impl: SignupNavigationImpl): SignupNavigation | ||
|
||
@Binds | ||
abstract fun bindToHotNavigation(impl: ToHotNavigationImpl): ToHotNavigation | ||
} |
7 changes: 7 additions & 0 deletions
7
core/navigation/src/main/java/tht/core/navigation/HomeNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package tht.core.navigation | ||
|
||
import android.content.Context | ||
|
||
interface HomeNavigation { | ||
fun navigateHome(context: Context) | ||
} |
7 changes: 7 additions & 0 deletions
7
core/navigation/src/main/java/tht/core/navigation/SignupNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package tht.core.navigation | ||
|
||
import android.content.Context | ||
|
||
interface SignupNavigation { | ||
fun navigatePreLogin(context: Context) | ||
} |
10 changes: 10 additions & 0 deletions
10
core/navigation/src/main/java/tht/core/navigation/ToHotNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package tht.core.navigation | ||
|
||
import androidx.fragment.app.FragmentManager | ||
|
||
interface ToHotNavigation { | ||
fun navigateToHot( | ||
fragmentManager: FragmentManager, | ||
fragmentContainerResourceId: Int | ||
) | ||
} |
12 changes: 12 additions & 0 deletions
12
feature/signin/src/main/java/tht/feature/signin/navigation/SignupNavigationImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package tht.feature.signin.navigation | ||
|
||
import android.content.Context | ||
import tht.core.navigation.SignupNavigation | ||
import tht.feature.signin.prelogin.PreloginActivity | ||
import javax.inject.Inject | ||
|
||
class SignupNavigationImpl @Inject constructor() : SignupNavigation { | ||
override fun navigatePreLogin(context: Context) { | ||
context.startActivity(PreloginActivity.getIntent(context)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
feature/tohot/src/main/java/tht/feature/tohot/navigation/ToHotNavigationImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package tht.feature.tohot.navigation | ||
|
||
import androidx.fragment.app.FragmentManager | ||
import tht.core.navigation.ToHotNavigation | ||
import tht.feature.tohot.tohot.fragment.ToHotFragment | ||
import javax.inject.Inject | ||
|
||
class ToHotNavigationImpl @Inject constructor() : ToHotNavigation { | ||
override fun navigateToHot( | ||
fragmentManager: FragmentManager, | ||
fragmentContainerResourceId: Int | ||
) { | ||
val foundFragment = fragmentManager.findFragmentByTag(ToHotFragment.TAG) | ||
fragmentManager.fragments.forEach { fm -> | ||
fragmentManager.beginTransaction().hide(fm).commitAllowingStateLoss() | ||
} | ||
foundFragment?.let { | ||
fragmentManager.beginTransaction().show(it).commitAllowingStateLoss() | ||
} ?: run { | ||
fragmentManager.beginTransaction() | ||
.add(fragmentContainerResourceId, ToHotFragment.newInstance(), ToHotFragment.TAG) | ||
.commitAllowingStateLoss() | ||
} | ||
} | ||
} |