|
@@ -134,15 +134,13 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
val focusRequester1 = remember { FocusRequester() }
|
|
val focusRequester1 = remember { FocusRequester() }
|
|
val focusRequester2 = remember { FocusRequester() }
|
|
val focusRequester2 = remember { FocusRequester() }
|
|
val focusRequester3 = remember { FocusRequester() }
|
|
val focusRequester3 = remember { FocusRequester() }
|
|
- val focusRequester4 = remember { FocusRequester() }
|
|
|
|
- val focusRequester5 = remember { FocusRequester() }
|
|
|
|
val focusRequesterProtocol = remember { FocusRequester() }
|
|
val focusRequesterProtocol = remember { FocusRequester() }
|
|
val scope = rememberCoroutineScope()
|
|
val scope = rememberCoroutineScope()
|
|
val homeViewModel: HomeViewModel = viewModel{
|
|
val homeViewModel: HomeViewModel = viewModel{
|
|
HomeViewModel(context, scope)
|
|
HomeViewModel(context, scope)
|
|
}
|
|
}
|
|
val vpnConnectionsUtil = VPNConnectionsUtil(context, activityGlobal, homeViewModel)
|
|
val vpnConnectionsUtil = VPNConnectionsUtil(context, activityGlobal, homeViewModel)
|
|
-
|
|
|
|
|
|
+ var settingsString by remember { mutableStateOf(context.getString(R.string.settings)) }
|
|
|
|
|
|
if (isSettingsScreenPressed.value) {
|
|
if (isSettingsScreenPressed.value) {
|
|
LaunchedEffect(Unit) {
|
|
LaunchedEffect(Unit) {
|
|
@@ -153,9 +151,6 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
val navBackStackEntry = navHostController.currentBackStackEntryAsState()
|
|
val navBackStackEntry = navHostController.currentBackStackEntryAsState()
|
|
|
|
|
|
BackHandler {
|
|
BackHandler {
|
|
-// Toast.makeText(
|
|
|
|
-// context, "BackHandler Settings TV - ${isSecondItemFocused.value}", Toast.LENGTH_SHORT
|
|
|
|
-// ).show()
|
|
|
|
if (isSecondItemFocused.value) {
|
|
if (isSecondItemFocused.value) {
|
|
navHostController.popBackStack()
|
|
navHostController.popBackStack()
|
|
isFirstItemPressed.value = true
|
|
isFirstItemPressed.value = true
|
|
@@ -200,8 +195,14 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
// }
|
|
// }
|
|
|
|
|
|
// Spacer(modifier = Modifier.height(16.dp))
|
|
// Spacer(modifier = Modifier.height(16.dp))
|
|
|
|
+
|
|
|
|
+ val settingsStr = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
|
+ context.getString(R.string.settings)
|
|
|
|
+ } else {
|
|
|
|
+ settingsString
|
|
|
|
+ }
|
|
AddTextSettingsTV(
|
|
AddTextSettingsTV(
|
|
- text = "Settings",
|
|
|
|
|
|
+ text = settingsStr,
|
|
size = 28.sp,
|
|
size = 28.sp,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
style = MaterialTheme.typography.headlineLarge,
|
|
style = MaterialTheme.typography.headlineLarge,
|
|
@@ -211,7 +212,7 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
|
|
|
|
AddRowSettingsColumnTV(
|
|
AddRowSettingsColumnTV(
|
|
icon = R.drawable.vpn_protocols3x,
|
|
icon = R.drawable.vpn_protocols3x,
|
|
- text = "VPN Protocols",
|
|
|
|
|
|
+ text = context.getString(R.string.vpn_protocols),
|
|
focusRequester1,
|
|
focusRequester1,
|
|
focusRequester2,
|
|
focusRequester2,
|
|
navHostController,
|
|
navHostController,
|
|
@@ -219,7 +220,7 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
)
|
|
)
|
|
AddRowSettingsSmartTV(
|
|
AddRowSettingsSmartTV(
|
|
icon = R.drawable.smart_connect3x,
|
|
icon = R.drawable.smart_connect3x,
|
|
- text = "Smart Connect",
|
|
|
|
|
|
+ text = context.getString(R.string.smart_connect),
|
|
isRowShown = true,
|
|
isRowShown = true,
|
|
isSheetShown = false,
|
|
isSheetShown = false,
|
|
navHostController,
|
|
navHostController,
|
|
@@ -228,7 +229,7 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
)
|
|
)
|
|
AddRowSwitchTV(
|
|
AddRowSwitchTV(
|
|
icon = R.drawable.adblock3x,
|
|
icon = R.drawable.adblock3x,
|
|
- text = "AdBlock",
|
|
|
|
|
|
+ text = context.getString(R.string.adblock),
|
|
focusRequester3,
|
|
focusRequester3,
|
|
vpnConnectionsUtil
|
|
vpnConnectionsUtil
|
|
)
|
|
)
|
|
@@ -244,22 +245,24 @@ fun SettingsTV(navHostController: NavHostController) {
|
|
// )
|
|
// )
|
|
AddRowSettingsTV(
|
|
AddRowSettingsTV(
|
|
icon = R.drawable.split_tunneling3x,
|
|
icon = R.drawable.split_tunneling3x,
|
|
- text = "Split Tunneling",
|
|
|
|
|
|
+ text = context.getString(R.string.split_tunneling),
|
|
onClick = { navHostController.navigate(ScreenTV.SplitTunnelingTV.route) }
|
|
onClick = { navHostController.navigate(ScreenTV.SplitTunnelingTV.route) }
|
|
)
|
|
)
|
|
AddRowSettingsTV(
|
|
AddRowSettingsTV(
|
|
icon = R.drawable.notification3x,
|
|
icon = R.drawable.notification3x,
|
|
- text = "Notifications",
|
|
|
|
|
|
+ text = context.getString(R.string.notifcation),
|
|
onClick = { navHostController.navigate(ScreenTV.NotificationTV.route) },
|
|
onClick = { navHostController.navigate(ScreenTV.NotificationTV.route) },
|
|
)
|
|
)
|
|
AddRowDarkLightThemeTV(
|
|
AddRowDarkLightThemeTV(
|
|
icon = Icons.Default.DarkMode,
|
|
icon = Icons.Default.DarkMode,
|
|
- text = "Appearance"
|
|
|
|
|
|
+ text = context.getString(R.string.appearance)
|
|
)
|
|
)
|
|
AddLanguageTV(
|
|
AddLanguageTV(
|
|
icon = Icons.Default.Language,
|
|
icon = Icons.Default.Language,
|
|
- text = "Language"
|
|
|
|
- )
|
|
|
|
|
|
+ text = context.getString(R.string.language)
|
|
|
|
+ ) {
|
|
|
|
+ settingsString = it
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -685,7 +688,7 @@ fun ColumnScope.AddRowSettingsColumnTV(
|
|
horizontalAlignment = Alignment.Start
|
|
horizontalAlignment = Alignment.Start
|
|
) {
|
|
) {
|
|
AddTextSettings(
|
|
AddTextSettings(
|
|
- text = "VPN Protocols",
|
|
|
|
|
|
+ text = context.getString(R.string.vpn_protocols),
|
|
size = 18.sp,
|
|
size = 18.sp,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
bottomPadding = 15.dp,
|
|
bottomPadding = 15.dp,
|
|
@@ -943,7 +946,7 @@ fun ColumnScope.AddRowSettingsSmartTV(
|
|
horizontalAlignment = Alignment.Start
|
|
horizontalAlignment = Alignment.Start
|
|
) {
|
|
) {
|
|
AddTextSettings(
|
|
AddTextSettings(
|
|
- text = "Smart Connect",
|
|
|
|
|
|
+ text = context.getString(R.string.smart_connect),
|
|
size = 18.sp,
|
|
size = 18.sp,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
bottomPadding = 20.dp,
|
|
bottomPadding = 20.dp,
|
|
@@ -951,6 +954,20 @@ fun ColumnScope.AddRowSettingsSmartTV(
|
|
style = MaterialTheme.typography.titleMedium
|
|
style = MaterialTheme.typography.titleMedium
|
|
)
|
|
)
|
|
smartConnect.forEach { smart ->
|
|
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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
isButtonFocused = isSmartFocused == smart
|
|
isButtonFocused = isSmartFocused == smart
|
|
Row(
|
|
Row(
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
@@ -1009,7 +1026,7 @@ fun ColumnScope.AddRowSettingsSmartTV(
|
|
unselectedColor = colorResource(id = R.color.gray_icon),)
|
|
unselectedColor = colorResource(id = R.color.gray_icon),)
|
|
)
|
|
)
|
|
Column {
|
|
Column {
|
|
- Text(text = smart,
|
|
|
|
|
|
+ Text(text = smartLingual,
|
|
modifier = Modifier.padding(start = 12.dp),
|
|
modifier = Modifier.padding(start = 12.dp),
|
|
color = MaterialTheme.colorScheme.primary,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
style = MaterialTheme.typography.bodySmall
|
|
style = MaterialTheme.typography.bodySmall
|
|
@@ -1280,7 +1297,7 @@ fun AddRowDarkLightThemeTV(
|
|
horizontalAlignment = Alignment.Start
|
|
horizontalAlignment = Alignment.Start
|
|
) {
|
|
) {
|
|
AddTextSettings(
|
|
AddTextSettings(
|
|
- text = "Appearance",
|
|
|
|
|
|
+ text = context.getString(R.string.appearance),
|
|
size = 18.sp,
|
|
size = 18.sp,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
color = MaterialTheme.colorScheme.primary,
|
|
bottomPadding = 20.dp,
|
|
bottomPadding = 20.dp,
|
|
@@ -1288,6 +1305,18 @@ fun AddRowDarkLightThemeTV(
|
|
style = MaterialTheme.typography.titleSmall
|
|
style = MaterialTheme.typography.titleSmall
|
|
)
|
|
)
|
|
themesList.forEach { theme ->
|
|
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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
isButtonFocused = isSelectedTheme == theme
|
|
isButtonFocused = isSelectedTheme == theme
|
|
Row(
|
|
Row(
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
@@ -1350,7 +1379,7 @@ fun AddRowDarkLightThemeTV(
|
|
selectedColor = colorResource(id = R.color.radio_button_blue),
|
|
selectedColor = colorResource(id = R.color.radio_button_blue),
|
|
unselectedColor = colorResource(id = R.color.gray_icon),)
|
|
unselectedColor = colorResource(id = R.color.gray_icon),)
|
|
)
|
|
)
|
|
- Text(text = theme,
|
|
|
|
|
|
+ Text(text = themeLingual,
|
|
modifier = Modifier.padding(start = 12.dp),
|
|
modifier = Modifier.padding(start = 12.dp),
|
|
style = MaterialTheme.typography.bodySmall,
|
|
style = MaterialTheme.typography.bodySmall,
|
|
color = MaterialTheme.colorScheme.primary
|
|
color = MaterialTheme.colorScheme.primary
|
|
@@ -1368,6 +1397,7 @@ fun AddRowDarkLightThemeTV(
|
|
fun AddLanguageTV(
|
|
fun AddLanguageTV(
|
|
icon: ImageVector,
|
|
icon: ImageVector,
|
|
text: String,
|
|
text: String,
|
|
|
|
+ changeLanguage: (String) -> Unit
|
|
) {
|
|
) {
|
|
var isRowFocused by remember { mutableStateOf(false) }
|
|
var isRowFocused by remember { mutableStateOf(false) }
|
|
var isButtonFocused by remember { mutableStateOf(false) }
|
|
var isButtonFocused by remember { mutableStateOf(false) }
|
|
@@ -1532,7 +1562,7 @@ fun AddLanguageTV(
|
|
},
|
|
},
|
|
context.resources.displayMetrics
|
|
context.resources.displayMetrics
|
|
)
|
|
)
|
|
-// changeLanguage(context.getString(R.string.settings))
|
|
|
|
|
|
+ changeLanguage(context.getString(R.string.settings))
|
|
}
|
|
}
|
|
isLanguageSheetOpen = false
|
|
isLanguageSheetOpen = false
|
|
},
|
|
},
|
|
@@ -1570,7 +1600,7 @@ fun AddLanguageTV(
|
|
},
|
|
},
|
|
context.resources.displayMetrics
|
|
context.resources.displayMetrics
|
|
)
|
|
)
|
|
-// changeLanguage(context.getString(R.string.settings))
|
|
|
|
|
|
+ changeLanguage(context.getString(R.string.settings))
|
|
}
|
|
}
|
|
isLanguageSheetOpen = false
|
|
isLanguageSheetOpen = false
|
|
},
|
|
},
|