Skip to content

Commit 75d98dd

Browse files
committed
better ui ux
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent ec0d563 commit 75d98dd

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

app/src/main/java/com/nextcloud/client/assistant/AssistantViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class AssistantViewModel(
238238
val result = remoteRepository.translate(input, taskType)
239239
if (result.isSuccess) {
240240
_isTranslationTaskCreated.update { true }
241+
// TODO: Select newly created translation task
241242

242243
val selectedTaskId = selectedTask.value?.id ?: return@launch
243244

app/src/main/java/com/nextcloud/client/assistant/translate/TranslationScreen.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,18 @@ fun TranslationScreen(
109109
.padding(16.dp)
110110
.padding(top = 32.dp),
111111
floatingActionButton = {
112-
FloatingActionButton(onClick = {
113-
val originLang = sourceState.language
114-
val targetLang = targetState.language
115-
if (originLang != null && targetLang != null) {
116-
viewModel.translate(sourceState.text, originLang, targetLang)
117-
}
118-
}, content = {
119-
Icon(painter = painterResource(R.drawable.ic_translate), contentDescription = "translate button")
120-
})
112+
if (!isTaskExists) {
113+
// TODO: After first task creation dont allow user to create another back to back
114+
FloatingActionButton(onClick = {
115+
val originLang = sourceState.language
116+
val targetLang = targetState.language
117+
if (originLang != null && targetLang != null) {
118+
viewModel.translate(sourceState.text, originLang, targetLang)
119+
}
120+
}, content = {
121+
Icon(painter = painterResource(R.drawable.ic_translate), contentDescription = "translate button")
122+
})
123+
}
121124
}
122125
) { paddingValues ->
123126
LazyColumn(modifier = Modifier.padding(paddingValues)) {

0 commit comments

Comments
 (0)