Quellcode durchsuchen

Set multi lingual resources on settings screen, created resource qualifiers and setting screens support language, adjust split tunneling radio buttons UI

Khubaib vor 6 Monaten
Ursprung
Commit
bca6dd122e

+ 30 - 7
app/src/main/java/com/vpn/fastestvpnservice/screens/bottomNavBarScreens/SettingsScreen.kt

@@ -771,7 +771,7 @@ fun ColumnScope.AddRowSettingsColumn(
                         horizontalAlignment = Alignment.Start
                     ) {
                         AddTextSettings(
-                            text = "VPN Protocols",
+                            text = context.getString(R.string.vpn_protocols),
                             size = 18.sp,
                             color = MaterialTheme.colorScheme.primary,
                             bottomPadding = 15.dp,
@@ -984,7 +984,7 @@ fun AddRowDarkLightTheme(
                     horizontalAlignment = Alignment.Start
                 ) {
                     AddTextSettings(
-                        text = "Appearance",
+                        text = context.getString(R.string.appearance),
                         size = 18.sp,
                         color = MaterialTheme.colorScheme.primary,
                         bottomPadding = 20.dp,
@@ -992,7 +992,18 @@ fun AddRowDarkLightTheme(
                         style = MaterialTheme.typography.titleSmall
                     )
                     themesList.forEach { theme ->
-
+                        var themeLingual: String = ""
+                        when (theme) {
+                            themesList[0] -> {
+                                themeLingual = context.getString(R.string.system_default)
+                            }
+                            themesList[1] -> {
+                                themeLingual = context.getString(R.string.light_mode)
+                            }
+                            themesList[2] -> {
+                                themeLingual = context.getString(R.string.dark_mode)
+                            }
+                        }
                         Row(
                             modifier = Modifier
                                 .fillMaxWidth()
@@ -1046,7 +1057,7 @@ fun AddRowDarkLightTheme(
                                     unselectedColor = colorResource(id = R.color.gray_icon),
                                 )
                             )
-                            Text(text = theme,
+                            Text(text = themeLingual,
                                 modifier = Modifier.padding(start = 12.dp),
                                 style = MaterialTheme.typography.bodySmall,
                                 color = MaterialTheme.colorScheme.primary
@@ -1163,7 +1174,7 @@ fun SelectLanguage(
                     horizontalAlignment = Alignment.Start
                 ) {
                     AddTextSettings(
-                        text = "Language",
+                        text = context.getString(R.string.language),
                         size = 18.sp,
                         color = MaterialTheme.colorScheme.primary,
                         bottomPadding = 20.dp,
@@ -1365,7 +1376,7 @@ fun ColumnScope.AddRowSettingsSmart(
                     horizontalAlignment = Alignment.Start
                 ) {
                     AddTextSettings(
-                        text = "Smart Connect",
+                        text = context.getString(R.string.smart_connect),
                         size = 18.sp,
                         color = MaterialTheme.colorScheme.primary,
                         bottomPadding = 20.dp,
@@ -1373,6 +1384,18 @@ fun ColumnScope.AddRowSettingsSmart(
                         style = MaterialTheme.typography.titleMedium
                     )
                     smartConnect.forEach { smart ->
+                        var smartLingual: String = ""
+                        when (smart) {
+                            smartConnect[0] -> {
+                                smartLingual = context.getString(R.string.recommended)
+                            }
+                            smartConnect[1] -> {
+                                smartLingual = context.getString(R.string.recently)
+                            }
+                            smartConnect[2] -> {
+                                smartLingual = context.getString(R.string.any_specific)
+                            }
+                        }
                         Row(
                             modifier = Modifier
                                 .fillMaxWidth()
@@ -1418,7 +1441,7 @@ fun ColumnScope.AddRowSettingsSmart(
                                 )
                             )
                             Column {
-                                Text(text = smart,
+                                Text(text = smartLingual,
                                     modifier = Modifier.padding(start = 12.dp),
                                     color = MaterialTheme.colorScheme.primary,
                                     style = MaterialTheme.typography.bodySmall

+ 3 - 1
app/src/main/java/com/vpn/fastestvpnservice/screens/settingsScreenAll/NotificationsScreen.kt

@@ -23,6 +23,7 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.toArgb
+import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.platform.LocalView
 import androidx.compose.ui.res.colorResource
 import androidx.compose.ui.res.painterResource
@@ -75,6 +76,7 @@ fun Notifications(navHostController: NavHostController) {
 
 @Composable
 fun BoxScope.HeaderRowNS(navHostController: NavHostController) {
+    val context = LocalContext.current
     IconButton(
         onClick = {
             navHostController.popBackStack()
@@ -101,7 +103,7 @@ fun BoxScope.HeaderRowNS(navHostController: NavHostController) {
             .padding(5.dp),
         color = colorResource(id = R.color.transparent)
     ) {
-        Text(text = "Notifications",
+        Text(text = context.getString(R.string.notifcation),
             color = MaterialTheme.colorScheme.primary,
             style = MaterialTheme.typography.bodyMedium,
             modifier = Modifier.fillMaxHeight()

+ 29 - 9
app/src/main/java/com/vpn/fastestvpnservice/screens/settingsScreenAll/SplitTunneling.kt

@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.height
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.wrapContentHeight
 import androidx.compose.foundation.lazy.LazyColumn
 import androidx.compose.foundation.lazy.items
 import androidx.compose.foundation.lazy.itemsIndexed
@@ -50,6 +51,7 @@ import androidx.compose.ui.text.TextStyle
 import androidx.compose.ui.text.font.FontWeight
 import androidx.compose.ui.text.style.TextAlign
 import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.TextUnit
 import androidx.compose.ui.unit.dp
 import androidx.compose.ui.unit.sp
 import androidx.navigation.NavHostController
@@ -143,11 +145,23 @@ fun ColumnScope.ShowRadioButtons() {
     Spacer(modifier = Modifier.height(15.dp))
 
     splitList.forEachIndexed { index, list ->
+        var splitListLingual: String = ""
+        when (list) {
+            splitList[0] -> {
+                splitListLingual = context.getString(R.string.all_apps_use_vpn)
+            }
+            splitList[1] -> {
+                splitListLingual = context.getString(R.string.only_selected_apps_use_vpn)
+            }
+            splitList[2] -> {
+                splitListLingual = context.getString(R.string.only_selected_apps_not_use_vpn)
+            }
+        }
             Row(
                 modifier = Modifier
                     .fillMaxWidth()
                     .background(Color.Transparent)
-                    .padding(top = 0.dp)
+                    .padding(top = 5.dp)
                     .selectable(
                         selected = selectedList == list,
                         onClick = {
@@ -164,9 +178,11 @@ fun ColumnScope.ShowRadioButtons() {
 //                                        }
 //                                    )
                 ,
-                verticalAlignment = Alignment.CenterVertically
+                verticalAlignment = Alignment.CenterVertically,
+                horizontalArrangement = Arrangement.Start
             ) {
-                RadioButton(selected = list == selectedList,
+                RadioButton(
+                    selected = list == selectedList,
                     onClick = {
                         selectedList = list
                         prefHelper.saveSplitPosition(list)
@@ -176,13 +192,17 @@ fun ColumnScope.ShowRadioButtons() {
                         selectedColor = colorResource(
                             id = R.color.radio_button_blue),
                         unselectedColor = colorResource(
-                            id = R.color.gray_icon),)
+                            id = R.color.gray_icon),
+                        ),
+                    modifier = Modifier.align(Alignment.Top)
                 )
                 Text(
-                    text = list,
-                    modifier = Modifier.padding(start = 12.dp),
+                    text = splitListLingual,
                     style = MaterialTheme.typography.bodySmall,
-                    color = MaterialTheme.colorScheme.primary
+                    color = MaterialTheme.colorScheme.primary,
+                    maxLines = 2,
+                    lineHeight = 15.sp,
+                    modifier = Modifier.padding(start = 12.dp)
                 )
             }
         }
@@ -325,7 +345,6 @@ fun getInstalledApps(context: Context): ArrayList<SelectApplicationEntry> {
 
 @Composable
 fun ColumnScope.ShowSplitTunnelList(list: List<SelectApplicationEntry>) {
-
     Box(modifier = Modifier
         .padding(top = 5.dp)
         .fillMaxSize()
@@ -341,6 +360,7 @@ fun ColumnScope.ShowSplitTunnelList(list: List<SelectApplicationEntry>) {
 
 @Composable
 fun BoxScope.HeaderRowST(navHostController: NavHostController) {
+    val context = LocalContext.current
     IconButton(
         onClick = {
             navHostController.popBackStack()
@@ -367,7 +387,7 @@ fun BoxScope.HeaderRowST(navHostController: NavHostController) {
             .padding(5.dp),
         color = colorResource(id = R.color.transparent)
     ) {
-        Text(text = "Split Tunneling",
+        Text(text = context.getString(R.string.split_tunneling),
             color = MaterialTheme.colorScheme.primary,
             style = MaterialTheme.typography.bodyMedium,
             modifier = Modifier.fillMaxHeight()

+ 6 - 0
app/src/main/res/values-de/strings.xml

@@ -23,6 +23,12 @@
     <string name="appearance">Aussehen</string>
     <string name="launch_on_startup">Beim Start starten</string>
     <string name="language">Sprache</string>
+    <string name="system_default">Systemstandard</string>
+    <string name="light_mode">Lichtmodus</string>
+    <string name="dark_mode">Dunkler Modus</string>
+    <string name="all_apps_use_vpn">Alle Apps nutzen das VPN</string>
+    <string name="only_selected_apps_use_vpn">Erlauben Sie nur ausgewählten Apps, das VPN zu verwenden</string>
+    <string name="only_selected_apps_not_use_vpn">Erlauben Sie ausgewählten Apps nicht, das VPN zu verwenden</string>
 
     <!-- Help Screen -->
     <string name="help">Hilfe</string>

+ 7 - 4
app/src/main/res/values/strings.xml

@@ -364,11 +364,7 @@
     <string name="m_kill_switch_not_supported">Kill switch is not supported on this Android version</string>
     <string name="m_settings_not_saved">Settings not saved</string>
     <string name="m_no_specific_app_selected">No Specific App Selected</string>
-    <string name="m_while_vpn_connected">While VPN is Connected</string>
 
-    <string name="m_all_apps_use_vpn">All applications are allowed to use VPN</string>
-    <string name="m_only_selected_apps_use_vpn">Only selected applications will use VPN</string>
-    <string name="m_only_selected_apps_not_use_vpn">Only selected applications will not use VPN</string>
     <string name="apps_selected">%s Apps Selected</string>
     <string name="m_login">Welcome to FastestVPN! Connect now and take\ncontrol of your privacy</string>
     <string name="hello_there">Hello There.</string>
@@ -539,6 +535,13 @@
     <string name="appearance">Appearance</string>
     <string name="launch_on_startup">Launch on Startup</string>
     <string name="language">Language</string>
+    <string name="system_default">System Default</string>
+    <string name="light_mode">Light Mode</string>
+    <string name="dark_mode">Dark Mode</string>
+    <string name="while_vpn_connected">While VPN is Connected</string>
+    <string name="all_apps_use_vpn">All apps use the VPN</string>
+    <string name="only_selected_apps_use_vpn">Only allow selected apps to use the VPN</string>
+    <string name="only_selected_apps_not_use_vpn">Do not allow selected apps to use the VPN</string>
 
     <!-- Help Screen -->
     <string name="help">Help</string>