Bläddra i källkod

Set string resources on account screen and logout dialog on TV for multi lingual

Khubaib 8 månader sedan
förälder
incheckning
9ae70aa78a

+ 8 - 7
app/src/main/java/com/vpn/fastestvpnservice/screensTV/AccountScreenTV.kt

@@ -147,7 +147,7 @@ fun AccountTV(navHostController: NavHostController,
             ) {
 //                Spacer(modifier = Modifier.height(50.dp))
                 AddTextAccountTV(
-                    text = "Account",
+                    text = context.getString(R.string.account),
                     size = 28.sp,
                     color = MaterialTheme.colorScheme.primary
                 )
@@ -178,7 +178,7 @@ fun AccountTV(navHostController: NavHostController,
 //                )
                 AddRowAccountIconTV(
                     icon = painterResource(id = R.drawable.fav3x),
-                    text = "Favorite Servers",
+                    text = context.getString(R.string.favorite_servers),
                     onClick = {
                         navHostController.navigate(
                             ScreenTV.FavoriteTV.route
@@ -205,7 +205,7 @@ fun AccountTV(navHostController: NavHostController,
 //                )
                 AddRowAccountIconTV(
                     icon = painterResource(id = R.drawable.logout3x),
-                    text = "Logout",
+                    text = context.getString(R.string.logout),
                     onClick = {
                         isLoggedOut = true
                         Log.d("islogoutClicked?", "Yes")
@@ -224,8 +224,9 @@ fun AccountTV(navHostController: NavHostController,
                         .fillMaxWidth()
                         .height(228.dp)
                 ) {
-                    LogoutDialogTV("Logout Account",
-                        "Are you sure to logout the account?",
+                    LogoutDialogTV(
+                        context.getString(R.string.logout_account),
+                        context.getString(R.string.sure_logout_account),
                         onCancel = {
                             isLoggedOut = false
                         },
@@ -652,7 +653,7 @@ fun BoxScope.LogoutDialogTV(
                     border = BorderStroke(2.dp, if (isButtonFocused1) MaterialTheme.colorScheme.primary else colorResource(id = R.color.light_blue))
                 )
                 {
-                    Text(text = "No",
+                    Text(text = context.getString(R.string.no),
                         style = MaterialTheme.typography.labelLarge)
                     Log.d("test_button", "RowScope")
                 }
@@ -710,7 +711,7 @@ fun BoxScope.LogoutDialogTV(
 //                                    colorResource(id = R.color.gray_icon))
                 )
                 {
-                    Text(text = "Yes",
+                    Text(text = context.getString(R.string.yes),
                         style = MaterialTheme.typography.labelLarge)
                     Log.d("test_button", "RowScope")
 

+ 4 - 2
app/src/main/java/com/vpn/fastestvpnservice/screensTV/accountScreensAll/FavoriteScreenTV.kt

@@ -33,6 +33,7 @@ import androidx.compose.ui.Modifier
 import androidx.compose.ui.focus.FocusRequester
 import androidx.compose.ui.focus.focusRequester
 import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.unit.dp
@@ -44,7 +45,6 @@ import com.vpn.fastestvpnservice.screens.serverListViewModelSplash
 @OptIn(ExperimentalFoundationApi::class)
 @Composable
 fun FavoriteServersTV(navHostController: NavHostController) {
-//    val context = LocalContext.current
 //    val basePreferenceHelper = BasePreferenceHelper(context)
 //    val serverListViewModel: ServerListViewModel = viewModel{
 //        ServerListViewModel(context)
@@ -107,6 +107,8 @@ fun FavoriteServersTV(navHostController: NavHostController) {
 @Composable
 fun BoxScope.HeaderRowFSTV(
     navHostController: NavHostController) {
+    val context = LocalContext.current
+
 //    IconButton(
 //        onClick = {
 //            navHostController.popBackStack()
@@ -135,7 +137,7 @@ fun BoxScope.HeaderRowFSTV(
             .padding(5.dp),
         color = colorResource(id = R.color.transparent)
     ) {
-        Text(text = "Favorite Servers",
+        Text(text = context.getString(R.string.favorite_servers),
             color = MaterialTheme.colorScheme.primary,
             style = MaterialTheme.typography.bodyMedium,
             modifier = Modifier.fillMaxHeight()