Просмотр исходного кода

working on bottom nav bar TV, added settings screen on TV

Khubaib 10 месяцев назад
Родитель
Сommit
45dac1b3e6

+ 1 - 1
.idea/deploymentTargetSelector.xml

@@ -4,7 +4,7 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
-        <DropdownSelection timestamp="2024-06-26T09:24:32.136478466Z">
+        <DropdownSelection timestamp="2024-06-28T11:34:49.550343704Z">
           <Target type="DEFAULT_BOOT">
             <handle>
               <DeviceId pluginId="LocalEmulator" identifier="path=/home/ubuntu/.android/avd/Television_1080p_API_31.avd" />

+ 2 - 1
app/src/main/java/com/vpn/fastestvpnservice/MainActivity.kt

@@ -103,7 +103,8 @@ open class MainActivity : DockActivity(), ConnectivityReceiver.ConnectivityRecei
                     FastestVPNTheme(isDarkTheme.value) {
 //                        window.statusBarColor = colorResource(id = R.color.blue_text).toArgb()
                         val navController = rememberNavController()
-                        SetUpNavGraphTV(navHostController = navController)
+                        SetUpNavGraphTV(navHostController = navController, this)
+//                        SetUpNavGraph(navHostController = navController, this)
                     }
                 } else {
                     Log.d("test_platform_android", "Mobile")

+ 79 - 0
app/src/main/java/com/vpn/fastestvpnservice/navigation/BottomBarNavGraphTV.kt

@@ -0,0 +1,79 @@
+package com.vpn.fastestvpnservice.navigation
+
+import androidx.activity.ComponentActivity
+import androidx.compose.animation.AnimatedContentTransitionScope
+import androidx.compose.animation.EnterTransition
+import androidx.compose.animation.ExitTransition
+import androidx.compose.animation.core.tween
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.runtime.Composable
+import androidx.navigation.NavBackStackEntry
+import androidx.navigation.NavHostController
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import com.vpn.fastestvpnservice.screens.ServerList
+import com.vpn.fastestvpnservice.screens.accountScreensAll.ChangePassword
+import com.vpn.fastestvpnservice.screens.accountScreensAll.FavoriteServers
+import com.vpn.fastestvpnservice.screens.accountScreensAll.SubscriptionScreen
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.Account
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.Help
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.Home
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.Settings
+import com.vpn.fastestvpnservice.screens.helpScreensAll.About
+import com.vpn.fastestvpnservice.screens.helpScreensAll.CustomerSupport
+import com.vpn.fastestvpnservice.screens.helpScreensAll.EmailUsScreen
+import com.vpn.fastestvpnservice.screens.helpScreensAll.FAQ
+import com.vpn.fastestvpnservice.screens.helpScreensAll.PrivacyPolicy
+import com.vpn.fastestvpnservice.screens.helpScreensAll.TermsAndConditions
+import com.vpn.fastestvpnservice.screens.settingsScreenAll.Notifications
+import com.vpn.fastestvpnservice.screens.settingsScreenAll.SplitTunneling
+import com.vpn.fastestvpnservice.screensTV.HomeTV
+import com.vpn.fastestvpnservice.screensTV.SettingsTV
+import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
+import com.vpn.fastestvpnservice.sealedClass.Screen
+
+@Composable
+fun BottomBarNavGraphTV(navHostController: NavHostController,
+                      settingsNavHostController: NavHostController,
+                      activity: ComponentActivity
+) {
+    val noEnterTransition : AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition = {
+        fadeIn(
+            animationSpec = tween(durationMillis = 0),
+            initialAlpha = 1f
+        )
+    }
+
+    val noExitTransition : AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition = {
+        fadeOut(
+            animationSpec = tween(durationMillis = 0),
+            targetAlpha = 1f
+        )
+    }
+    NavHost(
+        navController = navHostController,
+        startDestination = BottomBarScreen.Home.route,
+        enterTransition = noEnterTransition,
+        exitTransition = noExitTransition
+    ) {
+
+        composable(route = BottomBarScreen.Home.route) {
+            HomeTV(navHostController = navHostController)
+        }
+        composable(route = BottomBarScreen.Settings.route) {
+            SettingsTV(navHostController = navHostController)
+        }
+        composable(route = BottomBarScreen.Help.route) { entry ->
+            HomeTV(navHostController = navHostController)
+        }
+        composable(route = BottomBarScreen.Account.route) {
+            HomeTV(navHostController = navHostController,)
+        }
+
+        /* Again declare for login because of different -> navHostController */
+//        composable(route = Screen.Login.route) {
+//            Login(navHostController = navHostController)
+//        }
+    }
+}

+ 10 - 1
app/src/main/java/com/vpn/fastestvpnservice/navigation/NavGraphTV.kt

@@ -1,5 +1,6 @@
 package com.vpn.fastestvpnservice.navigation
 
+import androidx.activity.ComponentActivity
 import androidx.compose.animation.AnimatedContentTransitionScope
 import androidx.compose.animation.EnterTransition
 import androidx.compose.animation.ExitTransition
@@ -13,12 +14,14 @@ import androidx.navigation.compose.NavHost
 import androidx.navigation.compose.composable
 import com.vpn.fastestvpnservice.screens.Splash
 import com.vpn.fastestvpnservice.screens.helpScreensAll.TermsAndConditions
+import com.vpn.fastestvpnservice.screensTV.BottomBarMainScreenTV
+import com.vpn.fastestvpnservice.screensTV.HomeTV
 import com.vpn.fastestvpnservice.screensTV.LoginTV
 import com.vpn.fastestvpnservice.screensTV.SplashTV
 import com.vpn.fastestvpnservice.sealedClass.ScreenTV
 
 @Composable
-fun SetUpNavGraphTV(navHostController: NavHostController) {
+fun SetUpNavGraphTV(navHostController: NavHostController, activity: ComponentActivity) {
     val noEnterTransition : AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition = {
         fadeIn(
             animationSpec = tween(durationMillis = 0),
@@ -44,5 +47,11 @@ fun SetUpNavGraphTV(navHostController: NavHostController) {
         composable(route = ScreenTV.LoginTV.route) {
             LoginTV(navHostController = navHostController)
         }
+        composable(route = ScreenTV.HomeTV.route) {
+            HomeTV(navHostController = navHostController)
+        }
+        composable(route =  ScreenTV.BottomBarTV.route) {
+            BottomBarMainScreenTV(navHostController = navHostController, activity)
+        }
     }
 }

+ 16 - 1
app/src/main/java/com/vpn/fastestvpnservice/screens/BottomBarMainScreen.kt

@@ -4,11 +4,15 @@ import android.app.Activity
 import android.content.res.Configuration
 import android.util.Log
 import androidx.activity.ComponentActivity
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.RowScope
 import androidx.compose.foundation.layout.height
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.material.BottomNavigation
 import androidx.compose.material.BottomNavigationItem
 import androidx.compose.material3.Icon
@@ -23,10 +27,12 @@ import androidx.compose.runtime.remember
 import androidx.compose.runtime.setValue
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.focus.onFocusChanged
 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
 import androidx.compose.ui.tooling.preview.Preview
 import androidx.compose.ui.unit.dp
@@ -37,6 +43,7 @@ import androidx.navigation.NavGraph.Companion.findStartDestination
 import androidx.navigation.NavHostController
 import androidx.navigation.compose.currentBackStackEntryAsState
 import androidx.navigation.compose.rememberNavController
+import com.vpn.fastestvpnservice.R
 import com.vpn.fastestvpnservice.navigation.BottomBarNavGraph
 import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
 import com.vpn.fastestvpnservice.ui.theme.customTypography2
@@ -94,7 +101,11 @@ fun BottomBar(navHostController: NavHostController, screens: List<BottomBarScree
         backgroundColor = MaterialTheme.colorScheme.onBackground,
         elevation = 0.dp,
 //        contentColor = Color.Gray,
-        modifier = Modifier.height(if (StaticMethods.isTV(context)) 90.dp else if (isTablet()) 150.dp else 110.dp)
+        modifier = Modifier
+            .height(if (StaticMethods.isTV(context)) 90.dp else if (isTablet()) 150.dp else 110.dp)
+//            .border(
+//                1.dp, colorResource(id = R.color.blue_text), RoundedCornerShape (15.dp)
+//            )
     ) {
         screens.forEach { screen ->
             AddItem(
@@ -137,6 +148,10 @@ fun RowScope.AddItem(
         isClicked = false
     }
     BottomNavigationItem(
+        modifier = Modifier
+            .onFocusChanged {
+                            isClicked = true
+        },
         label = {
             if (currentDestination?.route == screen.route) {
                 Text(

+ 223 - 0
app/src/main/java/com/vpn/fastestvpnservice/screensTV/BottomBarMainScreenTV.kt

@@ -0,0 +1,223 @@
+package com.vpn.fastestvpnservice.screensTV
+
+import android.app.Activity
+import android.util.Log
+import androidx.activity.ComponentActivity
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.RowScope
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
+import androidx.compose.material.BottomNavigation
+import androidx.compose.material.BottomNavigationItem
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.focus.onFocusChanged
+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
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavDestination
+import androidx.navigation.NavDestination.Companion.hierarchy
+import androidx.navigation.NavGraph.Companion.findStartDestination
+import androidx.navigation.NavHostController
+import androidx.navigation.compose.currentBackStackEntryAsState
+import androidx.navigation.compose.rememberNavController
+import com.vpn.fastestvpnservice.R
+import com.vpn.fastestvpnservice.navigation.BottomBarNavGraph
+import com.vpn.fastestvpnservice.navigation.BottomBarNavGraphTV
+import com.vpn.fastestvpnservice.screens.BottomBar
+import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
+import com.vpn.fastestvpnservice.ui.theme.customTypography2
+import com.vpn.fastestvpnservice.utils.StaticMethods
+import com.vpn.fastestvpnservice.utils.isTablet
+
+@Composable
+fun BottomBarMainScreenTV(navHostController: NavHostController, activity: ComponentActivity) {
+    val navController1 = rememberNavController()
+    var isBottomBarVisible by remember { mutableStateOf(true) }
+
+    val screens = listOf(
+        BottomBarScreen.Home,
+        BottomBarScreen.Settings,
+        BottomBarScreen.Help,
+        BottomBarScreen.Account
+    )
+
+    navController1.addOnDestinationChangedListener { _,_,_ ->
+        isBottomBarVisible = navController1.currentDestination?.route in listOf(
+            screens[0].route, screens[1].route, screens[2].route, screens[3].route)
+    }
+
+    Scaffold (
+        bottomBar = {
+            if (isBottomBarVisible) {
+                BottomBarTV(navController1, screens)
+            }
+        },
+        content = { padding ->
+            Box(modifier = Modifier.padding(padding)) {
+                val view = LocalView.current
+                val window = (view.context as Activity).window
+                window.statusBarColor = Color.Transparent.toArgb()
+                window.navigationBarColor = Color.Transparent.toArgb()
+
+                BottomBarNavGraphTV(navHostController = navController1,
+                    settingsNavHostController = navHostController,
+                    activity)
+            }
+        }
+    )
+}
+
+@Composable
+fun BottomBarTV(navHostController: NavHostController, screens: List<BottomBarScreen>) {
+
+    val context = LocalContext.current
+    val navBackStackEntry = navHostController.currentBackStackEntryAsState()
+    val currentDestination = navBackStackEntry.value?.destination
+    Log.d("currentRoute -> BB ", currentDestination.toString())
+
+    BottomNavigation (
+//        backgroundColor = MaterialTheme.colorScheme.onBackground,
+        backgroundColor = colorResource(id = R.color.white),
+
+        elevation = 0.dp,
+//        contentColor = Color.Gray,
+        modifier = Modifier
+            .height(if (StaticMethods.isTV(context)) 90.dp else if (isTablet()) 150.dp else 110.dp)
+//            .border(
+//                1.dp, colorResource(id = R.color.blue_text), RoundedCornerShape (15.dp)
+//            )
+    ) {
+        screens.forEach { screen ->
+            AddItemTV(
+                screen = screen,
+                currentDestination = currentDestination,
+                navHostController = navHostController
+            )
+        }
+    }
+}
+
+@Composable
+fun RowScope.AddItemTV(
+    screen: BottomBarScreen,
+    currentDestination: NavDestination?,
+    navHostController: NavHostController
+) {
+    var isClicked by remember { mutableStateOf(false) }
+    val route = currentRouteTV(navController = navHostController)
+    Log.d("currentRoute -> ", route.toString())
+
+    if (isClicked) {
+        if (currentDestination?.route != screen.route) {
+            Log.d("test_bottom_navbar",
+                "currentDestination -> " + currentDestination?.route
+                        + "Screen Clicked -> " + screen.route
+            )
+
+            LaunchedEffect(Unit) {
+                navHostController.navigate(screen.route) {
+                    popUpTo(
+                        navHostController.graph
+                            .findStartDestination().id) {
+                        saveState = true
+                    }
+                    launchSingleTop = true
+                }
+            }
+        }
+        isClicked = false
+    }
+    BottomNavigationItem(
+        modifier = Modifier
+            .onFocusChanged {
+                isClicked = true
+            },
+        label = {
+            if (currentDestination?.route == screen.route) {
+                Text(
+                    text = screen.title,
+                    style = MaterialTheme.typography.customTypography2.bodyLarge.copy(
+                        fontSize = if (isTablet()) 15.sp else 11.sp
+                    ),
+//                    color = MaterialTheme.colorScheme.tertiary,
+                    color = colorResource(id = R.color.blue_text),
+                    )
+            }
+            else {
+                Text(text = screen.title,
+                    style = MaterialTheme.typography.customTypography2.bodyLarge.copy(
+                        fontSize = if (isTablet()) 15.sp else 11.sp
+                    ),
+//                    color = MaterialTheme.colorScheme.onTertiary,
+                    color = colorResource(id = R.color.dark_blue_gray_text),
+                    modifier = Modifier.alpha(0.5F)
+                )
+            }
+        },
+        alwaysShowLabel = true,
+        selected = currentDestination?.hierarchy?.any{
+            it.route == screen.route
+        } == true,
+        onClick = {
+            isClicked = true
+
+            /* First time currentDestination is different when on BottomBar Item */
+
+        },
+        icon = {
+            val iconWidth = if (isTablet()) 50.dp else 45.dp
+            val iconHeight = if (isTablet()) 44.dp else 39.dp
+            if (currentDestination?.route == screen.route) {
+                Icon(
+                    painter = painterResource(id = screen.icon),
+                    contentDescription = "Navigation Icon",
+//                    tint = MaterialTheme.colorScheme.tertiary,
+                    tint = colorResource(id = R.color.blue_text),
+                    modifier = Modifier
+                        .size(iconWidth, iconHeight)
+                        .padding(top = 9.dp, bottom = if (isTablet()) 6.dp else 4.dp)
+
+                )
+            }
+            else {
+                Icon(
+                    painter = painterResource(id = screen.icon),
+                    contentDescription = "Navigation Icon",
+//                    tint = MaterialTheme.colorScheme.onTertiary,
+                    tint = colorResource(id = R.color.dark_blue_gray_text),
+                    modifier = Modifier
+                        .size(iconWidth, iconHeight)
+                        .padding(top = 9.dp, bottom = if (isTablet()) 6.dp else 4.dp)
+                        .alpha(0.5F))
+            }
+
+        },
+//        unselectedContentColor = MaterialTheme.colorScheme.onBackground,
+//        selectedContentColor = MaterialTheme.colorScheme.onBackground
+        unselectedContentColor = colorResource(id = R.color.white),
+        selectedContentColor = colorResource(id = R.color.white),
+    )
+}
+
+@Composable
+fun currentRouteTV(navController: NavHostController): String? {
+    val navBackStackEntry = navController.currentBackStackEntryAsState()
+    return navBackStackEntry.value?.arguments?.getString("KEY_ROUTE")
+}

+ 702 - 0
app/src/main/java/com/vpn/fastestvpnservice/screensTV/HomeScreenTV.kt

@@ -0,0 +1,702 @@
+package com.vpn.fastestvpnservice.screensTV
+
+import android.content.Context
+import android.content.Intent
+import android.util.Log
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.gestures.detectTapGestures
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxHeight
+import androidx.compose.foundation.layout.fillMaxSize
+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.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.text.ClickableText
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.livedata.observeAsState
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.draw.paint
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.ColorFilter
+import androidx.compose.ui.graphics.painter.Painter
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.AnnotatedString
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.constraintlayout.compose.ConstraintLayout
+import androidx.constraintlayout.compose.Dimension
+import androidx.lifecycle.viewmodel.compose.viewModel
+import androidx.navigation.NavHostController
+import com.vpn.fastestvpnservice.R
+import com.vpn.fastestvpnservice.beans.isDarkTheme
+import com.vpn.fastestvpnservice.beans.toChangeServer
+import com.vpn.fastestvpnservice.constants.AppEnum
+import com.vpn.fastestvpnservice.constants.smartConnect
+import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.AddRowSelectServer
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.AddText
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.ColumnText
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.blueBackground
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.isServerDialog
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.serverObj
+import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.vpnConnectionsUtil
+import com.vpn.fastestvpnservice.sealedClass.Screen
+import com.vpn.fastestvpnservice.ui.theme.customTypography
+import com.vpn.fastestvpnservice.utils.Utils
+import com.vpn.fastestvpnservice.utils.isTablet
+import com.vpn.fastestvpnservice.viewmodels.HomeViewModel
+import com.vpn.fastestvpnservice.widgets.SimpleAppWidget
+import de.blinkt.openvpn.core.App
+
+@Composable
+fun HomeTV(navHostController: NavHostController) {
+
+    val context = LocalContext.current
+    val basePreferenceHelper = BasePreferenceHelper(context)
+    val prefHelper = BasePreferenceHelper(context)
+    val scope = rememberCoroutineScope()
+    val homeViewModel: HomeViewModel = viewModel{
+        HomeViewModel(context, scope)
+    }
+    var isConnect: Int? = homeViewModel.isConnect.observeAsState().value
+    isConnect = basePreferenceHelper.getConnectState()
+
+    Column(
+        modifier = Modifier
+            .background(colorResource(id = R.color.background_color_gray))
+            .fillMaxSize(),
+    ) {
+        // 1st box
+        ConstraintLayout(modifier = Modifier
+            .fillMaxSize()
+            .weight(0.6f)
+//            .background(Color.Green)
+        )
+        {
+            val (firstComposable, secondComposable) = createRefs()
+            val guideline = createGuidelineFromTop(0.6f)
+            Box(
+                modifier = Modifier
+                    .constrainAs(firstComposable) {
+                        top.linkTo(parent.top)
+                        bottom.linkTo(guideline)
+                        start.linkTo(parent.start)
+                        end.linkTo(parent.end)
+                        width = Dimension.fillToConstraints
+                        height = Dimension.fillToConstraints
+                    }
+                    .background(Color.Transparent)
+            ) {
+                Image(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .fillMaxHeight()
+                        .padding(top = 0.dp),
+//                    painter = if (isConnect == App.CONNECTED) blueBackgroundTV() else pinkBackgroundTV(),
+                    painter = if (isConnect == App.CONNECTED) painterResource(id = R.drawable.bluebackground3x)
+                    else painterResource(id = R.drawable.pinkbackground3x),
+                    contentDescription = "Background Color",
+                    contentScale = ContentScale.FillBounds,
+                )
+                Image(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .fillMaxHeight()
+                        .padding(bottom = 0.dp)
+//                        .alpha(if (isDarkTheme.value) 0.1F else 0.6F),
+                        .alpha(0.6F),
+                    painter = painterResource(id = R.drawable.map_home3x),
+                    contentDescription = "Home Map",
+                    contentScale = ContentScale.FillWidth,
+                )
+                Column(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .fillMaxHeight()
+                        .padding(bottom = 115.dp)
+//                            .offset(y = -(118).dp)
+                        .background(Color.Transparent),
+                    horizontalAlignment = Alignment.CenterHorizontally,
+                    verticalArrangement = if (isTablet()) Arrangement.Bottom else Arrangement.SpaceEvenly
+                ) {
+                    val serverObj = basePreferenceHelper.getConnectedServer()
+                    val serverDis = basePreferenceHelper.getIpinfo()
+
+                    var ipInfo = homeViewModel.mutableLiveDataIpInfo.observeAsState().value?.query
+                    ipInfo = if (isConnect == App.CONNECTED) serverObj?.ip.toString() else serverDis?.query
+                    AddText(
+                        text = "IP ${ipInfo ?: ""}",
+                        size = 18.sp,
+//                        color = MaterialTheme.colorScheme.primary,
+                        color = colorResource(id = R.color.dark_blue_gray_text),
+                        style = MaterialTheme.typography.customTypography.headlineLarge.copy(
+                            fontSize = if (isTablet()) 24.sp else 18.sp
+                        )
+                    )
+                    Row(
+                    ) {
+                        if (isConnect == App.CONNECTED) {
+                            val image = Utils.getDrawable(context, serverObj?.iso)
+                            if (image != 0) {
+                                Image(
+                                    painter = painterResource(id = image),
+                                    contentDescription = "Country",
+                                    modifier = Modifier
+                                        .padding(end = 6.dp)
+                                        .size(if (isTablet()) 26.dp else 20.dp)
+                                        .clip(CircleShape)
+                                        .paint(
+                                            painter = painterResource(id = image),
+                                            contentScale = ContentScale.FillBounds
+                                        )
+                                )
+                            }
+                            AddText(
+                                text = "${serverObj?.server_name ?: ""}, ${serverObj?.country ?: ""}",
+                                size = 16.sp,
+                                color = colorResource(id = R.color.dark_blue_gray_text),
+                                isTablet()
+                            )
+                        } else {
+                            val image = Utils.getDrawable(context, serverDis?.countryCode)
+                            Log.d("image_logo", "$image ${serverDis?.countryCode}")
+                            if (image != 0) {
+                                Image(
+                                    painter = painterResource(id = image),
+                                    contentDescription = "Server",
+                                    modifier = Modifier
+                                        .padding(end = 6.dp)
+                                        .size(if (isTablet()) 26.dp else 20.dp)
+                                        .clip(CircleShape)
+                                        .paint(
+                                            painter = painterResource(id = image),
+                                            contentScale = ContentScale.FillBounds
+                                        )
+                                )
+                            }
+                            AddText(
+                                text = "${serverDis?.city ?: ""}, ${serverDis?.country ?: ""}",
+                                size = 16.sp,
+                                color = colorResource(id = R.color.dark_blue_gray_text),
+                                isTablet()
+                            )
+                        }
+                    }
+                    if (isConnect == App.CONNECTED) {
+                        AddText(
+                            text = "Connected",
+                            size = 18.sp,
+//                            color = MaterialTheme.colorScheme.surfaceContainerHigh,
+                            color = colorResource(id = R.color.light_blue_2),
+                            style = MaterialTheme.typography.customTypography.displaySmall.copy(
+                                fontSize = if (isTablet()) 24.sp else 18.sp
+                            )
+                        )
+                    }
+                    else if (isConnect == App.DISCONNECTED) {
+                        AddText(
+                            text = "Disconnected",
+                            size = 18.sp,
+//                            color = MaterialTheme.colorScheme.surfaceTint,
+                            color = colorResource(id = R.color.maroon_text),
+                            style = MaterialTheme.typography.customTypography.displaySmall.copy(
+                                fontSize = if (isTablet()) 24.sp else 18.sp
+                            )
+                        )
+                    }
+                    else if (isConnect == App.CONNECTING) {
+                        AddText(
+                            text = "Connecting...",
+                            size = 18.sp,
+//                            color = MaterialTheme.colorScheme.surfaceTint,
+                            color = colorResource(id = R.color.maroon_text),
+                            style = MaterialTheme.typography.customTypography.displaySmall.copy(
+                                fontSize = if (isTablet()) 24.sp else 18.sp
+                            )
+                        )
+                    }
+                }
+            }
+            Box(
+                modifier = Modifier
+                    .constrainAs(secondComposable) {
+                        top.linkTo(guideline)
+                        bottom.linkTo(firstComposable.bottom)
+                        start.linkTo(parent.start)
+                        end.linkTo(parent.end)
+                        width = Dimension.value(234.dp)
+                        height = Dimension.value(234.dp)
+                    }
+                    .background(Color.Transparent)
+            ) {
+                IconButton(
+                    onClick = {
+                        val connectedServer = basePreferenceHelper.getConnectedServer()
+                        val serverObject = basePreferenceHelper.getServerObject()
+                        Log.d("test_conn_ser_obj", "cs = ${connectedServer?.server_name} so = ${serverObject?.server_name}")
+                        Log.d("isConnect_State", "onClick{} -> $isConnect")
+                        Log.d("isConnect_State_vpn", "onClick{} -> $isConnect")
+                        prefHelper.getProduct()?.identifier.let {
+                            val identifier = it
+
+                            if (identifier == AppEnum.FREE.key) {
+                                Log.d("isConnect_State", "identifier -> $identifier")
+                                Screen.Subscription.isTrue = true
+                                navHostController.navigate(
+                                    Screen.Subscription.route
+                                )
+
+                            }
+                            else {
+
+                                prefHelper.getServerObject()?.let {
+                                    prefHelper.setConnectedServer(it)
+                                }
+                                Log.d("isConnect_State", "identifier -> $identifier")
+                                if (isConnect == App.CONNECTED || isConnect == App.CONNECTING) {
+                                    Log.d("isConnect_State_vpn", "stopVPN")
+                                    vpnConnectionsUtil.stopVpn()
+                                    homeViewModel.getIp()
+                                } else {
+                                    Log.d("isConnect_State_vpn", "startVPN")
+
+                                    if (basePreferenceHelper.getServerObject() != null) {
+                                        vpnConnectionsUtil.startVpn()
+                                    }
+                                    else {
+                                        toChangeServer.value = false
+                                        navHostController.navigate(
+                                            Screen.ServerList.route
+                                        )
+                                        Screen.ServerList.isTrue = true
+                                        Log.d("button_click_change", "Pressed")
+                                    }
+                                }
+
+
+
+                                val widgetIntent = Intent(context, SimpleAppWidget::class.java)
+                                widgetIntent.action = SimpleAppWidget.ACTION_CHANGE_SERVER
+                                context.sendBroadcast(widgetIntent)
+                            }
+                        }
+                    },
+                    modifier = Modifier
+                        .padding(bottom = 0.dp)
+                        .size(234.dp),
+                )
+                {
+                    if (isConnect == App.CONNECTED) {
+                        Image(
+//                            painter = if (isDarkTheme.value) painterResource(id = R.drawable.iv_connect_dark)
+//                            else painterResource(id = R.drawable.iv_connect),
+                            painter = painterResource(id = R.drawable.iv_connect),
+                            contentDescription = "Home Map",
+                            contentScale = ContentScale.FillBounds,
+                            modifier = Modifier.fillMaxSize()
+                        )
+                    } else {
+                        Image(
+//                            painter = if (isDarkTheme.value) painterResource(id = R.drawable.iv_disconnect_dark)
+//                            else painterResource(id = R.drawable.iv_disconnect),
+                            painter = painterResource(id = R.drawable.iv_disconnect),
+                            contentDescription = "Home Map",
+                            contentScale = ContentScale.FillBounds,
+                            modifier = Modifier.fillMaxSize()
+                        )
+                    }
+                }
+            }
+        }
+
+        // 2nd box
+        Box(
+            modifier = Modifier
+                .background(colorResource(id = R.color.background_color_gray))
+//                .background(Color.Blue)
+                .fillMaxSize()
+                .weight(0.4f)
+//                .background(Color.Gray),
+        ) {
+            Column(
+                modifier = Modifier.fillMaxSize(),
+                verticalArrangement = Arrangement.Top
+            ) {
+
+                Box(
+                    modifier = Modifier
+                        .fillMaxWidth(fraction = if (isTablet()) 0.5f else 1f)
+                        .padding(horizontal = 20.dp)
+                        .padding(vertical = 5.dp)
+                        .height(120.dp)
+                        .border(
+                            border = BorderStroke(2.dp, colorResource(id = R.color.white)),
+                            shape = RoundedCornerShape(28.dp)
+                        )
+                        .background(
+                            shape = RoundedCornerShape(28.dp),
+                            color = colorResource(id = R.color.white)
+                        )
+                        .align(Alignment.CenterHorizontally),
+                ) {
+                    AddRowSmartTV(navHostController, basePreferenceHelper, context, isTablet())
+                    var smartServer = basePreferenceHelper.getSmartServerObject()
+                    val recommended = basePreferenceHelper.getRecommendedServerObject()
+                    val selectedSmartList = basePreferenceHelper.getSmartList()
+                    when(selectedSmartList) {
+                        smartConnect[0] -> {
+                            smartServer = basePreferenceHelper.getRecommendedServerObject()
+                        }
+                        smartConnect[1] -> {
+                            smartServer = basePreferenceHelper.getSmartServerObject() ?: recommended
+                        }
+                        smartConnect[2] -> {
+                            smartServer = basePreferenceHelper.getSmartServerObject() ?: recommended
+                        }
+                        else -> {}
+                    }
+                    Button(
+                        onClick = {
+                            Log.d("test_button", "onClick Smart Connect ${smartServer?.server_name}")
+                            basePreferenceHelper.setSmartServerObject(smartServer)
+//                            basePreferenceHelper.setConnectedServer(smartServer)
+
+                            if (isConnect == App.CONNECTED) {
+                                Log.d("isConnect_State_vpn", "stopVPN")
+                                val lastServer = basePreferenceHelper.getConnectedServer()
+                                Log.d("test_conn_ser_obj", "smart => ${lastServer?.server_name} ${smartServer?.server_name}")
+
+                                if (lastServer?.id != smartServer?.id) {
+                                    isServerDialog.value = true
+                                    if (smartServer != null) {
+                                        serverObj.value = smartServer
+                                    }
+//                                    basePreferenceHelper.setConnectedServer(smartServer)
+
+                                }
+                                else {
+                                    vpnConnectionsUtil.stopVpn()
+                                }
+
+
+//                                vpnConnectionsUtil.stopVpn()
+//                                Handler().postDelayed(Runnable {
+//                                    vpnConnectionsUtil.startVpn()
+//                                }, 500)
+//                                homeViewModel.getIp()
+                            }
+                            else if (isConnect == App.CONNECTING) {
+                                vpnConnectionsUtil.stopVpn()
+                            }
+                            else if (isConnect == App.DISCONNECTED) {
+                                Log.d("isConnect_State_vpn", "startVPN")
+                                basePreferenceHelper.setConnectedServer(smartServer)
+                                if (smartServer != null) {
+//                                serverListViewModel.setRecentlyConnectedServer(smartServer)
+                                }
+                                vpnConnectionsUtil.startVpn()
+                            }
+
+//                                navHostController.navigate(
+//                                    BottomBarScreen.Settings.route
+//                                )
+//                                BottomBarScreen.Settings.isTrue = true
+
+                        },
+                        modifier = Modifier
+                            .padding(start = 14.dp, end = 14.dp, bottom = 12.dp, top = 16.dp)
+                            .align(Alignment.BottomCenter)
+                            .background(colorResource(id = R.color.transparent))
+                            .fillMaxWidth()
+                            .height(40.dp),
+                        shape = RoundedCornerShape(16.dp),
+                        colors = ButtonDefaults.buttonColors(
+                            contentColor = colorResource(id = R.color.white),
+                            containerColor = colorResource(id = R.color.blue_text),
+                        ),
+                    ) {
+                        Text(
+                            text = "Smart Connect",
+                            style = MaterialTheme.typography.customTypography.labelLarge.copy(
+                                fontSize = if (isTablet()) 21.sp else 18.sp
+                            ),
+                            modifier = Modifier.background(Color.Transparent)
+                        )
+                    }
+                }
+
+                /* Select Server Box*/
+//                if (isConnect != App.CONNECTED) { }
+
+//                Spacer(modifier = Modifier.weight(1f))
+
+                Box(
+                    modifier = Modifier
+                        .fillMaxWidth(fraction = if (isTablet()) 0.5f else 1f)
+                        .padding(horizontal = 20.dp, vertical = 5.dp)
+                        .padding(top = 0.dp)
+                        .height(70.dp)
+                        .border(
+                            border = BorderStroke(2.dp, colorResource(id = R.color.white)),
+                            shape = RoundedCornerShape(28.dp)
+                        )
+                        .background(
+                            shape = RoundedCornerShape(28.dp),
+//                            color = MaterialTheme.colorScheme.onBackground
+                            color = colorResource(id = R.color.white)
+                        )
+                        .align(Alignment.CenterHorizontally),
+                    contentAlignment = Alignment.CenterStart,
+                ) {
+                    AddRowSelectServerTV(navHostController, isTablet())
+                }
+            }
+        }
+    }
+}
+
+@Composable
+fun BoxScope.AddRowSmartTV(
+    navHostController: NavHostController,
+    basePreferenceHelper: BasePreferenceHelper,
+    context: Context,
+    isTablet: Boolean
+) {
+    val smart = basePreferenceHelper.getSmartServerObject()
+    val recommended = basePreferenceHelper.getRecommendedServerObject()
+    val recently = basePreferenceHelper.getConnectedServer()
+    val anySpecific = basePreferenceHelper.getSmartServerObject()
+
+    val ipInfo = basePreferenceHelper.getIpinfo()
+    val selectedSmartList = basePreferenceHelper.getSmartList()
+    var selectedServer = basePreferenceHelper.getRecommendedServerObject()
+    var selectedSmartServer = basePreferenceHelper.getSmartServerObject()
+
+    Log.d("smartLocationList", "Home:: server = ${selectedServer?.server_name}")
+    var icon = Utils.getDrawable(context, selectedServer?.iso)
+
+//    if (MainActivity.isSelectedServersShown) {
+//        selectedServer = basePreferenceHelper.getServerObject()
+//        icon = Utils.getDrawable(context, selectedServer?.iso)
+//
+//        when(selectedSmartList) {
+//            smartConnect[0] -> {
+//                selectedSmartServer = recommended
+//            }
+//        }
+//
+//    } else {
+//
+//    }
+
+    when(selectedSmartList) {
+        smartConnect[0] -> {
+            icon = Utils.getDrawable(context, recommended?.iso)
+            selectedServer = recommended
+            selectedSmartServer = recommended
+        }
+        smartConnect[1] -> {
+            icon = Utils.getDrawable(context, recently?.iso ?: recommended?.iso)
+            selectedServer = recently ?: recommended
+            selectedSmartServer = recently
+        }
+        smartConnect[2] -> {
+            icon = Utils.getDrawable(context, anySpecific?.iso ?: recommended?.iso)
+            selectedServer = anySpecific ?: recommended
+            selectedSmartServer = anySpecific
+        }
+        else -> {}
+    }
+
+//    basePreferenceHelper.setSmartServerObject(selectedSmartServer)
+
+    Row(
+        modifier = Modifier
+            .fillMaxWidth()
+            .padding(15.dp)
+            .background(Color.Transparent),
+        horizontalArrangement = Arrangement.Start,
+        verticalAlignment = Alignment.CenterVertically
+    ) {
+
+        Surface(
+            modifier = Modifier.padding(start = 0.dp),
+            color = Color.Transparent
+        ) {
+            if (icon != 0) {
+                Icon(
+                    painter = painterResource(id = icon),
+                    contentDescription = "Country Logo",
+                    tint = Color.Unspecified,
+                    modifier = Modifier
+                        .padding(start = 0.dp)
+                        .size(40.dp)
+                        .weight(1f)
+                        .clip(CircleShape)
+                        .border(1.dp, colorResource(id = R.color.gray_opac_04), CircleShape)
+                        .paint(
+                            painter = painterResource(id = icon),
+                            contentScale = ContentScale.FillBounds
+                        )
+                )
+            }
+        }
+        Column(
+            modifier = Modifier
+                .padding(start = 12.dp)
+
+        ) {
+            ColumnText(
+                text = selectedSmartList,
+//                color = MaterialTheme.colorScheme.surfaceContainerLow,
+                color = colorResource(id = R.color.blue_text),
+                size = 12.sp,
+                style = MaterialTheme.typography.customTypography.headlineSmall.copy(
+                    fontSize = if (isTablet()) 16.sp else 12.sp
+                )
+            )
+            ColumnText(
+                text = "${selectedServer?.server_name}",
+//                color = MaterialTheme.colorScheme.primary,
+                color = colorResource(id = R.color.dark_blue_gray_text),
+                size = 16.sp,
+                style = MaterialTheme.typography.labelMedium.copy(
+                    fontSize = if (isTablet()) 20.sp else 16.sp
+                )
+            )
+        }
+        Spacer(modifier = Modifier.weight(1F))
+        Surface(
+            modifier = Modifier.padding(start = 15.dp),
+            color = Color.Transparent
+        ) {
+            ClickableText(
+                text = AnnotatedString("Change"),
+                style = MaterialTheme.typography.customTypography.headlineMedium.copy(
+//                    MaterialTheme.colorScheme.surfaceContainerLow,
+                    color = colorResource(id = R.color.blue_text),
+                    fontSize = if (isTablet()) 20.sp else 14.sp
+                ),
+                onClick = {
+                    toChangeServer.value = true
+                    navHostController.navigate(
+                        Screen.ServerList.route
+                    )
+                    Screen.ServerList.isTrue = false
+                    Log.d("button_click_change", "Pressed")
+                },
+            )
+        }
+    }
+}
+
+@Composable
+fun BoxScope.AddRowSelectServerTV(navHostController: NavHostController, isTablet: Boolean) {
+    Row(
+        modifier = Modifier
+            .fillMaxWidth()
+            .padding(15.dp)
+            .background(Color.Transparent)
+            .pointerInput(Unit) {
+                detectTapGestures {
+                    toChangeServer.value = false
+                    navHostController.navigate(
+                        Screen.ServerList.route
+                    )
+                    Screen.ServerList.isTrue = true
+                    Log.d("button_click_change", "Pressed")
+                }
+            }
+//            .clickable {
+//                Log.d("test_server_button", "ServerTab Clicked")
+//            }
+        ,
+        horizontalArrangement = Arrangement.Start,
+        verticalAlignment = Alignment.CenterVertically
+    ) {
+
+        Surface(
+            modifier = Modifier.padding(start = 0.dp),
+            color = Color.Transparent
+        ) {
+            Image(
+                painter = painterResource(id = R.drawable.worldmap3x),
+                contentDescription = "World",
+                modifier = Modifier
+                    .padding(start = 0.dp)
+                    .size(40.dp)
+                    .weight(1f)
+            )
+        }
+        Surface(
+            modifier = Modifier.padding(start = 0.dp),
+            color = Color.Transparent
+        ) {
+            Text(text = "See All Locations",
+                style = MaterialTheme.typography.labelMedium.copy(
+                    fontSize = if (isTablet()) 20.sp else 16.sp
+                ),
+//                color = MaterialTheme.colorScheme.primary,
+                color = colorResource(id = R.color.dark_blue_gray_text),
+                maxLines = 2,
+                modifier = Modifier
+                    .padding(start = 12.dp, end = 0.dp)
+                    .weight(1f)
+            )
+        }
+        Spacer(modifier = Modifier.weight(1F))
+        Surface(
+            modifier = Modifier.padding(start = 15.dp),
+            color = Color.Transparent
+
+        ) {
+            Image(
+                painter = painterResource(id = R.drawable.frontarrow3x),
+                contentDescription = "Front_Arrow",
+                colorFilter = ColorFilter.tint(colorResource(id = R.color.gray_icon)),
+                modifier = Modifier
+                    .padding(start = 0.dp, end = 5.dp)
+                    .size(10.dp, 18.dp)
+                    .weight(1f),
+            )
+        }
+
+    }
+}
+@Composable
+fun pinkBackgroundTV(): Painter {
+    return if (isDarkTheme.value) painterResource(id = R.drawable.darkpinkbackground)
+    else painterResource(id = R.drawable.pinkbackground3x)
+}
+
+@Composable
+fun blueBackgroundTV(): Painter {
+    return if (isDarkTheme.value) painterResource(id = R.drawable.darkbluebackground)
+    else painterResource(id = R.drawable.bluebackground3x)
+}

+ 45 - 31
app/src/main/java/com/vpn/fastestvpnservice/screensTV/LoginScreenTV.kt

@@ -1,11 +1,9 @@
 package com.vpn.fastestvpnservice.screensTV
 
-import android.widget.Toast
 import androidx.compose.foundation.BorderStroke
 import androidx.compose.foundation.Image
 import androidx.compose.foundation.background
 import androidx.compose.foundation.border
-import androidx.compose.foundation.clickable
 import androidx.compose.foundation.focusable
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
@@ -58,6 +56,7 @@ import androidx.tv.material3.SurfaceDefaults
 import com.vpn.fastestvpnservice.R
 import com.vpn.fastestvpnservice.beans.isDarkTheme
 import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
+import com.vpn.fastestvpnservice.sealedClass.ScreenTV
 import com.vpn.fastestvpnservice.ui.theme.customTypography
 
 @Composable
@@ -79,7 +78,7 @@ fun LoginTV(navHostController: NavHostController) {
                 modifier = Modifier
                     .fillMaxSize()
                     .paint(
-                        painter = painterResource(id = if (isDarkTheme.value) R.drawable.bg_app else R.drawable.bg_app_light),
+                        painter = painterResource(id = if (isDarkTheme.value) R.drawable.bg_app_light else R.drawable.bg_app_light),
                         contentScale = ContentScale.FillBounds
                     ))
             {
@@ -118,7 +117,7 @@ fun LoginTV(navHostController: NavHostController) {
                             .fillMaxWidth(fraction = 0.5f)
                             .height(60.dp)
                             .border(
-                                2.dp,
+                                1.dp,
                                 color = if (showErrorEmail) colorResource(id = R.color.red)
                                 else if (isTextFieldFocused) colorResource(id = R.color.app_yellow_color)
                                 else colorResource(id = R.color.white),
@@ -139,20 +138,20 @@ fun LoginTV(navHostController: NavHostController) {
                                 style = MaterialTheme.typography.customTypography.bodyLarge
                             )
                         },
-//                        leadingIcon = {
-//                            Icon(
-//                                painter = painterResource(id = R.drawable.sms3x),
-//                                contentDescription = "Email Logo",
-//                                tint = colorResource(id = R.color.white),
-//                                modifier = Modifier
-//                                    .size(24.dp, 24.dp)
-//                            )
-//                        },
+                        leadingIcon = {
+                            Icon(
+                                painter = painterResource(id = R.drawable.sms3x),
+                                contentDescription = "Email Logo",
+                                tint = colorResource(id = R.color.white),
+                                modifier = Modifier
+                                    .size(24.dp, 24.dp)
+                            )
+                        },
                         maxLines = 1,
                         colors = TextFieldDefaults.colors(
                             focusedLabelColor = Color.Blue,
                             unfocusedContainerColor = colorResource(id = R.color.transparent),
-                            focusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
+                            focusedContainerColor = colorResource(id = R.color.lightNavy),
                             focusedIndicatorColor = colorResource(id = R.color.transparent),
                             disabledIndicatorColor = colorResource(id = R.color.transparent),
                             unfocusedIndicatorColor = colorResource(id = R.color.transparent),
@@ -185,9 +184,9 @@ fun LoginTV(navHostController: NavHostController) {
                             .fillMaxWidth(fraction = 0.5f)
                             .height(60.dp)
                             .border(
-                                2.dp,
+                                1.dp,
                                 color = if (isTextFieldFocused2) colorResource(id = R.color.app_yellow_color)
-                                    else colorResource(id = R.color.white),
+                                else colorResource(id = R.color.white),
                                 shape = RoundedCornerShape(16.dp)
                             )
 //                            .background(color = colorResource(id = R.color.transparent))
@@ -198,6 +197,15 @@ fun LoginTV(navHostController: NavHostController) {
 //                            .clickable() {}
                         ,
 
+                        leadingIcon = {
+                            Icon(
+                                painter = painterResource(id = R.drawable.lock3x),
+                                contentDescription = "Password Logo",
+                                tint = colorResource(id = R.color.white),
+                                modifier = Modifier
+                                    .size(24.dp, 24.dp)
+                            )
+                        },
                         shape = RoundedCornerShape(16.dp),
                         label = {
                             Text(text = "Password",
@@ -208,7 +216,8 @@ fun LoginTV(navHostController: NavHostController) {
                         colors = TextFieldDefaults.colors(
                             focusedLabelColor = Color.Blue,
                             unfocusedContainerColor = colorResource(id = R.color.transparent),
-                            focusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
+                            focusedContainerColor = colorResource(id = R.color.lightNavy),
+//                            focusedContainerColor = MaterialTheme.colorScheme.secondaryContainer,
                             focusedIndicatorColor = colorResource(id = R.color.transparent),
                             disabledIndicatorColor = colorResource(id = R.color.transparent),
                             unfocusedIndicatorColor = colorResource(id = R.color.transparent),
@@ -226,7 +235,7 @@ fun LoginTV(navHostController: NavHostController) {
                         ),
                     )
                     Spacer(modifier = Modifier.height(25.dp))
-                    LoginButtonTV()
+                    LoginButtonTV(navHostController)
                 }
             }
         }
@@ -234,7 +243,7 @@ fun LoginTV(navHostController: NavHostController) {
 }
 
 @Composable
-fun ColumnScope.LoginButtonTV() {
+fun ColumnScope.LoginButtonTV(navHostController: NavHostController) {
     var isButtonFocused by remember { mutableStateOf(false) }
     val focusRequester = remember { FocusRequester() }
     val focusManager = LocalFocusManager.current
@@ -253,9 +262,13 @@ fun ColumnScope.LoginButtonTV() {
         ,
         onClick = {
                   focusRequester.requestFocus()
-            Toast.makeText(
-                context, "Test", Toast.LENGTH_SHORT
-            ).show()
+//            Toast.makeText(
+//                context, "Test", Toast.LENGTH_SHORT
+//            ).show()
+            navHostController.popBackStack()
+            navHostController.navigate(
+                ScreenTV.BottomBarTV.route
+            )
         },
         shape = ButtonDefaults.shape(
             shape = RoundedCornerShape(16.dp),
@@ -265,16 +278,16 @@ fun ColumnScope.LoginButtonTV() {
             pressedShape = RoundedCornerShape(16.dp),
             ),
         colors = ButtonDefaults.colors(
-            contentColor = MaterialTheme.colorScheme.primaryContainer,
-            containerColor = MaterialTheme.colorScheme.onSecondaryContainer,
-            pressedContainerColor = MaterialTheme.colorScheme.onSecondaryContainer,
-            focusedContainerColor = MaterialTheme.colorScheme.onSecondaryContainer,
-            disabledContainerColor = MaterialTheme.colorScheme.onSecondaryContainer,
+            contentColor = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
+            containerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
+            pressedContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
+            focusedContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
+            disabledContainerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
         ),
         border = ButtonDefaults.border(
             border = Border(
                 border = BorderStroke(
-                    2.dp, if(isButtonFocused) colorResource(id = R.color.app_yellow_color)
+                    0.dp, if(isButtonFocused) colorResource(id = R.color.transparent)
                     else colorResource(id = R.color.transparent)
                 )
             ),
@@ -286,8 +299,8 @@ fun ColumnScope.LoginButtonTV() {
                 .align(Alignment.CenterVertically)
                 .background(MaterialTheme.colorScheme.onSecondaryContainer),
             colors = SurfaceDefaults.colors(
-                contentColor = MaterialTheme.colorScheme.primaryContainer,
-                containerColor = MaterialTheme.colorScheme.onSecondaryContainer,
+                contentColor = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
+                containerColor = if (isButtonFocused) colorResource(id = R.color.white) else colorResource(id = R.color.lightNavy),
             )
 
         ) {
@@ -297,7 +310,8 @@ fun ColumnScope.LoginButtonTV() {
                     .align(Alignment.Center),
                 text = "Sign In",
                 style = MaterialTheme.typography.titleMedium,
-                color = MaterialTheme.colorScheme.primaryContainer
+                color = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
+//                color = MaterialTheme.colorScheme.primaryContainer
 //                textAlign = TextAlign.Center
             )
         }

Разница между файлами не показана из-за своего большого размера
+ 1050 - 0
app/src/main/java/com/vpn/fastestvpnservice/screensTV/SettingsScreenTV.kt


+ 2 - 0
app/src/main/java/com/vpn/fastestvpnservice/sealedClass/ScreenTV.kt

@@ -3,4 +3,6 @@ package com.vpn.fastestvpnservice.sealedClass
 sealed class ScreenTV(val route: String) {
     data object SplashTV : ScreenTV("splash_screen_tv")
     data object LoginTV : ScreenTV("login_screen_tv")
+    data object HomeTV : ScreenTV("home_screen_tv")
+    data object BottomBarTV : ScreenTV("bottom_bar_tv")
 }

+ 2 - 0
app/src/main/java/com/vpn/fastestvpnservice/ui/theme/Theme.kt

@@ -31,6 +31,7 @@ private val DarkColorScheme = darkColorScheme(
     onPrimary = Color.Black,
     onPrimaryContainer = Color.Black,
     primaryContainer = Color.White,
+    inversePrimary = Color(0xFF0d1a2a),    // darkBlueGrey,
 
     secondary = Color.White,
     onSecondary = Color.White,
@@ -62,6 +63,7 @@ private val LightColorScheme = lightColorScheme(
     onPrimary = Color.White,
     onPrimaryContainer = Color(0xFFECF2FC),
     primaryContainer = Color(0xFF3B6AEE), // blue_text
+    inversePrimary = Color(0xFF0d1a2a),    // darkBlueGrey,
 
     secondary = Color.Black,
     onSecondary = Color(0xFF0d1b2a),