From aa2b6023057b2a9c6004000365d1ce759bdd3265 Mon Sep 17 00:00:00 2001 From: Daocon <134820492+Daocon@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:47:18 +0700 Subject: [PATCH] =?UTF-8?q?feat(language):=20=C4=91a=20ng=C3=B4n=20ng?= =?UTF-8?q?=E1=BB=AF=20t=E1=BA=A1i=20flashcards?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/deeplink/classes/JoinClassScreen.kt | 18 ++++++++++-------- .../app/flashcard/component/CardSelectImage.kt | 13 +++++++------ .../flashcard/component/FlashCardTopAppBar.kt | 8 +++++--- .../flashcard/create/CreateFlashCardArgs.kt | 2 -- .../flashcard/create/CreateFlashCardScreen.kt | 5 ++--- .../create/draw/DrawFlashCardScreen.kt | 9 +++++---- .../create/draw/component/SeekbarBrushWidth.kt | 4 +++- .../app/flashcard/edit/EditFlashCardScreen.kt | 1 - app/src/main/res/values-vi/strings.xml | 11 +++++++++++ app/src/main/res/values/strings.xml | 11 +++++++++++ 10 files changed, 54 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/deeplink/classes/JoinClassScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/deeplink/classes/JoinClassScreen.kt index 8bc77367..7c9d5afc 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/deeplink/classes/JoinClassScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/deeplink/classes/JoinClassScreen.kt @@ -31,6 +31,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import coil.compose.AsyncImage @@ -52,6 +53,7 @@ import com.revenuecat.purchases.Purchases import com.revenuecat.purchases.PurchasesError import com.revenuecat.purchases.interfaces.ReceiveCustomerInfoCallback import timber.log.Timber +import com.pwhs.quickmem.R @Destination( navArgs = JoinClassArgs::class @@ -151,14 +153,14 @@ fun JoinClass( Scaffold( topBar = { CenterAlignedTopAppBar( - title = { Text("Join Class") }, + title = { Text(stringResource(R.string.txt_join_class)) }, navigationIcon = { IconButton( onClick = onBackHome ) { Icon( imageVector = Icons.Default.Home, - contentDescription = "Back", + contentDescription = stringResource(R.string.txt_back), tint = Color.Gray.copy(alpha = 0.6f) ) } @@ -174,20 +176,20 @@ fun JoinClass( horizontalAlignment = Alignment.CenterHorizontally, ) { item { - SettingTitleSection("Class Detail") + SettingTitleSection(stringResource(R.string.txt_class_detail)) SettingCard { Column( modifier = Modifier.padding(16.dp) ) { SettingItem( - title = "Title", + title = stringResource(R.string.txt_title), subtitle = classDetailResponseModel?.title ?: "", showArrow = false ) if (classDetailResponseModel?.description?.isNotEmpty() == true) { HorizontalDivider() SettingItem( - title = "Description", + title = stringResource(R.string.txt_description), subtitle = classDetailResponseModel.description, showArrow = false ) @@ -197,7 +199,7 @@ fun JoinClass( } item { - SettingTitleSection("Owner") + SettingTitleSection(stringResource(R.string.txt_owner)) SettingCard( onClick = onOwnerClick ) { @@ -212,7 +214,7 @@ fun JoinClass( ) AsyncImage( model = classDetailResponseModel?.owner?.avatarUrl ?: "", - contentDescription = "Class Image", + contentDescription = stringResource(R.string.txt_class_image), modifier = Modifier .padding(end = 16.dp) .size(20.dp) @@ -233,7 +235,7 @@ fun JoinClass( }, modifier = Modifier.padding(16.dp) ) { - Text(text = "Join Class") + Text(text = stringResource(R.string.txt_join_class)) } } item { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/CardSelectImage.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/CardSelectImage.kt index 35f22b15..3b858fda 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/CardSelectImage.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/CardSelectImage.kt @@ -29,6 +29,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import coil.compose.AsyncImage @@ -80,7 +81,7 @@ fun CardSelectImage( Timber.d("Image Url: $definitionImageUrl") AsyncImage( model = definitionImageUrl, - contentDescription = "Image for definition", + contentDescription = stringResource(R.string.txt_image_for_definition), modifier = Modifier.size(120.dp), contentScale = ContentScale.Crop ) @@ -88,7 +89,7 @@ fun CardSelectImage( Timber.d("Image Uri: $definitionImageUri") AsyncImage( model = definitionImageUri, - contentDescription = "Image for definition", + contentDescription = stringResource(R.string.txt_image_for_definition), modifier = Modifier.size(120.dp), contentScale = ContentScale.Crop, onSuccess = { onUploadImage(definitionImageUri) } @@ -97,7 +98,7 @@ fun CardSelectImage( Timber.d("No Image") Image( painter = painterResource(id = R.drawable.ic_add_image), - contentDescription = "Add Image to Definition", + contentDescription = stringResource(R.string.add_image_to_definition), modifier = Modifier.size(120.dp), colorFilter = ColorFilter.tint( MaterialTheme.colorScheme.onSurface.copy( @@ -108,7 +109,7 @@ fun CardSelectImage( ) } Text( - "Image for definition", + stringResource(R.string.txt_image_for_definition), color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f), modifier = Modifier.padding(top = 8.dp) ) @@ -132,7 +133,7 @@ fun CardSelectImage( Column(horizontalAlignment = Alignment.CenterHorizontally) { AsyncImage( model = definitionImageUri ?: definitionImageUrl, - contentDescription = "Full Image", + contentDescription = stringResource(R.string.txt_full_image), modifier = Modifier .fillMaxWidth() .padding(16.dp), @@ -146,7 +147,7 @@ fun CardSelectImage( }, colors = ButtonDefaults.buttonColors(MaterialTheme.colorScheme.error) ) { - Text("Delete Image") + Text(stringResource(R.string.txt_delete_image)) } } } diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/FlashCardTopAppBar.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/FlashCardTopAppBar.kt index 20062664..242655c6 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/FlashCardTopAppBar.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/component/FlashCardTopAppBar.kt @@ -13,7 +13,9 @@ import androidx.compose.material3.MaterialTheme.typography import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight +import com.pwhs.quickmem.R @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -37,12 +39,12 @@ fun FlashCardTopAppBar( }, navigationIcon = { IconButton(onClick = onNavigationBack) { - Icon(imageVector = Icons.Filled.Clear, contentDescription = "Back") + Icon(imageVector = Icons.Filled.Clear, contentDescription = stringResource(R.string.txt_back)) } }, actions = { IconButton(onClick = onSettingsClicked) { - Icon(imageVector = Icons.Default.Settings, contentDescription = "Settings") + Icon(imageVector = Icons.Default.Settings, contentDescription = stringResource(R.string.txt_settings)) } IconButton( onClick = onSaveFlashCardClicked, @@ -50,7 +52,7 @@ fun FlashCardTopAppBar( ) { Icon( imageVector = Icons.Filled.Done, - contentDescription = "Save", + contentDescription = stringResource(R.string.txt_save), tint = if (enableSaveButton) { colorScheme.primary } else { diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardArgs.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardArgs.kt index cc6ec61f..61952d2e 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardArgs.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardArgs.kt @@ -1,7 +1,5 @@ package com.pwhs.quickmem.presentation.app.flashcard.create -import android.net.Uri - data class CreateFlashCardArgs ( val studySetId: String, val studySetTitle: String diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardScreen.kt index 2a72264b..414fe3b8 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/CreateFlashCardScreen.kt @@ -315,7 +315,7 @@ fun CreateFlashCard( ) { Icon( imageVector = Icons.Filled.Clear, - contentDescription = "Close", + contentDescription = stringResource(R.string.txt_close), ) } } @@ -359,7 +359,7 @@ fun CreateFlashCard( ) { Icon( imageVector = Icons.Filled.Clear, - contentDescription = "Close", + contentDescription = stringResource(R.string.txt_close), ) } } @@ -425,7 +425,6 @@ fun CreateFlashCard( title = stringResource(R.string.txt_draw_to_answer), icon = R.drawable.ic_art, onClick = { - //TODO: Draw showBottomSheetSetting = false }, ) diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/DrawFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/DrawFlashCardScreen.kt index 3b063663..66055373 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/DrawFlashCardScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/DrawFlashCardScreen.kt @@ -35,8 +35,10 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clipToBounds import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.asAndroidBitmap +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp +import com.pwhs.quickmem.R import com.pwhs.quickmem.presentation.app.flashcard.create.draw.component.ControlsBar import com.pwhs.quickmem.presentation.app.flashcard.create.draw.component.SeekbarBrushWidth import com.pwhs.quickmem.util.convertToOldColor @@ -51,7 +53,6 @@ import io.ak1.rangvikalp.defaultSelectedColor import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext import timber.log.Timber @Destination @@ -111,7 +112,7 @@ fun DrawFlashCard( CenterAlignedTopAppBar( title = { Text( - text = "Draw", style = typography.titleMedium.copy( + text = stringResource(R.string.txt_draw), style = typography.titleMedium.copy( fontWeight = FontWeight.Bold ) ) @@ -122,7 +123,7 @@ fun DrawFlashCard( ) { Icon( imageVector = Icons.Default.Clear, - contentDescription = "Cancel and back", + contentDescription = stringResource(R.string.txt_cancel_and_back), ) } }, @@ -144,7 +145,7 @@ fun DrawFlashCard( tint = colorScheme.primary ) Text( - text = "Save", + text = stringResource(R.string.txt_save), style = typography.titleMedium.copy( fontWeight = FontWeight.Bold, color = colorScheme.primary diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/component/SeekbarBrushWidth.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/component/SeekbarBrushWidth.kt index 0fb282d4..96c4d5d6 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/component/SeekbarBrushWidth.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/create/draw/component/SeekbarBrushWidth.kt @@ -20,10 +20,12 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.core.graphics.BlendModeColorFilterCompat import androidx.core.graphics.BlendModeCompat +import com.pwhs.quickmem.R @Composable fun SeekbarBrushWidth( @@ -63,7 +65,7 @@ fun SeekbarBrushWidth( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { - Text(text = "Stroke Width") + Text(text = stringResource(R.string.txt_stroke_width)) Text(text = "$progress pt") } AndroidView( diff --git a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/edit/EditFlashCardScreen.kt b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/edit/EditFlashCardScreen.kt index bcb37218..d863a9c0 100644 --- a/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/edit/EditFlashCardScreen.kt +++ b/app/src/main/java/com/pwhs/quickmem/presentation/app/flashcard/edit/EditFlashCardScreen.kt @@ -429,7 +429,6 @@ fun CreateFlashCard( title = stringResource(R.string.txt_draw_to_answer), icon = R.drawable.ic_art, onClick = { - //TODO: Draw showBottomSheetSetting = false }, ) diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index cb39177b..e90cd00b 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -332,4 +332,15 @@ Tiêu đề thư mục Nhập tiêu đề thư mục Nhập mô tả + Chi tiết lớp + Tiêu đề + Hình ảnh lớp + Hình ảnh cho định nghĩa + Thêm hình ảnh vào định nghĩa + Hình ảnh đầy đủ + Xóa hình ảnh + Lưu + Vẽ + Hủy và quay lại + Độ rộng nét vẽ \ 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 031c1b86..f22947d2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -335,4 +335,15 @@ Folder Title Enter Folder Title Enter Description + Class Detail + Title + Class Image + Image for definition + Add Image to Definition + Full Image + Delete Image + Save + Draw + Cancel and back + Stroke Width \ No newline at end of file