diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailScreen.kt index e084b14..ea9e60f 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailScreen.kt @@ -43,7 +43,11 @@ import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.destinations.CreateFlashCardScreenDestination import com.ramcosta.composedestinations.generated.destinations.EditFlashCardScreenDestination import com.ramcosta.composedestinations.generated.destinations.EditStudySetScreenDestination +import com.ramcosta.composedestinations.generated.destinations.FlipFlashCardScreenDestination +import com.ramcosta.composedestinations.generated.destinations.LearnFlashCardScreenDestination +import com.ramcosta.composedestinations.generated.destinations.MatchFlashCardScreenDestination import com.ramcosta.composedestinations.generated.destinations.StudySetInfoScreenDestination +import com.ramcosta.composedestinations.generated.destinations.TestFlashCardScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult import com.ramcosta.composedestinations.result.ResultBackNavigator @@ -61,7 +65,11 @@ fun StudySetDetailScreen( resultNavigator: ResultBackNavigator, resultBakFlashCard: ResultRecipient, resultEditStudySet: ResultRecipient, - resultEditFlashCard: ResultRecipient + resultEditFlashCard: ResultRecipient, + resultFlipFlashCard: ResultRecipient, + resultLearnFlashCard: ResultRecipient, + resultTestFlashCard: ResultRecipient, + resultMatchFlashCard: ResultRecipient ) { val uiState by viewModel.uiState.collectAsState() @@ -97,6 +105,50 @@ fun StudySetDetailScreen( } } + resultFlipFlashCard.onNavResult { result -> + when (result) { + is NavResult.Canceled -> {} + is NavResult.Value -> { + if (result.value) { + viewModel.onEvent(StudySetDetailUiAction.Refresh) + } + } + } + } + + resultLearnFlashCard.onNavResult { result -> + when (result) { + is NavResult.Canceled -> {} + is NavResult.Value -> { + if (result.value) { + viewModel.onEvent(StudySetDetailUiAction.Refresh) + } + } + } + } + + resultTestFlashCard.onNavResult { result -> + when (result) { + is NavResult.Canceled -> {} + is NavResult.Value -> { + if (result.value) { + viewModel.onEvent(StudySetDetailUiAction.Refresh) + } + } + } + } + + resultMatchFlashCard.onNavResult { result -> + when (result) { + is NavResult.Canceled -> {} + is NavResult.Value -> { + if (result.value) { + viewModel.onEvent(StudySetDetailUiAction.Refresh) + } + } + } + } + LaunchedEffect(key1 = true) { viewModel.uiEvent.collect { event -> when (event) { @@ -205,6 +257,26 @@ fun StudySetDetailScreen( }, onResetProgress = { viewModel.onEvent(StudySetDetailUiAction.OnResetProgressClicked(uiState.id)) + }, + onNavigateToLearnFlashCard = { + navigator.navigate( + LearnFlashCardScreenDestination() + ) + }, + onNavigateToTestFlashCard = { + navigator.navigate( + TestFlashCardScreenDestination() + ) + }, + onNavigateToMatchFlashCard = { + navigator.navigate( + MatchFlashCardScreenDestination() + ) + }, + onNavigateToFlipFlashCard = { + navigator.navigate( + FlipFlashCardScreenDestination() + ) } ) } @@ -229,7 +301,11 @@ fun StudySetDetail( onToggleStarredFlashCard: (String, Boolean) -> Unit = { _, _ -> }, onEditStudySet: () -> Unit = {}, onDeleteStudySet: () -> Unit = {}, - onResetProgress: () -> Unit = {} + onResetProgress: () -> Unit = {}, + onNavigateToLearnFlashCard: () -> Unit = {}, + onNavigateToTestFlashCard: () -> Unit = {}, + onNavigateToMatchFlashCard: () -> Unit = {}, + onNavigateToFlipFlashCard: () -> Unit = {}, ) { val context = LocalContext.current var tabIndex by remember { mutableIntStateOf(0) } @@ -308,7 +384,11 @@ fun StudySetDetail( onDeleteFlashCardClick = onDeleteFlashCard, onToggleStarClick = onToggleStarredFlashCard, onEditFlashCardClick = onEditFlashCard, - onAddFlashCardClick = onAddFlashcard + onAddFlashCardClick = onAddFlashcard, + onNavigateToLearnFlashCard = onNavigateToLearnFlashCard, + onNavigateToTestFlashCard = onNavigateToTestFlashCard, + onNavigateToMatchFlashCard = onNavigateToMatchFlashCard, + onNavigateToFlipFlashCard = onNavigateToFlipFlashCard ) 1 -> ProgressTabScreen( diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt index 3353d3d..8f5208a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/material/MaterialTabScreen.kt @@ -59,6 +59,10 @@ fun MaterialTabScreen( onEditFlashCardClick: () -> Unit = {}, onToggleStarClick: (String, Boolean) -> Unit = { _, _ -> }, onAddFlashCardClick: () -> Unit = {}, + onNavigateToLearnFlashCard: () -> Unit = {}, + onNavigateToTestFlashCard: () -> Unit = {}, + onNavigateToMatchFlashCard: () -> Unit = {}, + onNavigateToFlipFlashCard: () -> Unit = {}, ) { val menuBottomSheetState = rememberModalBottomSheetState() var showMenu by remember { mutableStateOf(false) } @@ -153,28 +157,28 @@ fun MaterialTabScreen( LearnModeCard( title = "Flip Flashcards", icon = R.drawable.ic_flipcard, - onClick = {} + onClick = onNavigateToFlipFlashCard ) } item { LearnModeCard( title = "Learn", icon = R.drawable.ic_learn, - onClick = {} + onClick = onNavigateToLearnFlashCard ) } item { LearnModeCard( title = "Test", icon = R.drawable.ic_test, - onClick = {} + onClick = onNavigateToTestFlashCard ) } item { LearnModeCard( title = "Match", icon = R.drawable.ic_match_card, - onClick = {} + onClick = onNavigateToMatchFlashCard ) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardScreen.kt new file mode 100644 index 0000000..21065b8 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardScreen.kt @@ -0,0 +1,60 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.flip_flashcard + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.hilt.navigation.compose.hiltViewModel +import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.navigation.DestinationsNavigator +import com.ramcosta.composedestinations.result.ResultBackNavigator + +@Destination +@Composable +fun FlipFlashCardScreen( + modifier: Modifier = Modifier, + navigator: DestinationsNavigator, + resultNavigator: ResultBackNavigator, + viewModel: FlipFlashCardViewModel = hiltViewModel() +) { + val uiState by viewModel.uiState.collectAsState() + LaunchedEffect(key1 = true) { + viewModel.uiEvent.collect { event -> + when (event) { + else -> {} + } + + } + } + FlipFlashCard(modifier = modifier) +} + +@Composable +fun FlipFlashCard(modifier: Modifier = Modifier) { + Scaffold { innerPadding -> + Column( + modifier = modifier.padding(innerPadding) + ) { + Text( + text = "FlipFlashCardScreen", + style = MaterialTheme.typography.bodyLarge + ) + } + } +} + +@Preview +@Composable +private fun FlipFlashCardScreenPreview() { + MaterialTheme { + FlipFlashCard() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiAction.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiAction.kt new file mode 100644 index 0000000..7dd568d --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiAction.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.flip_flashcard + +sealed class FlipFlashCardUiAction { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiEvent.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiEvent.kt new file mode 100644 index 0000000..8ba2f00 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiEvent.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.flip_flashcard + +sealed class FlipFlashCardUiEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiState.kt new file mode 100644 index 0000000..6aea35a --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardUiState.kt @@ -0,0 +1,5 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.flip_flashcard + +data class FlipFlashCardUiState( + val isLoading: Boolean = false, +) \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardViewModel.kt new file mode 100644 index 0000000..baea190 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/flip_flashcard/FlipFlashCardViewModel.kt @@ -0,0 +1,22 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.flip_flashcard + +import androidx.lifecycle.ViewModel +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.receiveAsFlow +import javax.inject.Inject + +class FlipFlashCardViewModel @Inject constructor() : ViewModel() { + private val _uiState = MutableStateFlow(FlipFlashCardUiState()) + val uiState = _uiState.asStateFlow() + + private val _uiEvent = Channel() + val uiEvent = _uiEvent.receiveAsFlow() + + fun onEvent(event: FlipFlashCardUiEvent) { + when (event) { + else -> {} + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardScreen.kt new file mode 100644 index 0000000..f022311 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardScreen.kt @@ -0,0 +1,60 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.learn + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.hilt.navigation.compose.hiltViewModel +import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.navigation.DestinationsNavigator +import com.ramcosta.composedestinations.result.ResultBackNavigator + +@Destination +@Composable +fun LearnFlashCardScreen( + modifier: Modifier = Modifier, + resultNavigator: ResultBackNavigator, + navigator: DestinationsNavigator, + viewModel: LearnFlashCardViewModel = hiltViewModel() +) { + val uiState by viewModel.uiState.collectAsState() + LaunchedEffect(key1 = true) { + viewModel.uiEvent.collect { event -> + when (event) { + else -> {} + } + + } + } + LearnFlashCard(modifier = modifier) +} + +@Composable +fun LearnFlashCard(modifier: Modifier = Modifier) { + Scaffold { innerPadding -> + Column( + modifier = modifier.padding(innerPadding) + ) { + Text( + text = "LearnFlashCardScreen", + style = MaterialTheme.typography.bodyLarge + ) + } + } +} + +@Preview +@Composable +private fun LearnFlashCardScreenPreview() { + MaterialTheme { + LearnFlashCard() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiAction.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiAction.kt new file mode 100644 index 0000000..7dda53a --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiAction.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.learn + +sealed class LearnFlashCardUiAction { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiEvent.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiEvent.kt new file mode 100644 index 0000000..3011598 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiEvent.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.learn + +sealed class LearnFlashCardUiEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiState.kt new file mode 100644 index 0000000..0e4d041 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardUiState.kt @@ -0,0 +1,5 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.learn + +data class LearnFlashCardUiState( + val isLoading: Boolean = false, +) \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardViewModel.kt new file mode 100644 index 0000000..d6b30e0 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/learn/LearnFlashCardViewModel.kt @@ -0,0 +1,22 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.learn + +import androidx.lifecycle.ViewModel +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.receiveAsFlow +import javax.inject.Inject + +class LearnFlashCardViewModel @Inject constructor() : ViewModel() { + private val _uiState = MutableStateFlow(LearnFlashCardUiState()) + val uiState = _uiState.asStateFlow() + + private val _uiEvent = Channel() + val uiEvent = _uiEvent.receiveAsFlow() + + fun onEvent(event: LearnFlashCardUiEvent) { + when (event) { + else -> {} + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardScreen.kt new file mode 100644 index 0000000..e913025 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardScreen.kt @@ -0,0 +1,60 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.match + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.hilt.navigation.compose.hiltViewModel +import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.navigation.DestinationsNavigator +import com.ramcosta.composedestinations.result.ResultBackNavigator + +@Destination +@Composable +fun MatchFlashCardScreen( + modifier: Modifier = Modifier, + resultNavigator: ResultBackNavigator, + navigator: DestinationsNavigator, + viewModel: MatchFlashCardViewModel = hiltViewModel() +) { + val uiState by viewModel.uiState.collectAsState() + LaunchedEffect(key1 = true) { + viewModel.uiEvent.collect { event -> + when (event) { + else -> {} + } + + } + } + MatchFlashCard(modifier = modifier) +} + +@Composable +fun MatchFlashCard(modifier: Modifier = Modifier) { + Scaffold { innerPadding -> + Column( + modifier = modifier.padding(innerPadding) + ) { + Text( + text = "MatchFlashCardScreen", + style = MaterialTheme.typography.bodyLarge + ) + } + } +} + +@Preview +@Composable +private fun MatchFlashCardScreenPreview() { + MaterialTheme { + MatchFlashCard() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiAction.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiAction.kt new file mode 100644 index 0000000..a707ea8 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiAction.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.match + +sealed class MatchFlashCardUiAction { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiEvent.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiEvent.kt new file mode 100644 index 0000000..ab12d42 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiEvent.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.match + +sealed class MatchFlashCardUiEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiState.kt new file mode 100644 index 0000000..11ca067 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardUiState.kt @@ -0,0 +1,5 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.match + +data class MatchFlashCardUiState( + val isLoading: Boolean = false, +) \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardViewModel.kt new file mode 100644 index 0000000..21dd16d --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/match/MatchFlashCardViewModel.kt @@ -0,0 +1,22 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.match + +import androidx.lifecycle.ViewModel +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.receiveAsFlow +import javax.inject.Inject + +class MatchFlashCardViewModel @Inject constructor() : ViewModel() { + private val _uiState = MutableStateFlow(MatchFlashCardUiState()) + val uiState = _uiState.asStateFlow() + + private val _uiEvent = Channel() + val uiEvent = _uiEvent.receiveAsFlow() + + fun onEvent(event: MatchFlashCardUiEvent) { + when (event) { + else -> {} + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardScreen.kt new file mode 100644 index 0000000..09c6c04 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardScreen.kt @@ -0,0 +1,60 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.test + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.hilt.navigation.compose.hiltViewModel +import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.navigation.DestinationsNavigator +import com.ramcosta.composedestinations.result.ResultBackNavigator + +@Destination +@Composable +fun TestFlashCardScreen( + modifier: Modifier = Modifier, + resultNavigator: ResultBackNavigator, + navigator: DestinationsNavigator, + viewModel: TestFlashCardViewModel = hiltViewModel() +) { + val uiState by viewModel.uiState.collectAsState() + LaunchedEffect(key1 = true) { + viewModel.uiEvent.collect { event -> + when (event) { + else -> {} + } + + } + } + TestFlashCard(modifier = modifier) +} + +@Composable +fun TestFlashCard(modifier: Modifier = Modifier) { + Scaffold { innerPadding -> + Column( + modifier = modifier.padding(innerPadding) + ) { + Text( + text = "TestFlashCardScreen", + style = MaterialTheme.typography.bodyLarge + ) + } + } +} + +@Preview +@Composable +private fun TestFlashCardScreenPreview() { + MaterialTheme { + TestFlashCard() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiAction.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiAction.kt new file mode 100644 index 0000000..cb3894a --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiAction.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.test + +sealed class TestFlashCardUiAction { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiEvent.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiEvent.kt new file mode 100644 index 0000000..40ba599 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiEvent.kt @@ -0,0 +1,4 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.test + +sealed class TestFlashCardUiEvent { +} \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiState.kt new file mode 100644 index 0000000..e946f85 --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardUiState.kt @@ -0,0 +1,5 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.test + +data class TestFlashCardUiState( + val isLoading: Boolean = false, +) \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardViewModel.kt new file mode 100644 index 0000000..f4775fe --- /dev/null +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/study/test/TestFlashCardViewModel.kt @@ -0,0 +1,22 @@ +package com.pwhs.quickmem.presentation.app.study_set.study.test + +import androidx.lifecycle.ViewModel +import kotlinx.coroutines.channels.Channel +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.receiveAsFlow +import javax.inject.Inject + +class TestFlashCardViewModel @Inject constructor() : ViewModel() { + private val _uiState = MutableStateFlow(TestFlashCardUiState()) + val uiState = _uiState.asStateFlow() + + private val _uiEvent = Channel() + val uiEvent = _uiEvent.receiveAsFlow() + + fun onEvent(event: TestFlashCardUiEvent) { + when (event) { + else -> {} + } + } +} \ No newline at end of file