-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIFOSAC-257: implemented compose navigation in note module (#2192)
navigation MIFOSAC-257: implemented compose navigation
- Loading branch information
Showing
6 changed files
with
81 additions
and
32 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
28 changes: 15 additions & 13 deletions
28
feature/note/src/main/java/com/mifos/feature/note/NoteViewModel.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
34 changes: 34 additions & 0 deletions
34
feature/note/src/main/java/com/mifos/feature/note/navigation/NoteNavigation.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,34 @@ | ||
package com.mifos.feature.note.navigation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import com.mifos.core.common.utils.Constants | ||
import com.mifos.feature.note.NoteScreen | ||
|
||
/** | ||
* Created by Pronay Sarker on 17/08/2024 (12:05 AM) | ||
*/ | ||
fun NavGraphBuilder.noteScreen( | ||
onBackPressed: () -> Unit | ||
) { | ||
composable( | ||
route = NoteScreens.NoteScreen.route, | ||
arguments = listOf( | ||
navArgument(name = Constants.ENTITY_ID, builder = { NavType.IntType }), | ||
navArgument(name = Constants.ENTITY_TYPE, builder = { NavType.StringType }) | ||
) | ||
) { | ||
NoteScreen( | ||
onBackPressed = onBackPressed | ||
) | ||
} | ||
} | ||
|
||
fun NavController.navigateToNoteScreen(entityId: Int, entityType: String?) { | ||
navigate(NoteScreens.NoteScreen.argument(entityId, entityType)) | ||
} |
12 changes: 12 additions & 0 deletions
12
feature/note/src/main/java/com/mifos/feature/note/navigation/NoteScreens.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 com.mifos.feature.note.navigation | ||
|
||
import com.mifos.core.common.utils.Constants | ||
|
||
/** | ||
* Created by Pronay Sarker on 17/08/2024 (12:05 AM) | ||
*/ | ||
sealed class NoteScreens(val route: String) { | ||
data object NoteScreen : NoteScreens(route = "note_screen/{${Constants.ENTITY_ID}}/{${Constants.ENTITY_TYPE}}") { | ||
fun argument(entityId: Int, entityType: String?) = "note_screen/$entityId/$entityType" | ||
} | ||
} |
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