diff --git a/frontend/app/src/main/java/com/example/speechbuddy/compose/settings/BackButtonUi.kt b/frontend/app/src/main/java/com/example/speechbuddy/compose/settings/BackButtonUi.kt index a499c773..a417559e 100644 --- a/frontend/app/src/main/java/com/example/speechbuddy/compose/settings/BackButtonUi.kt +++ b/frontend/app/src/main/java/com/example/speechbuddy/compose/settings/BackButtonUi.kt @@ -5,25 +5,27 @@ import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import com.example.speechbuddy.R import com.example.speechbuddy.ui.SpeechBuddyTheme @Composable fun BackButtonUi( onBackClick: () -> Unit -){ +) { IconButton(onClick = onBackClick) { Icon( imageVector = Icons.Default.ArrowBack, - contentDescription = "Go back to settings page" + contentDescription = stringResource(id = R.string.back) ) } } @Preview @Composable -fun BackButtonUiPreview(){ - SpeechBuddyTheme{ +fun BackButtonUiPreview() { + SpeechBuddyTheme { BackButtonUi( onBackClick = {} ) diff --git a/frontend/app/src/main/java/com/example/speechbuddy/compose/settings/AlertDialogUi.kt b/frontend/app/src/main/java/com/example/speechbuddy/compose/utils/AlertDialogUi.kt similarity index 72% rename from frontend/app/src/main/java/com/example/speechbuddy/compose/settings/AlertDialogUi.kt rename to frontend/app/src/main/java/com/example/speechbuddy/compose/utils/AlertDialogUi.kt index 2875c410..81b28a3b 100644 --- a/frontend/app/src/main/java/com/example/speechbuddy/compose/settings/AlertDialogUi.kt +++ b/frontend/app/src/main/java/com/example/speechbuddy/compose/utils/AlertDialogUi.kt @@ -1,4 +1,4 @@ -package com.example.speechbuddy.compose.settings +package com.example.speechbuddy.compose.utils import androidx.compose.material3.AlertDialog import androidx.compose.material3.Button @@ -6,32 +6,23 @@ import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import com.example.speechbuddy.ui.SpeechBuddyTheme @Composable fun AlertDialogUi( - onConfirmButtonClick: () -> Unit, - onDismissButtonClick: () -> Unit, title: String, - content: String, + text: String, + dismissButtonText: String, confirmButtonText: String, - dismissButtonText: String + onDismiss: () -> Unit, + onConfirm: () -> Unit ) { AlertDialog( - title = { - Text(text = title) - }, - text = { - Text(text = content) - }, - onDismissRequest = { - onDismissButtonClick - }, + onDismissRequest = onDismiss, confirmButton = { Button( - onClick = onConfirmButtonClick, + onClick = onConfirm, colors = ButtonDefaults.buttonColors( containerColor = MaterialTheme.colorScheme.error, contentColor = MaterialTheme.colorScheme.onError, @@ -42,7 +33,7 @@ fun AlertDialogUi( }, dismissButton = { Button( - onClick = onDismissButtonClick, + onClick = onDismiss, colors = ButtonDefaults.buttonColors( containerColor = MaterialTheme.colorScheme.surfaceVariant, contentColor = MaterialTheme.colorScheme.onSurfaceVariant @@ -51,6 +42,12 @@ fun AlertDialogUi( Text(dismissButtonText) } }, + title = { + Text(text = title) + }, + text = { + Text(text = text) + }, containerColor = MaterialTheme.colorScheme.inverseOnSurface ) } @@ -60,12 +57,12 @@ fun AlertDialogUi( fun AlertDialogUiPreview() { SpeechBuddyTheme { AlertDialogUi( - onConfirmButtonClick = { /*TODO*/ }, - onDismissButtonClick = { /*TODO*/ }, title = "title", - content = "content", + text = "text", + dismissButtonText = "dismiss", confirmButtonText = "confirm", - dismissButtonText = "dismiss" + onDismiss = {}, + onConfirm = {} ) } } \ No newline at end of file diff --git a/frontend/app/src/main/res/values/strings.xml b/frontend/app/src/main/res/values/strings.xml index aa5fc500..0ea2ba4f 100644 --- a/frontend/app/src/main/res/values/strings.xml +++ b/frontend/app/src/main/res/values/strings.xml @@ -77,4 +77,5 @@ 버전 developer@gmail.com 정지 + 뒤로가기 \ No newline at end of file