From 7d651fa03e268c41827a6f2fca967373541793eb Mon Sep 17 00:00:00 2001 From: Nguyen Quang Minh Date: Tue, 3 Dec 2024 00:22:38 +0700 Subject: [PATCH] =?UTF-8?q?feat(study=20set):=20chia=20nh=E1=BB=8F=20study?= =?UTF-8?q?=20set=20=C4=91=E1=BB=83=20h=E1=BB=8Dc=20nhanh=20h=C6=A1n=20-?= =?UTF-8?q?=20S=E1=BB=ADa=20c=C3=A1c=20l=E1=BB=97i=20giao=20di=E1=BB=87n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quickmem/core/data/enums/LearnMode.kt | 1 + .../pwhs/quickmem/data/remote/ApiService.kt | 6 +- .../repository/FlashCardRepositoryImpl.kt | 12 +- .../domain/repository/FlashCardRepository.kt | 6 +- .../app/folder/detail/FolderDetailScreen.kt | 3 +- .../study_set/detail/StudySetDetailScreen.kt | 139 +++++++++--------- .../detail/StudySetDetailUiAction.kt | 4 + .../study_set/detail/StudySetDetailUiEvent.kt | 4 + .../detail/StudySetDetailViewModel.kt | 49 +++++- .../detail/material/MaterialTabScreen.kt | 71 +++++---- .../studies/component/StudyTopAppBar.kt | 9 +- .../UnfinishedLearningBottomSheet.kt | 94 ++++++------ .../studies/flip/FlipFlashCardArgs.kt | 3 +- .../studies/flip/FlipFlashCardScreen.kt | 17 ++- .../studies/flip/FlipFlashCardUiState.kt | 1 + .../studies/flip/FlipFlashCardViewModel.kt | 15 +- .../flip/component/FlipFlashCardFinish.kt | 61 +++++--- .../study_set/studies/quiz/LearnByQuizArgs.kt | 1 + .../studies/quiz/LearnByQuizScreen.kt | 14 +- .../studies/quiz/LearnByQuizUiState.kt | 1 + .../studies/quiz/LearnByQuizViewModel.kt | 16 +- .../quiz/component/QuizFlashCardFinish.kt | 65 +++++--- .../true_false/LearnByTrueFalseArgs.kt | 1 + .../true_false/LearnByTrueFalseScreen.kt | 15 +- .../true_false/LearnByTrueFalseUiState.kt | 1 + .../true_false/LearnByTrueFalseViewModel.kt | 11 +- .../component/TrueFalseFlashcardFinish.kt | 51 ++++--- .../studies/write/LearnByWriteArgs.kt | 1 + .../studies/write/LearnByWriteScreen.kt | 16 +- .../studies/write/LearnByWriteUiState.kt | 1 + .../studies/write/LearnByWriteViewModel.kt | 23 +-- .../write/component/WriteFlashcardFinish.kt | 58 +++++--- app/src/main/res/values-vi/strings.xml | 11 ++ app/src/main/res/values/strings.xml | 11 ++ 34 files changed, 505 insertions(+), 287 deletions(-) diff --git a/app/src/main/java/com/pwhs/quickmem/core/data/enums/LearnMode.kt b/app/src/main/java/com/pwhs/quickmem/core/data/enums/LearnMode.kt index 90db94e2..1fd59869 100644 --- a/app/src/main/java/com/pwhs/quickmem/core/data/enums/LearnMode.kt +++ b/app/src/main/java/com/pwhs/quickmem/core/data/enums/LearnMode.kt @@ -1,6 +1,7 @@ package com.pwhs.quickmem.core.data.enums enum class LearnMode(val mode: String) { + NONE("none"), FLIP("flip"), QUIZ("quiz"), TRUE_FALSE("trueFalse"), diff --git a/app/src/main/java/com/pwhs/quickmem/data/remote/ApiService.kt b/app/src/main/java/com/pwhs/quickmem/data/remote/ApiService.kt index a1790c5a..868960c3 100644 --- a/app/src/main/java/com/pwhs/quickmem/data/remote/ApiService.kt +++ b/app/src/main/java/com/pwhs/quickmem/data/remote/ApiService.kt @@ -320,7 +320,8 @@ interface ApiService { suspend fun getFlashCardsByStudySetId( @Header("Authorization") token: String, @Path("id") id: String, - @Query("learnMode") learnMode: String + @Query("learnMode") learnMode: String, + @Query("isGetAll") isGetAll: Boolean ): List @POST("flashcard") @@ -388,7 +389,8 @@ interface ApiService { suspend fun getFlashCardsByFolderId( @Header("Authorization") token: String, @Path("id") id: String, - @Query("learnMode") learnMode: String + @Query("learnMode") learnMode: String, + @Query("isGetAll") isGetAll: Boolean ): List // Folder diff --git a/app/src/main/java/com/pwhs/quickmem/data/remote/repository/FlashCardRepositoryImpl.kt b/app/src/main/java/com/pwhs/quickmem/data/remote/repository/FlashCardRepositoryImpl.kt index 6abe158d..d2dd571c 100644 --- a/app/src/main/java/com/pwhs/quickmem/data/remote/repository/FlashCardRepositoryImpl.kt +++ b/app/src/main/java/com/pwhs/quickmem/data/remote/repository/FlashCardRepositoryImpl.kt @@ -241,7 +241,8 @@ class FlashCardRepositoryImpl @Inject constructor( override suspend fun getFlashCardsByStudySetId( token: String, studySetId: String, - learnMode: LearnMode + learnMode: LearnMode, + isGetAll: Boolean ): Flow>> { return flow { emit(Resources.Loading(true)) @@ -249,7 +250,8 @@ class FlashCardRepositoryImpl @Inject constructor( val response = apiService.getFlashCardsByStudySetId( token = token, id = studySetId, - learnMode = learnMode.mode + learnMode = learnMode.mode, + isGetAll = isGetAll ) emit(Resources.Success(response.map { it.toModel() })) } catch (e: HttpException) { @@ -265,7 +267,8 @@ class FlashCardRepositoryImpl @Inject constructor( override suspend fun getFlashCardsByFolderId( token: String, folderId: String, - learnMode: LearnMode + learnMode: LearnMode, + isGetAll: Boolean ): Flow>> { return flow { emit(Resources.Loading(true)) @@ -273,7 +276,8 @@ class FlashCardRepositoryImpl @Inject constructor( val response = apiService.getFlashCardsByFolderId( token = token, id = folderId, - learnMode = learnMode.mode + learnMode = learnMode.mode, + isGetAll = isGetAll ) emit(Resources.Success(response.map { it.toModel() })) } catch (e: HttpException) { diff --git a/app/src/main/java/com/pwhs/quickmem/domain/repository/FlashCardRepository.kt b/app/src/main/java/com/pwhs/quickmem/domain/repository/FlashCardRepository.kt index 5bd4c8db..29b31d01 100644 --- a/app/src/main/java/com/pwhs/quickmem/domain/repository/FlashCardRepository.kt +++ b/app/src/main/java/com/pwhs/quickmem/domain/repository/FlashCardRepository.kt @@ -64,12 +64,14 @@ interface FlashCardRepository { suspend fun getFlashCardsByStudySetId( token: String, studySetId: String, - learnMode: LearnMode + learnMode: LearnMode, + isGetAll: Boolean ): Flow>> suspend fun getFlashCardsByFolderId( token: String, folderId: String, - learnMode: LearnMode + learnMode: LearnMode, + isGetAll: Boolean ): Flow>> } \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/FolderDetailScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/FolderDetailScreen.kt index 0b89d31a..17b8464a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/FolderDetailScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/folder/detail/FolderDetailScreen.kt @@ -161,7 +161,8 @@ fun FolderDetailScreen( studySetColorId = 0, studySetSubjectId = 0, folderId = uiState.id, - learnFrom = LearnFrom.FOLDER + learnFrom = LearnFrom.FOLDER, + isGetAll = true ) ) }, 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 d31aed3c..61bd1772 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 @@ -38,6 +38,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import com.pwhs.quickmem.R import com.pwhs.quickmem.core.data.enums.FlipCardStatus import com.pwhs.quickmem.core.data.enums.LearnFrom +import com.pwhs.quickmem.core.data.enums.LearnMode import com.pwhs.quickmem.core.data.enums.QuizStatus import com.pwhs.quickmem.core.data.enums.TrueFalseStatus import com.pwhs.quickmem.core.data.enums.WriteStatus @@ -172,15 +173,15 @@ fun StudySetDetailScreen( LaunchedEffect(key1 = true) { viewModel.uiEvent.collect { event -> when (event) { - StudySetDetailUiEvent.FlashCardDeleted -> { + is StudySetDetailUiEvent.FlashCardDeleted -> { viewModel.onEvent(StudySetDetailUiAction.Refresh) } - StudySetDetailUiEvent.FlashCardStarred -> { + is StudySetDetailUiEvent.FlashCardStarred -> { viewModel.onEvent(StudySetDetailUiAction.Refresh) } - StudySetDetailUiEvent.NavigateToEditStudySet -> { + is StudySetDetailUiEvent.NavigateToEditStudySet -> { navigator.navigate( EditStudySetScreenDestination( studySetId = uiState.id, @@ -193,7 +194,7 @@ fun StudySetDetailScreen( ) } - StudySetDetailUiEvent.NavigateToEditFlashCard -> { + is StudySetDetailUiEvent.NavigateToEditFlashCard -> { val flashCard = uiState.flashCards.find { it.id == uiState.idOfFlashCardSelected } navigator.navigate( @@ -208,12 +209,12 @@ fun StudySetDetailScreen( ) } - StudySetDetailUiEvent.StudySetDeleted -> { + is StudySetDetailUiEvent.StudySetDeleted -> { resultNavigator.setResult(true) navigator.navigateUp() } - StudySetDetailUiEvent.StudySetProgressReset -> { + is StudySetDetailUiEvent.StudySetProgressReset -> { viewModel.onEvent(StudySetDetailUiAction.Refresh) } @@ -225,6 +226,60 @@ fun StudySetDetailScreen( ) ) } + + is StudySetDetailUiEvent.OnNavigateToFlipFlashcard -> { + navigator.navigate( + FlipFlashCardScreenDestination( + studySetId = uiState.id, + studySetTitle = uiState.title, + studySetDescription = uiState.description, + studySetColorId = uiState.colorModel.id, + studySetSubjectId = uiState.subject.id, + folderId = "", + learnFrom = LearnFrom.STUDY_SET, + isGetAll = event.isGetAll + ) + ) + } + + is StudySetDetailUiEvent.OnNavigateToQuiz -> { + navigator.navigate( + LearnByQuizScreenDestination( + studySetId = uiState.id, + studySetTitle = uiState.title, + studySetDescription = uiState.description, + studySetColorId = uiState.colorModel.id, + studySetSubjectId = uiState.subject.id, + isGetAll = event.isGetAll + ) + ) + } + + is StudySetDetailUiEvent.OnNavigateToTrueFalse -> { + navigator.navigate( + LearnByTrueFalseScreenDestination( + studySetId = uiState.id, + studySetTitle = uiState.title, + studySetDescription = uiState.description, + studySetColorId = uiState.colorModel.id, + studySetSubjectId = uiState.subject.id, + isGetAll = event.isGetAll + ) + ) + } + + is StudySetDetailUiEvent.OnNavigateToWrite -> { + navigator.navigate( + LearnByWriteScreenDestination( + studySetId = uiState.id, + studySetTitle = uiState.title, + studySetDescription = uiState.description, + studySetColorId = uiState.colorModel.id, + studySetSubjectId = uiState.subject.id, + isGetAll = event.isGetAll + ) + ) + } } } } @@ -299,52 +354,6 @@ fun StudySetDetailScreen( viewModel.onEvent(StudySetDetailUiAction.OnResetProgressClicked(uiState.id)) }, isAIGenerated = uiState.isAIGenerated, - onNavigateToQuiz = { - navigator.navigate( - LearnByQuizScreenDestination( - studySetId = uiState.id, - studySetTitle = uiState.title, - studySetDescription = uiState.description, - studySetColorId = uiState.colorModel.id, - studySetSubjectId = uiState.subject.id, - ) - ) - }, - onNavigateToTrueFalse = { - navigator.navigate( - LearnByTrueFalseScreenDestination( - studySetId = uiState.id, - studySetTitle = uiState.title, - studySetDescription = uiState.description, - studySetColorId = uiState.colorModel.id, - studySetSubjectId = uiState.subject.id, - ) - ) - }, - onNavigateToWrite = { - navigator.navigate( - LearnByWriteScreenDestination( - studySetId = uiState.id, - studySetTitle = uiState.title, - studySetDescription = uiState.description, - studySetColorId = uiState.colorModel.id, - studySetSubjectId = uiState.subject.id, - ) - ) - }, - onNavigateToFlip = { - navigator.navigate( - FlipFlashCardScreenDestination( - studySetId = uiState.id, - studySetTitle = uiState.title, - studySetDescription = uiState.description, - studySetColorId = uiState.colorModel.id, - studySetSubjectId = uiState.subject.id, - folderId = "", - learnFrom = LearnFrom.STUDY_SET - ) - ) - }, onRefresh = { viewModel.onEvent(StudySetDetailUiAction.Refresh) }, @@ -367,7 +376,10 @@ fun StudySetDetailScreen( username = uiState.user.username ) ) - } + }, + onNavigateToLearn = { learnMode, isGetAll -> + viewModel.onEvent(StudySetDetailUiAction.NavigateToLearn(learnMode, isGetAll)) + }, ) } @@ -397,14 +409,11 @@ fun StudySetDetail( onAddToFolder: () -> Unit = {}, onDeleteStudySet: () -> Unit = {}, onResetProgress: () -> Unit = {}, - onNavigateToQuiz: () -> Unit = {}, - onNavigateToTrueFalse: () -> Unit = {}, - onNavigateToWrite: () -> Unit = {}, - onNavigateToFlip: () -> Unit = {}, onRefresh: () -> Unit = {}, onNavigateToUserDetail: () -> Unit = {}, onCopyStudySet: () -> Unit = {}, - onReportClick: () -> Unit = {} + onReportClick: () -> Unit = {}, + onNavigateToLearn: (LearnMode, Boolean) -> Unit = { _, _ -> }, ) { val context = LocalContext.current var tabIndex by rememberSaveable { mutableIntStateOf(0) } @@ -498,17 +507,14 @@ fun StudySetDetail( onToggleStarClick = onToggleStarredFlashCard, onEditFlashCardClick = onEditFlashCard, onAddFlashCardClick = onAddFlashcard, - onNavigateToQuiz = onNavigateToQuiz, - onNavigateToTrueFalse = onNavigateToTrueFalse, - onNavigateToWrite = onNavigateToWrite, - onNavigateToFlip = onNavigateToFlip, + onNavigateToLearn = onNavigateToLearn, isOwner = true, studySetColor = color, learningPercentQuiz = if (flashCardCount > 0) (flashCards.count { it.quizStatus == QuizStatus.CORRECT.status } * 100 / flashCardCount) else 0, learningPercentFlipped = if (flashCardCount > 0) (flashCards.count { it.flipStatus == FlipCardStatus.KNOW.name } * 100 / flashCardCount) else 0, learningPercentWrite = if (flashCardCount > 0) (flashCards.count { it.writeStatus == WriteStatus.CORRECT.status } * 100 / flashCardCount) else 0, learningPercentTrueFalse = if (flashCardCount > 0) (flashCards.count { it.trueFalseStatus == TrueFalseStatus.CORRECT.status } * 100 / flashCardCount) else 0, - onMakeCopyClick = onCopyStudySet + onMakeCopyClick = onCopyStudySet, ) StudySetDetailEnum.PROGRESS.index -> ProgressTabScreen( @@ -530,13 +536,10 @@ fun StudySetDetail( onToggleStarClick = onToggleStarredFlashCard, onEditFlashCardClick = onEditFlashCard, onAddFlashCardClick = onAddFlashcard, - onNavigateToQuiz = onNavigateToQuiz, - onNavigateToTrueFalse = onNavigateToTrueFalse, - onNavigateToWrite = onNavigateToWrite, - onNavigateToFlip = onNavigateToFlip, + onNavigateToLearn = onNavigateToLearn, isOwner = false, onMakeCopyClick = onCopyStudySet, - studySetColor = color + studySetColor = color, ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiAction.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiAction.kt index cbf07168..aabfba86 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiAction.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiAction.kt @@ -1,5 +1,7 @@ package com.pwhs.quickmem.presentation.app.study_set.detail +import com.pwhs.quickmem.core.data.enums.LearnMode + sealed class StudySetDetailUiAction { data object Refresh : StudySetDetailUiAction() data class OnIdOfFlashCardSelectedChanged(val id: String) : StudySetDetailUiAction() @@ -12,4 +14,6 @@ sealed class StudySetDetailUiAction { data object OnDeleteStudySetClicked : StudySetDetailUiAction() data class OnResetProgressClicked(val id: String) : StudySetDetailUiAction() data object OnMakeCopyClicked : StudySetDetailUiAction() + data class NavigateToLearn(val learnMode: LearnMode, val isGetAll: Boolean) : + StudySetDetailUiAction() } \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiEvent.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiEvent.kt index d229356f..c12fb652 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiEvent.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailUiEvent.kt @@ -8,4 +8,8 @@ sealed class StudySetDetailUiEvent { data object StudySetDeleted : StudySetDetailUiEvent() data object StudySetProgressReset : StudySetDetailUiEvent() data class StudySetCopied(val newStudySetId: String) : StudySetDetailUiEvent() + data class OnNavigateToFlipFlashcard(val isGetAll: Boolean) : StudySetDetailUiEvent() + data class OnNavigateToQuiz(val isGetAll: Boolean) : StudySetDetailUiEvent() + data class OnNavigateToTrueFalse(val isGetAll: Boolean) : StudySetDetailUiEvent() + data class OnNavigateToWrite(val isGetAll: Boolean) : StudySetDetailUiEvent() } \ No newline at end of file diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailViewModel.kt index 9efa72a0..7c485d4c 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/detail/StudySetDetailViewModel.kt @@ -3,6 +3,7 @@ package com.pwhs.quickmem.presentation.app.study_set.detail import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.pwhs.quickmem.core.data.enums.LearnMode import com.pwhs.quickmem.core.data.enums.ResetType import com.pwhs.quickmem.core.datastore.AppManager import com.pwhs.quickmem.core.datastore.TokenManager @@ -60,7 +61,7 @@ class StudySetDetailViewModel @Inject constructor( _uiState.update { it.copy(idOfFlashCardSelected = event.id) } } - StudySetDetailUiAction.OnDeleteFlashCardClicked -> { + is StudySetDetailUiAction.OnDeleteFlashCardClicked -> { deleteFlashCard() } @@ -68,15 +69,15 @@ class StudySetDetailViewModel @Inject constructor( toggleStarredFlashCard(event.id, event.isStarred) } - StudySetDetailUiAction.OnEditStudySetClicked -> { + is StudySetDetailUiAction.OnEditStudySetClicked -> { _uiEvent.trySend(StudySetDetailUiEvent.NavigateToEditStudySet) } - StudySetDetailUiAction.OnEditFlashCardClicked -> { + is StudySetDetailUiAction.OnEditFlashCardClicked -> { _uiEvent.trySend(StudySetDetailUiEvent.NavigateToEditFlashCard) } - StudySetDetailUiAction.OnDeleteStudySetClicked -> { + is StudySetDetailUiAction.OnDeleteStudySetClicked -> { deleteStudySet() } @@ -84,9 +85,33 @@ class StudySetDetailViewModel @Inject constructor( resetProgress(event.id) } - StudySetDetailUiAction.OnMakeCopyClicked -> { + is StudySetDetailUiAction.OnMakeCopyClicked -> { makeCopyStudySet() } + + is StudySetDetailUiAction.NavigateToLearn -> { + when (event.learnMode) { + LearnMode.FLIP -> { + _uiEvent.trySend(StudySetDetailUiEvent.OnNavigateToFlipFlashcard(event.isGetAll)) + } + + LearnMode.QUIZ -> { + _uiEvent.trySend(StudySetDetailUiEvent.OnNavigateToQuiz(event.isGetAll)) + } + + LearnMode.TRUE_FALSE -> { + _uiEvent.trySend(StudySetDetailUiEvent.OnNavigateToTrueFalse(event.isGetAll)) + } + + LearnMode.WRITE -> { + _uiEvent.trySend(StudySetDetailUiEvent.OnNavigateToWrite(event.isGetAll)) + } + + else -> { + // Do nothing + } + } + } } } @@ -101,7 +126,8 @@ class StudySetDetailViewModel @Inject constructor( } is Resources.Success -> { - val isOwner = appManager.userId.firstOrNull() == resource.data!!.owner.id + val isOwner = + appManager.userId.firstOrNull() == resource.data!!.owner.id _uiState.update { it.copy( title = resource.data.title, @@ -140,7 +166,10 @@ class StudySetDetailViewModel @Inject constructor( userId = userId, studySetId = studySetId ) - studySetRepository.saveRecentAccessStudySet(token, saveRecentAccessStudySetRequestModel) + studySetRepository.saveRecentAccessStudySet( + token, + saveRecentAccessStudySetRequestModel + ) .collect { resource -> when (resource) { is Resources.Loading -> { @@ -267,7 +296,11 @@ class StudySetDetailViewModel @Inject constructor( is Resources.Success -> { _uiState.update { it.copy(isLoading = false) } - _uiEvent.send(StudySetDetailUiEvent.StudySetCopied(resource.data?.id ?: "")) + _uiEvent.send( + StudySetDetailUiEvent.StudySetCopied( + resource.data?.id ?: "" + ) + ) } is Resources.Error -> { 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 cce18f84..266ef185 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 @@ -2,14 +2,12 @@ package com.pwhs.quickmem.presentation.app.study_set.detail.material import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement.SpaceBetween -import androidx.compose.foundation.layout.Arrangement.spacedBy import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items @@ -18,7 +16,6 @@ import androidx.compose.material.icons.Icons.AutoMirrored.Filled import androidx.compose.material.icons.Icons.Default import androidx.compose.material.icons.Icons.Outlined import androidx.compose.material.icons.automirrored.filled.HelpOutline -import androidx.compose.material.icons.automirrored.filled.Sort import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.DeleteOutline import androidx.compose.material.icons.outlined.Edit @@ -49,6 +46,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.pwhs.quickmem.R +import com.pwhs.quickmem.core.data.enums.LearnMode import com.pwhs.quickmem.domain.model.color.ColorModel import com.pwhs.quickmem.domain.model.flashcard.StudySetFlashCardResponseModel import com.pwhs.quickmem.presentation.app.study_set.detail.component.ItemMenuBottomSheet @@ -67,16 +65,13 @@ fun MaterialTabScreen( onEditFlashCardClick: () -> Unit = {}, onToggleStarClick: (String, Boolean) -> Unit = { _, _ -> }, onAddFlashCardClick: () -> Unit = {}, - onNavigateToQuiz: () -> Unit = {}, - onNavigateToTrueFalse: () -> Unit = {}, - onNavigateToWrite: () -> Unit = {}, - onNavigateToFlip: () -> Unit = {}, onMakeCopyClick: () -> Unit = {}, studySetColor: Color = ColorModel.defaultColors.first().hexValue.toColor(), learningPercentFlipped: Int = 0, learningPercentQuiz: Int = 0, learningPercentTrueFalse: Int = 0, learningPercentWrite: Int = 0, + onNavigateToLearn: (LearnMode, Boolean) -> Unit = { _, _ -> }, ) { val menuBottomSheetState = rememberModalBottomSheetState() var showMenu by remember { mutableStateOf(false) } @@ -88,6 +83,8 @@ fun MaterialTabScreen( var showExplanation by remember { mutableStateOf(false) } var hint by remember { mutableStateOf("") } var explanation by remember { mutableStateOf("") } + var showGetAllDialog by remember { mutableStateOf(false) } + var learningMode by remember { mutableStateOf(LearnMode.NONE) } Scaffold { innerPadding -> Box( @@ -188,7 +185,7 @@ fun MaterialTabScreen( LazyRow( modifier = Modifier.fillMaxWidth(), ) { - items(items = flashCards, key = {it.id}) { flashCard -> + items(items = flashCards, key = { it.id }) { flashCard -> StudySetFlipCard( frontText = flashCard.term, backText = flashCard.definition, @@ -214,7 +211,10 @@ fun MaterialTabScreen( LearnModeCard( title = stringResource(R.string.txt_flip_flashcards), icon = R.drawable.ic_flipcard, - onClick = onNavigateToFlip, + onClick = { + showGetAllDialog = true + learningMode = LearnMode.FLIP + }, color = studySetColor, learningPercentage = learningPercentFlipped ) @@ -223,7 +223,10 @@ fun MaterialTabScreen( LearnModeCard( title = stringResource(R.string.txt_quiz), icon = R.drawable.ic_quiz, - onClick = onNavigateToQuiz, + onClick = { + showGetAllDialog = true + learningMode = LearnMode.QUIZ + }, color = studySetColor, learningPercentage = learningPercentQuiz ) @@ -232,7 +235,10 @@ fun MaterialTabScreen( LearnModeCard( title = stringResource(R.string.txt_true_false), icon = R.drawable.ic_tf, - onClick = onNavigateToTrueFalse, + onClick = { + showGetAllDialog = true + learningMode = LearnMode.TRUE_FALSE + }, color = studySetColor, learningPercentage = learningPercentTrueFalse ) @@ -241,7 +247,10 @@ fun MaterialTabScreen( LearnModeCard( title = stringResource(R.string.txt_write), icon = R.drawable.ic_write, - onClick = onNavigateToWrite, + onClick = { + showGetAllDialog = true + learningMode = LearnMode.WRITE + }, color = studySetColor, learningPercentage = learningPercentWrite ) @@ -262,25 +271,12 @@ fun MaterialTabScreen( color = colorScheme.onSurface, fontWeight = Bold ), + modifier = Modifier.weight(1f) ) - - Row( - horizontalArrangement = spacedBy(5.dp), - verticalAlignment = CenterVertically - ) { - Text( - text = stringResource(R.string.txt_original) - ) - Icon( - imageVector = Filled.Sort, - contentDescription = stringResource(R.string.txt_sort), - modifier = Modifier.size(24.dp) - ) - } } } - items(items = flashCards, key = {it.id}) { flashCards -> + items(items = flashCards, key = { it.id }) { flashCards -> CardDetail( isOwner = isOwner, color = studySetColor, @@ -427,6 +423,27 @@ fun MaterialTabScreen( buttonColor = colorScheme.error, ) } + if (showGetAllDialog && flashCards.size > 10) { + QuickMemAlertDialog( + onDismissRequest = { + showGetAllDialog = false + onNavigateToLearn(learningMode, true) + learningMode = LearnMode.NONE + }, + onConfirm = { + showGetAllDialog = false + onNavigateToLearn(learningMode, false) + learningMode = LearnMode.NONE + }, + title = stringResource(R.string.txt_get_all), + text = stringResource(R.string.txt_are_you_sure_you_want_to_get_all_flashcards), + confirmButtonTitle = stringResource(R.string.txt_ok), + dismissButtonTitle = stringResource(R.string.txt_no_thanks), + ) + } else { + onNavigateToLearn(learningMode, true) + learningMode = LearnMode.NONE + } } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt index 3b72c4db..a7902f5b 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/StudyTopAppBar.kt @@ -26,13 +26,16 @@ fun StudyTopAppBar( onBackClicked: () -> Unit, isEnOfSet: Boolean = false, onRestartClicked: () -> Unit = {}, - shouldShowRestart: Boolean = true + shouldShowRestart: Boolean = true, + isGetAll: Boolean = false, ) { CenterAlignedTopAppBar( modifier = modifier, title = { Text( - text = if (isEnOfSet) stringResource(R.string.txt_congratulations) else "Card $currentCardIndex of $totalCards", + text = if (isEnOfSet) stringResource(R.string.txt_congratulations) else stringResource( + R.string.txt_title_learn_flashcard, currentCardIndex, totalCards + ), style = typography.titleMedium.copy( fontWeight = FontWeight.Bold, ) @@ -49,7 +52,7 @@ fun StudyTopAppBar( } }, actions = { - if (shouldShowRestart) { + if (shouldShowRestart && isGetAll) { IconButton( onClick = onRestartClicked ) { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt index c4d83334..d1f45873 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/component/UnfinishedLearningBottomSheet.kt @@ -10,15 +10,18 @@ import androidx.compose.material3.MaterialTheme.colorScheme import androidx.compose.material3.MaterialTheme.shapes import androidx.compose.material3.MaterialTheme.typography import androidx.compose.material3.ModalBottomSheet -import androidx.compose.material3.OutlinedButton import androidx.compose.material3.SheetState import androidx.compose.material3.Text -import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import com.pwhs.quickmem.R @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -27,57 +30,56 @@ fun UnfinishedLearningBottomSheet( onDismissRequest: () -> Unit = {}, onKeepLearningClick: () -> Unit = {}, onEndSessionClick: () -> Unit = {}, - showUnfinishedLearningBottomSheet: Boolean = false, - sheetShowMoreState: SheetState = rememberModalBottomSheetState(), + sheetState: SheetState, ) { - if (showUnfinishedLearningBottomSheet) { - ModalBottomSheet( - modifier = modifier, - onDismissRequest = onDismissRequest, - sheetState = sheetShowMoreState + ModalBottomSheet( + modifier = modifier, + onDismissRequest = onDismissRequest, + sheetState = sheetState + ) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + horizontalAlignment = Alignment.CenterHorizontally ) { - Column( + Text( + text = stringResource(R.string.txt_wait_don_t_go_yet_you_ll_miss_out_on_completing_this_study_set), + style = typography.titleLarge, + textAlign = TextAlign.Center, + modifier = Modifier.padding(bottom = 16.dp) + ) + Button( + onClick = onKeepLearningClick, modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - horizontalAlignment = Alignment.CenterHorizontally + .fillMaxWidth(), + shape = shapes.medium ) { Text( - text = "Wait, don't go yet! You'll miss out on completing this study set!", - style = typography.titleLarge, - modifier = Modifier.padding(bottom = 16.dp) - ) - Button( - onClick = onKeepLearningClick, - modifier = Modifier - .fillMaxWidth(), - shape = shapes.medium - ) { - Text( - text = "Keep Learning", - style = typography.bodyMedium.copy( - fontWeight = FontWeight.Bold - ) + text = stringResource(R.string.txt_keep_learning), + style = typography.bodyMedium.copy( + fontWeight = FontWeight.Bold ) - } - OutlinedButton( - onClick = onEndSessionClick, - colors = ButtonDefaults.outlinedButtonColors( - contentColor = colorScheme.onSurface.copy(alpha = 0.6f) - ), - modifier = Modifier - .padding(top = 4.dp) - .fillMaxWidth(), - shape = shapes.medium - ) { - Text( - text = "End Session", - style = typography.bodyMedium.copy( - fontWeight = FontWeight.Bold - ) + ) + } + TextButton( + onClick = onEndSessionClick, + colors = ButtonDefaults.outlinedButtonColors( + contentColor = colorScheme.primary, + containerColor = Color.Transparent + ), + modifier = Modifier + .padding(top = 4.dp) + .fillMaxWidth(), + shape = shapes.medium + ) { + Text( + text = stringResource(R.string.txt_end_session), + style = typography.bodyMedium.copy( + fontWeight = FontWeight.Bold ) - } + ) } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardArgs.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardArgs.kt index 61841a2a..c20bf68d 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardArgs.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardArgs.kt @@ -9,5 +9,6 @@ data class FlipFlashCardArgs( val studySetColorId: Int, val studySetSubjectId: Int, val folderId: String, - val learnFrom: LearnFrom + val learnFrom: LearnFrom, + val isGetAll: Boolean, ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt index df4fa4d8..290a09cf 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardScreen.kt @@ -127,7 +127,8 @@ fun FlipFlashCardScreen( }, onContinueLearningClicked = { viewModel.onEvent(FlipFlashCardUiAction.OnContinueLearningClicked) - } + }, + isGetAll = uiState.isGetAll ) } @@ -152,7 +153,8 @@ fun FlipFlashCard( onUpdateCountKnown: (Boolean, String) -> Unit = { _, _ -> }, onUpdateCountStillLearning: (Boolean, String) -> Unit = { _, _ -> }, onRestartClicked: () -> Unit = { }, - onContinueLearningClicked: () -> Unit = { } + onContinueLearningClicked: () -> Unit = { }, + isGetAll: Boolean = false ) { var showHintBottomSheet by remember { mutableStateOf(false) @@ -163,6 +165,7 @@ fun FlipFlashCard( val hintBottomSheetState = rememberModalBottomSheetState() val explanationBottomSheetState = rememberModalBottomSheetState() var showUnfinishedLearningBottomSheet by remember { mutableStateOf(false) } + val unFinishedLearningBottomSheetState = rememberModalBottomSheetState() val stillLearningColor = Color(0xffd05700) val knownColor = Color(0xff18ae79) val stackState = rememberStackState() @@ -198,7 +201,8 @@ fun FlipFlashCard( onRestartClicked() stackState.reset() }, - shouldShowRestart = !isEndOfList + shouldShowRestart = !isEndOfList, + isGetAll = isGetAll ) } ) { innerPadding -> @@ -351,7 +355,8 @@ fun FlipFlashCard( onRestartClicked = { onRestartClicked() stackState.reset() - } + }, + isGetAll = isGetAll ) } } @@ -438,7 +443,6 @@ fun FlipFlashCard( if (showUnfinishedLearningBottomSheet) { UnfinishedLearningBottomSheet( - showUnfinishedLearningBottomSheet = showUnfinishedLearningBottomSheet, onDismissRequest = { showUnfinishedLearningBottomSheet = false }, @@ -448,7 +452,8 @@ fun FlipFlashCard( onEndSessionClick = { onEndSessionClick() showUnfinishedLearningBottomSheet = false - } + }, + sheetState = unFinishedLearningBottomSheetState ) } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardUiState.kt index 4a054a28..8efbae60 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardUiState.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardUiState.kt @@ -7,6 +7,7 @@ import com.pwhs.quickmem.domain.model.subject.SubjectModel data class FlipFlashCardUiState( val isLoading: Boolean = false, + val isGetAll: Boolean = false, val learnFrom: LearnFrom = LearnFrom.STUDY_SET, val folderId: String = "", val studySetId: String = "", diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardViewModel.kt index 71f94d25..c55b89ae 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/FlipFlashCardViewModel.kt @@ -52,6 +52,8 @@ class FlipFlashCardViewModel @Inject constructor( init { val studySetId = savedStateHandle.get("studySetId") ?: "" + val isGetAll = savedStateHandle.get("isGetAll") ?: false + Timber.d("isGetAll: $isGetAll") val studySetTitle = savedStateHandle.get("studySetTitle") ?: "" val studySetDescription = savedStateHandle.get("studySetDescription") ?: "" val studySetColorId = savedStateHandle.get("studySetColorId") ?: 0 @@ -61,6 +63,7 @@ class FlipFlashCardViewModel @Inject constructor( _uiState.update { it.copy( learnFrom = learnFrom, + isGetAll = isGetAll, folderId = folderId, studySetId = studySetId, studySetTitle = studySetTitle, @@ -137,7 +140,6 @@ class FlipFlashCardViewModel @Inject constructor( } is FlipFlashCardUiAction.OnUpdateCountStillLearning -> { - Timber.d("OnUpdateCountStillLearninggggg") if (event.isIncrease) { _uiState.update { it.copy( @@ -184,7 +186,9 @@ class FlipFlashCardViewModel @Inject constructor( learningTime = System.currentTimeMillis() - it.startTime ) } - sendCompletedStudyTime() + if (!_uiState.value.isEndOfList) { + sendCompletedStudyTime() + } _uiEvent.trySend(FlipFlashCardUiEvent.Back) } } @@ -196,12 +200,14 @@ class FlipFlashCardViewModel @Inject constructor( val studySetId = _uiState.value.studySetId val folderId = _uiState.value.folderId val learnFrom = _uiState.value.learnFrom + val isGetAll = _uiState.value.isGetAll when (learnFrom) { LearnFrom.STUDY_SET -> { flashCardRepository.getFlashCardsByStudySetId( token = token, studySetId = studySetId, - learnMode = LearnMode.FLIP + learnMode = LearnMode.FLIP, + isGetAll = isGetAll ).collect { resource -> when (resource) { is Resources.Error -> { @@ -239,7 +245,8 @@ class FlipFlashCardViewModel @Inject constructor( flashCardRepository.getFlashCardsByFolderId( token = token, folderId = folderId, - learnMode = LearnMode.FLIP + learnMode = LearnMode.FLIP, + isGetAll = isGetAll ).collect { resource -> when (resource) { is Resources.Error -> { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt index 9007bed1..5c132a25 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/flip/component/FlipFlashCardFinish.kt @@ -54,6 +54,7 @@ fun FlipFlashCardFinish( learningTime: Long, onContinueLearningClicked: () -> Unit, onRestartClicked: () -> Unit, + isGetAll: Boolean ) { val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.confetti)) val progress by animateLottieCompositionAsState( @@ -230,10 +231,17 @@ fun FlipFlashCardFinish( border = BorderStroke(1.dp, studySetColor) ) { Text( - text = stringResource( - R.string.txt_keep_reviewing_terms_flip, - countStillLearning - ), + text = when (isGetAll) { + true -> stringResource( + R.string.txt_keep_reviewing_terms_flip, + countStillLearning + ) + + false -> stringResource( + R.string.txt_keep_learning_terms_flip, + countStillLearning + ) + }, style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, fontWeight = FontWeight.Bold @@ -244,27 +252,38 @@ fun FlipFlashCardFinish( } } item { - Button( - onClick = { - onRestartClicked() - }, - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - shape = MaterialTheme.shapes.small, - colors = ButtonDefaults.buttonColors( - containerColor = Color.Transparent, - contentColor = studySetColor - ), - border = BorderStroke(1.dp, studySetColor) - ) { + if (isGetAll) { + Button( + onClick = { + onRestartClicked() + }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), + shape = MaterialTheme.shapes.small, + colors = ButtonDefaults.buttonColors( + containerColor = Color.Transparent, + contentColor = studySetColor + ), + border = BorderStroke(1.dp, studySetColor) + ) { + Text( + text = stringResource(R.string.txt_restart_flashcards), + style = MaterialTheme.typography.bodyMedium.copy( + fontSize = 18.sp, + fontWeight = FontWeight.Bold + ), + modifier = Modifier.padding(8.dp) + ) + } + } else { Text( - text = stringResource(R.string.txt_restart_flashcards), + text = stringResource(R.string.txt_you_have_finished_this_section_of_study_set), style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, - fontWeight = FontWeight.Bold ), - modifier = Modifier.padding(8.dp) + textAlign = TextAlign.Center, + modifier = Modifier.padding(16.dp) ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizArgs.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizArgs.kt index 99492ef9..88b21cc5 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizArgs.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizArgs.kt @@ -6,4 +6,5 @@ data class LearnByQuizArgs( val studySetDescription: String, val studySetColorId: Int, val studySetSubjectId: Int, + val isGetAll: Boolean, ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt index b447f4d5..5dfeeaa1 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizScreen.kt @@ -115,7 +115,8 @@ fun LearnByQuizScreen( }, onRestartClicked = { viewModel.onEvent(LearnByQuizUiAction.RestartLearn) - } + }, + isGetAll = uiState.isGetAll ) } @@ -137,12 +138,14 @@ fun LearnByQuiz( flashCard: FlashCardResponseModel? = null, isEndOfList: Boolean = false, onContinueLearningClicked: () -> Unit = {}, - onRestartClicked: () -> Unit = {} + onRestartClicked: () -> Unit = {}, + isGetAll: Boolean = false ) { var canResetState by remember { mutableStateOf(false) } val showHintBottomSheet = remember { mutableStateOf(false) } val hintBottomSheetState = rememberModalBottomSheetState() var showUnfinishedLearningBottomSheet by remember { mutableStateOf(false) } + val unFinishedLearningBottomSheetState = rememberModalBottomSheetState() var selectedAnswer by remember { mutableStateOf(null) } val scope = rememberCoroutineScope() var debounceJob: Job? = null @@ -175,7 +178,7 @@ fun LearnByQuiz( } }, actions = { - if (!isEndOfList) { + if (!isEndOfList && isGetAll) { if (!flashCard?.hint.isNullOrEmpty()) { IconButton( onClick = { @@ -285,6 +288,7 @@ fun LearnByQuiz( onRestartClicked() }, listWrongAnswer = listWrongAnswer, + isGetAll = isGetAll ) } } @@ -319,7 +323,6 @@ fun LearnByQuiz( if (showUnfinishedLearningBottomSheet) { UnfinishedLearningBottomSheet( - showUnfinishedLearningBottomSheet = showUnfinishedLearningBottomSheet, onDismissRequest = { showUnfinishedLearningBottomSheet = false }, @@ -329,7 +332,8 @@ fun LearnByQuiz( onEndSessionClick = { onEndSessionClick() showUnfinishedLearningBottomSheet = false - } + }, + sheetState = unFinishedLearningBottomSheetState ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizUiState.kt index a58f313a..78cda5a0 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizUiState.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizUiState.kt @@ -8,6 +8,7 @@ import com.pwhs.quickmem.domain.model.subject.SubjectModel data class LearnFlashCardUiState( val isLoading: Boolean = false, + val isGetAll: Boolean = false, val studySetId: String = "", val studySetTitle: String = "", val studySetDescription: String = "", diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt index 6b1351fa..274f7bd0 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/LearnByQuizViewModel.kt @@ -83,8 +83,7 @@ class LearnByQuizViewModel @Inject constructor( event.userAnswer ) - LearnByQuizUiAction.ContinueLearnWrongAnswer -> { - // reset all state + is LearnByQuizUiAction.ContinueLearnWrongAnswer -> { _uiState.update { it.copy( currentCardIndex = 0, @@ -98,7 +97,7 @@ class LearnByQuizViewModel @Inject constructor( getFlashCard() } - LearnByQuizUiAction.RestartLearn -> { + is LearnByQuizUiAction.RestartLearn -> { onRestart() } @@ -106,7 +105,9 @@ class LearnByQuizViewModel @Inject constructor( _uiState.update { it.copy(learningTime = System.currentTimeMillis() - it.startTime) } - sendCompletedStudyTime() + if (!_uiState.value.isEndOfList) { + sendCompletedStudyTime() + } _uiEvent.trySend(LearnByQuizUiEvent.Back) } } @@ -115,10 +116,13 @@ class LearnByQuizViewModel @Inject constructor( private fun getFlashCard() { viewModelScope.launch { val token = tokenManager.accessToken.firstOrNull() ?: "" + val studySetId = _uiState.value.studySetId + val isGetAll = _uiState.value.isEndOfList flashCardRepository.getFlashCardsByStudySetId( token = token, - studySetId = _uiState.value.studySetId, - learnMode = LearnMode.QUIZ + studySetId = studySetId, + learnMode = LearnMode.QUIZ, + isGetAll = isGetAll ).collect { resource -> when (resource) { is Resources.Error -> { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt index 6bb57ad8..4e52834d 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/quiz/component/QuizFlashCardFinish.kt @@ -67,6 +67,7 @@ fun QuizFlashCardFinish( onContinueLearningClicked: () -> Unit, listWrongAnswer: List, onRestartClicked: () -> Unit, + isGetAll: Boolean ) { val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.confetti)) val progress by animateLottieCompositionAsState( @@ -240,10 +241,21 @@ fun QuizFlashCardFinish( border = BorderStroke(1.dp, studySetColor) ) { Text( - text = stringResource( - R.string.txt_finish_answers_now, - wrongAnswerCount - ), + text = when (isGetAll) { + true -> { + stringResource( + R.string.txt_finish_answers_now, + wrongAnswerCount + ) + } + + false -> { + stringResource( + R.string.txt_continue_learning, + wrongAnswerCount + ) + } + }, style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, fontWeight = FontWeight.Bold @@ -252,27 +264,38 @@ fun QuizFlashCardFinish( ) } } - Button( - onClick = { - onRestartClicked() - }, - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - shape = MaterialTheme.shapes.small, - colors = ButtonDefaults.buttonColors( - containerColor = Color.Transparent, - contentColor = studySetColor - ), - border = BorderStroke(1.dp, studySetColor) - ) { + if (isGetAll) { + Button( + onClick = { + onRestartClicked() + }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), + shape = MaterialTheme.shapes.small, + colors = ButtonDefaults.buttonColors( + containerColor = Color.Transparent, + contentColor = studySetColor + ), + border = BorderStroke(1.dp, studySetColor) + ) { + Text( + text = stringResource(R.string.txt_learn_from_the_beginning), + style = MaterialTheme.typography.bodyMedium.copy( + fontSize = 18.sp, + fontWeight = FontWeight.Bold + ), + modifier = Modifier.padding(8.dp) + ) + } + } else { Text( - text = stringResource(R.string.txt_learn_from_the_beginning), + text = stringResource(R.string.txt_you_have_finished_this_section_of_study_set), style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, - fontWeight = FontWeight.Bold ), - modifier = Modifier.padding(8.dp) + textAlign = TextAlign.Center, + modifier = Modifier.padding(16.dp) ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseArgs.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseArgs.kt index 1754ed84..88ee8a9c 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseArgs.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseArgs.kt @@ -6,4 +6,5 @@ data class LearnByTrueFalseArgs( val studySetDescription: String, val studySetColorId: Int, val studySetSubjectId: Int, + val isGetAll: Boolean, ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt index 44f75acb..01a964a8 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseScreen.kt @@ -28,6 +28,7 @@ import androidx.compose.material3.LinearProgressIndicator import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState @@ -110,7 +111,8 @@ fun LearnByTrueFalseScreen( isCorrect = isTrue ) ) - } + }, + isGetAll = uiState.isGetAll ) } @@ -131,10 +133,12 @@ fun LearnByTrueFalse( learningTime: Long = 0, listWrongAnswer: List = emptyList(), onContinueLearningClicked: () -> Unit = {}, + isGetAll: Boolean = false ) { var isImageViewerOpen by remember { mutableStateOf(false) } var definitionImageUri by remember { mutableStateOf("") } var showUnfinishedLearningBottomSheet by remember { mutableStateOf(false) } + val unFinishedLearningBottomSheetState = rememberModalBottomSheetState() Scaffold( topBar = { @@ -165,7 +169,7 @@ fun LearnByTrueFalse( } }, actions = { - if (!isEndOfList) { + if (!isEndOfList && isGetAll) { IconButton( onClick = onRestart ) { @@ -353,7 +357,8 @@ fun LearnByTrueFalse( onContinueLearningClicked = onContinueLearningClicked, listWrongAnswer = listWrongAnswer, flashCardSize = flashCardList.size, - onRestartClicked = onRestart + onRestartClicked = onRestart, + isGetAll = isGetAll ) } } @@ -372,7 +377,6 @@ fun LearnByTrueFalse( if (showUnfinishedLearningBottomSheet) { UnfinishedLearningBottomSheet( - showUnfinishedLearningBottomSheet = showUnfinishedLearningBottomSheet, onDismissRequest = { showUnfinishedLearningBottomSheet = false }, @@ -382,7 +386,8 @@ fun LearnByTrueFalse( onEndSessionClick = { onEndSessionClick() showUnfinishedLearningBottomSheet = false - } + }, + sheetState = unFinishedLearningBottomSheetState ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseUiState.kt index 804aa2f7..bb8f7ea1 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseUiState.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseUiState.kt @@ -5,6 +5,7 @@ import com.pwhs.quickmem.domain.model.flashcard.FlashCardResponseModel import com.pwhs.quickmem.domain.model.subject.SubjectModel data class LearnByTrueFalseUiState( + val isGetAll: Boolean = false, val isLoading: Boolean = false, val studySetId: String = "", val studySetTitle: String = "", diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt index 3f6722d5..2890e194 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/LearnByTrueFalseViewModel.kt @@ -106,7 +106,9 @@ class LearnByTrueFalseViewModel @Inject constructor( _uiState.update { it.copy(learningTime = System.currentTimeMillis() - it.startTime) } - sendCompletedStudyTime() + if (!_uiState.value.isEndOfList) { + sendCompletedStudyTime() + } _uiEvent.trySend(LearnByTrueFalseUiEvent.Back) } } @@ -115,10 +117,13 @@ class LearnByTrueFalseViewModel @Inject constructor( private fun getFlashCard() { viewModelScope.launch { val token = tokenManager.accessToken.firstOrNull() ?: "" + val studySetId = _uiState.value.studySetId + val isGetAll = _uiState.value.isGetAll flashCardRepository.getFlashCardsByStudySetId( token = token, - studySetId = _uiState.value.studySetId, - learnMode = LearnMode.TRUE_FALSE + studySetId = studySetId, + learnMode = LearnMode.TRUE_FALSE, + isGetAll = isGetAll ).collect { resource -> when (resource) { is Resources.Error -> { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt index f26e58ed..115fa45a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/true_false/component/TrueFalseFlashcardFinish.kt @@ -67,6 +67,7 @@ fun TrueFalseFlashcardFinish( onContinueLearningClicked: () -> Unit, listWrongAnswer: List, onRestartClicked: () -> Unit, + isGetAll: Boolean ) { val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.confetti)) val progress by animateLottieCompositionAsState( @@ -241,7 +242,10 @@ fun TrueFalseFlashcardFinish( border = BorderStroke(1.dp, studySetColor) ) { Text( - text = stringResource(R.string.txt_finish_answers_now), + text = when (isGetAll) { + true -> stringResource(R.string.txt_finish_answers_now) + false -> stringResource(R.string.txt_continue_learning) + }, style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, fontWeight = FontWeight.Bold @@ -250,27 +254,38 @@ fun TrueFalseFlashcardFinish( ) } } - Button( - onClick = { - onRestartClicked() - }, - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - shape = MaterialTheme.shapes.small, - colors = ButtonDefaults.buttonColors( - containerColor = Color.Transparent, - contentColor = studySetColor - ), - border = BorderStroke(1.dp, studySetColor) - ) { + if (isGetAll) { + Button( + onClick = { + onRestartClicked() + }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), + shape = MaterialTheme.shapes.small, + colors = ButtonDefaults.buttonColors( + containerColor = Color.Transparent, + contentColor = studySetColor + ), + border = BorderStroke(1.dp, studySetColor) + ) { + Text( + text = stringResource(R.string.txt_learn_from_the_beginning), + style = MaterialTheme.typography.bodyMedium.copy( + fontSize = 18.sp, + fontWeight = FontWeight.Bold + ), + modifier = Modifier.padding(8.dp) + ) + } + } else { Text( - text = stringResource(R.string.txt_learn_from_the_beginning), + text = stringResource(R.string.txt_you_have_finished_this_section_of_study_set), style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, - fontWeight = FontWeight.Bold ), - modifier = Modifier.padding(8.dp) + textAlign = TextAlign.Center, + modifier = Modifier.padding(16.dp) ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteArgs.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteArgs.kt index 20223516..d1968904 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteArgs.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteArgs.kt @@ -6,4 +6,5 @@ data class LearnByWriteArgs( val studySetDescription: String, val studySetColorId: Int, val studySetSubjectId: Int, + val isGetAll: Boolean, ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt index e29efc6e..fea8de87 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteScreen.kt @@ -123,7 +123,8 @@ fun LearnByWriteScreen( }, onSubmitAnswer = { id, status, answer -> viewModel.onEvent(LearnByWriteUiAction.OnAnswer(id, status, answer)) - } + }, + isGetAll = uiState.isGetAll ) } @@ -143,7 +144,8 @@ fun LearnByWrite( learningTime: Long = 0, listWrongAnswer: List = emptyList(), onContinueLearningClicked: () -> Unit = {}, - onSubmitAnswer: (String, WriteStatus, String) -> Unit = { _, _, _ -> } + onSubmitAnswer: (String, WriteStatus, String) -> Unit = { _, _, _ -> }, + isGetAll: Boolean = false ) { var isImageViewerOpen by remember { mutableStateOf(false) } var definitionImageUri by remember { mutableStateOf("") } @@ -151,6 +153,7 @@ fun LearnByWrite( val showHintBottomSheet = remember { mutableStateOf(false) } val hintBottomSheetState = rememberModalBottomSheetState() var showUnfinishedLearningBottomSheet by remember { mutableStateOf(false) } + val unFinishedLearningBottomSheetState = rememberModalBottomSheetState() val scope = rememberCoroutineScope() var debounceJob: Job? = null val imeState = rememberImeState() @@ -189,7 +192,7 @@ fun LearnByWrite( } }, actions = { - if (!isEndOfList) { + if (!isEndOfList && isGetAll) { IconButton( onClick = { userAnswer = "" @@ -401,7 +404,8 @@ fun LearnByWrite( onContinueLearningClicked = onContinueLearningClicked, listWrongAnswer = listWrongAnswer, flashCardSize = flashCardList.size, - onRestartClicked = onRestart + onRestartClicked = onRestart, + isGetAll = isGetAll ) } } @@ -444,7 +448,6 @@ fun LearnByWrite( if (showUnfinishedLearningBottomSheet) { UnfinishedLearningBottomSheet( - showUnfinishedLearningBottomSheet = showUnfinishedLearningBottomSheet, onDismissRequest = { showUnfinishedLearningBottomSheet = false }, @@ -454,7 +457,8 @@ fun LearnByWrite( onEndSessionClick = { onEndSessionClick() showUnfinishedLearningBottomSheet = false - } + }, + sheetState = unFinishedLearningBottomSheetState ) } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteUiState.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteUiState.kt index 863f3ef6..af5bfeb6 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteUiState.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteUiState.kt @@ -6,6 +6,7 @@ import com.pwhs.quickmem.domain.model.subject.SubjectModel data class LearnByTrueFalseUiState( val isLoading: Boolean = false, + val isGetAll: Boolean = false, val studySetId: String = "", val studySetTitle: String = "", val studySetDescription: String = "", diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt index ac89651c..f3af890a 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/LearnByWriteViewModel.kt @@ -103,23 +103,28 @@ class LearnByWriteViewModel @Inject constructor( onRestart() } - is LearnByWriteUiAction.OnBackClicked -> { - _uiState.update { - it.copy(learningTime = System.currentTimeMillis() - it.startTime) - } - sendCompletedStudyTime() - _uiEvent.trySend(LearnByWriteUiEvent.Back) - } + is LearnByWriteUiAction.OnBackClicked -> { + _uiState.update { + it.copy(learningTime = System.currentTimeMillis() - it.startTime) + } + if (!_uiState.value.isEndOfList) { + sendCompletedStudyTime() + } + _uiEvent.trySend(LearnByWriteUiEvent.Back) + } } } private fun getFlashCard() { viewModelScope.launch { val token = tokenManager.accessToken.firstOrNull() ?: "" + val studySetId = _uiState.value.studySetId + val isGetAll = _uiState.value.isGetAll flashCardRepository.getFlashCardsByStudySetId( token = token, - studySetId = _uiState.value.studySetId, - learnMode = LearnMode.WRITE + studySetId = studySetId, + learnMode = LearnMode.WRITE, + isGetAll = isGetAll ).collect { resource -> when (resource) { is Resources.Error -> { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt index f109f050..3372b428 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/study_set/studies/write/component/WriteFlashcardFinish.kt @@ -67,6 +67,7 @@ fun WriteFlashcardFinish( onContinueLearningClicked: () -> Unit, listWrongAnswer: List, onRestartClicked: () -> Unit, + isGetAll: Boolean ) { val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.confetti)) val progress by animateLottieCompositionAsState( @@ -240,10 +241,14 @@ fun WriteFlashcardFinish( border = BorderStroke(1.dp, studySetColor) ) { Text( - text = stringResource( - R.string.txt_finish_answers_now, - wrongAnswerCount - ), + text = when (isGetAll) { + true -> stringResource( + R.string.txt_finish_answers_now, + wrongAnswerCount + ) + + false -> stringResource(R.string.txt_continue_learning) + }, style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, fontWeight = FontWeight.Bold @@ -252,27 +257,38 @@ fun WriteFlashcardFinish( ) } } - Button( - onClick = { - onRestartClicked() - }, - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), - shape = MaterialTheme.shapes.small, - colors = ButtonDefaults.buttonColors( - containerColor = Color.Transparent, - contentColor = studySetColor - ), - border = BorderStroke(1.dp, studySetColor) - ) { + if (isGetAll) { + Button( + onClick = { + onRestartClicked() + }, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), + shape = MaterialTheme.shapes.small, + colors = ButtonDefaults.buttonColors( + containerColor = Color.Transparent, + contentColor = studySetColor + ), + border = BorderStroke(1.dp, studySetColor) + ) { + Text( + text = stringResource(R.string.txt_learn_from_the_beginning), + style = MaterialTheme.typography.bodyMedium.copy( + fontSize = 18.sp, + fontWeight = FontWeight.Bold + ), + modifier = Modifier.padding(8.dp) + ) + } + } else { Text( - text = stringResource(R.string.txt_learn_from_the_beginning), + text = stringResource(R.string.txt_you_have_finished_this_section_of_study_set), style = MaterialTheme.typography.bodyMedium.copy( fontSize = 18.sp, - fontWeight = FontWeight.Bold ), - modifier = Modifier.padding(8.dp) + textAlign = TextAlign.Center, + modifier = Modifier.padding(16.dp) ) } } diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 1a486f00..25d454ea 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -419,4 +419,15 @@ Tiếp tục ôn lại %1$s thuật ngữ Không biết Nhập câu trả lời của bạn + Số lượng flashcard của bạn khá nhiều! + Bạn có muốn chia nhỏ số lượng flashcard ra để học từng phần không? + Không cảm ơn + Sắp xếp theo ngày + Tiếp tục học các thuật ngữ + Thẻ %1$s của %2$s + Bạn đã hoàn thành phần này của bộ học + Tiếp tục học + Chờ đã, đừng đi vội! Bạn sẽ bỏ lỡ việc hoàn thành bộ học này! + Tiếp tục học + Kết thúc phần học \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 20471fae..1d5a44ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -422,4 +422,15 @@ Keep reviewing %1$s terms Don\'t know Enter your answer + You have quite a lot of flashcards! + Do you want to split the flashcards into smaller parts to study? + No thanks + Date + Keep learning terms flip + Card %1$s of %2$s + You have finished this section of study set + Continue learning + Wait, don\'t go yet! You\'ll miss out on completing this study set! + Keep Learning + End Session \ No newline at end of file