diff --git a/frontend/app/src/main/java/com/example/speechbuddy/compose/symbolcreation/SymbolCreationScreen.kt b/frontend/app/src/main/java/com/example/speechbuddy/compose/symbolcreation/SymbolCreationScreen.kt index b929092c..3261eb4c 100644 --- a/frontend/app/src/main/java/com/example/speechbuddy/compose/symbolcreation/SymbolCreationScreen.kt +++ b/frontend/app/src/main/java/com/example/speechbuddy/compose/symbolcreation/SymbolCreationScreen.kt @@ -69,6 +69,7 @@ import com.example.speechbuddy.ui.models.DialogState import com.example.speechbuddy.ui.models.PhotoType import com.example.speechbuddy.ui.models.SymbolCreationErrorType import com.example.speechbuddy.ui.models.SymbolCreationUiState +import com.example.speechbuddy.ui.models.ToastState import com.example.speechbuddy.utils.Constants import com.example.speechbuddy.viewmodel.SymbolCreationViewModel @@ -109,14 +110,19 @@ fun SymbolCreationScreen( if (isGranted) { cameraLauncher.launch(null) } else { - Toast.makeText( - context, - "Camera permission is required to take photos", - Toast.LENGTH_SHORT - ).show() + viewModel.updateToastState("show") } } + if (viewModel.toastState == ToastState.SHOW) { + Toast.makeText( + context, + stringResource(id = R.string.camera_permission_description), + Toast.LENGTH_LONG + ).show() + viewModel.updateToastState("hide") + } + if (creationResultMessage != null) { LaunchedEffect(key1 = creationResultMessage) { val toastMessage = context.resources.getString(creationResultMessage!!) @@ -264,7 +270,8 @@ private fun DropdownUi( ) } else { label?.invoke() ?: Text( - "Select an option", color = MaterialTheme.colorScheme.onSurface + text = stringResource(id = R.string.choose_a_category), + color = MaterialTheme.colorScheme.onSurface ) } Icon( diff --git a/frontend/app/src/main/java/com/example/speechbuddy/ui/models/SymbolCreationUiState.kt b/frontend/app/src/main/java/com/example/speechbuddy/ui/models/SymbolCreationUiState.kt index 4cd4d25c..341e7c10 100644 --- a/frontend/app/src/main/java/com/example/speechbuddy/ui/models/SymbolCreationUiState.kt +++ b/frontend/app/src/main/java/com/example/speechbuddy/ui/models/SymbolCreationUiState.kt @@ -30,4 +30,9 @@ enum class PhotoType { enum class DialogState { SHOW, HIDE +} + +enum class ToastState { + SHOW, + HIDE } \ No newline at end of file diff --git a/frontend/app/src/main/java/com/example/speechbuddy/viewmodel/SymbolCreationViewModel.kt b/frontend/app/src/main/java/com/example/speechbuddy/viewmodel/SymbolCreationViewModel.kt index 3677301c..c236d73c 100644 --- a/frontend/app/src/main/java/com/example/speechbuddy/viewmodel/SymbolCreationViewModel.kt +++ b/frontend/app/src/main/java/com/example/speechbuddy/viewmodel/SymbolCreationViewModel.kt @@ -26,6 +26,7 @@ import com.example.speechbuddy.ui.models.PhotoType import com.example.speechbuddy.ui.models.SymbolCreationError import com.example.speechbuddy.ui.models.SymbolCreationErrorType import com.example.speechbuddy.ui.models.SymbolCreationUiState +import com.example.speechbuddy.ui.models.ToastState import com.example.speechbuddy.utils.Status import com.example.speechbuddy.utils.isValidSymbolText import dagger.hilt.android.lifecycle.HiltViewModel @@ -65,6 +66,8 @@ class SymbolCreationViewModel @Inject internal constructor( var dialogState by mutableStateOf(DialogState.HIDE) + var toastState by mutableStateOf(ToastState.HIDE) + var symbolTextInput by mutableStateOf("") private set @@ -83,6 +86,18 @@ class SymbolCreationViewModel @Inject internal constructor( } } + fun updateToastState(updateState: String) { + when (updateState) { + "show" -> { + toastState = ToastState.SHOW + } + + "hide" -> { + toastState = ToastState.HIDE + } + } + } + fun expandCategory() { _uiState.update { currentState -> currentState.copy( diff --git a/frontend/app/src/main/res/values/strings.xml b/frontend/app/src/main/res/values/strings.xml index 4c2c0611..633e926a 100644 --- a/frontend/app/src/main/res/values/strings.xml +++ b/frontend/app/src/main/res/values/strings.xml @@ -91,6 +91,8 @@ 사진을 어떻게 추가하실 건가요? 사진 보관함에서 사진 선택하기 사진 촬영하기 + 기기설정에서 카메라 권한을 허용해주세요 + 대분류를 선택하십시오 설정