|  | @@ -4,9 +4,7 @@ import android.util.Log
 | 
												
													
														
															|  |  import androidx.activity.ComponentActivity
 |  |  import androidx.activity.ComponentActivity
 | 
												
													
														
															|  |  import androidx.compose.foundation.background
 |  |  import androidx.compose.foundation.background
 | 
												
													
														
															|  |  import androidx.compose.foundation.focusable
 |  |  import androidx.compose.foundation.focusable
 | 
												
													
														
															|  | -import androidx.compose.foundation.layout.Arrangement
 |  | 
 | 
												
													
														
															|  |  import androidx.compose.foundation.layout.Box
 |  |  import androidx.compose.foundation.layout.Box
 | 
												
													
														
															|  | -import androidx.compose.foundation.layout.Column
 |  | 
 | 
												
													
														
															|  |  import androidx.compose.foundation.layout.RowScope
 |  |  import androidx.compose.foundation.layout.RowScope
 | 
												
													
														
															|  |  import androidx.compose.foundation.layout.fillMaxSize
 |  |  import androidx.compose.foundation.layout.fillMaxSize
 | 
												
													
														
															|  |  import androidx.compose.foundation.layout.fillMaxWidth
 |  |  import androidx.compose.foundation.layout.fillMaxWidth
 | 
												
											
												
													
														
															|  | @@ -55,14 +53,18 @@ val screens = listOf(
 | 
												
													
														
															|  |      BottomBarScreen.Account
 |  |      BottomBarScreen.Account
 | 
												
													
														
															|  |  )
 |  |  )
 | 
												
													
														
															|  |  val focusRequesterNav1 = FocusRequester()
 |  |  val focusRequesterNav1 = FocusRequester()
 | 
												
													
														
															|  | 
 |  | +val focusRequesterSettings1 = FocusRequester()
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |  var focusRequestersList = List(screens.size) { FocusRequester() }
 |  |  var focusRequestersList = List(screens.size) { FocusRequester() }
 | 
												
													
														
															|  |  var selectedItemIndex: MutableState<Int> = mutableIntStateOf(0)
 |  |  var selectedItemIndex: MutableState<Int> = mutableIntStateOf(0)
 | 
												
													
														
															|  |  @Composable
 |  |  @Composable
 | 
												
													
														
															|  |  fun BottomBarMainScreenTV(navHostController: NavHostController, activity: ComponentActivity) {
 |  |  fun BottomBarMainScreenTV(navHostController: NavHostController, activity: ComponentActivity) {
 | 
												
													
														
															|  |      val navController1 = rememberNavController()
 |  |      val navController1 = rememberNavController()
 | 
												
													
														
															|  |      var isBottomBarVisible by remember { mutableStateOf(true) }
 |  |      var isBottomBarVisible by remember { mutableStateOf(true) }
 | 
												
													
														
															|  | 
 |  | +    var focusRequesterSettings = remember { FocusRequester() }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  LaunchedEffect(key1 = Unit) {
 |  |  LaunchedEffect(key1 = Unit) {
 | 
												
													
														
															|  | 
 |  | +//    focusRequesterNav1.requestFocus()
 | 
												
													
														
															|  |      focusRequestersList[selectedItemIndex.value].requestFocus()
 |  |      focusRequestersList[selectedItemIndex.value].requestFocus()
 | 
												
													
														
															|  |  }
 |  |  }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
											
												
													
														
															|  | @@ -75,7 +77,7 @@ LaunchedEffect(key1 = Unit) {
 | 
												
													
														
															|  |          modifier = Modifier.fillMaxSize(),
 |  |          modifier = Modifier.fillMaxSize(),
 | 
												
													
														
															|  |          bottomBar = {
 |  |          bottomBar = {
 | 
												
													
														
															|  |              if (isBottomBarVisible) {
 |  |              if (isBottomBarVisible) {
 | 
												
													
														
															|  | -                BottomBarTV(navController1, screens)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                BottomBarTV(navController1, screens, focusRequesterSettings)
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  |          content = { padding ->
 |  |          content = { padding ->
 | 
												
											
												
													
														
															|  | @@ -98,17 +100,18 @@ LaunchedEffect(key1 = Unit) {
 | 
												
													
														
															|  |  }
 |  |  }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  @Composable
 |  |  @Composable
 | 
												
													
														
															|  | -fun BottomBarTV(navHostController: NavHostController, screens: List<BottomBarScreen>) {
 |  | 
 | 
												
													
														
															|  | 
 |  | +fun BottomBarTV(navHostController: NavHostController, screens: List<BottomBarScreen>, focusRequesterSettings: FocusRequester) {
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      val context = LocalContext.current
 |  |      val context = LocalContext.current
 | 
												
													
														
															|  |      val navBackStackEntry = navHostController.currentBackStackEntryAsState()
 |  |      val navBackStackEntry = navHostController.currentBackStackEntryAsState()
 | 
												
													
														
															|  |      var currentDestination = navBackStackEntry.value?.destination
 |  |      var currentDestination = navBackStackEntry.value?.destination
 | 
												
													
														
															|  |      Log.d("currentRoute -> BB ", currentDestination.toString())
 |  |      Log.d("currentRoute -> BB ", currentDestination.toString())
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  | -    Column(
 |  | 
 | 
												
													
														
															|  | -        modifier = Modifier,
 |  | 
 | 
												
													
														
															|  | -        verticalArrangement = Arrangement.Center,
 |  | 
 | 
												
													
														
															|  | -        horizontalAlignment = Alignment.CenterHorizontally
 |  | 
 | 
												
													
														
															|  | 
 |  | +    Box(
 | 
												
													
														
															|  | 
 |  | +        modifier = Modifier
 | 
												
													
														
															|  | 
 |  | +            .fillMaxWidth()
 | 
												
													
														
															|  | 
 |  | +            .background(colorResource(id = R.color.background_color_gray)),
 | 
												
													
														
															|  | 
 |  | +        contentAlignment = Alignment.Center
 | 
												
													
														
															|  |      ) {
 |  |      ) {
 | 
												
													
														
															|  |          BottomNavigation (
 |  |          BottomNavigation (
 | 
												
													
														
															|  |  //        backgroundColor = MaterialTheme.colorScheme.onBackground,
 |  |  //        backgroundColor = MaterialTheme.colorScheme.onBackground,
 | 
												
											
												
													
														
															|  | @@ -117,8 +120,8 @@ fun BottomBarTV(navHostController: NavHostController, screens: List<BottomBarScr
 | 
												
													
														
															|  |  //        contentColor = Color.Gray,
 |  |  //        contentColor = Color.Gray,
 | 
												
													
														
															|  |              modifier = Modifier
 |  |              modifier = Modifier
 | 
												
													
														
															|  |                  .height(if (StaticMethods.isTV(context)) 60.dp else if (isTablet()) 150.dp else 110.dp)
 |  |                  .height(if (StaticMethods.isTV(context)) 60.dp else if (isTablet()) 150.dp else 110.dp)
 | 
												
													
														
															|  | -                .fillMaxWidth(fraction = 1f)
 |  | 
 | 
												
													
														
															|  | -//                .background(Color.LightGray)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                .fillMaxWidth(fraction = 0.5f)
 | 
												
													
														
															|  | 
 |  | +                .background(Color.LightGray)
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |          ) {
 |  |          ) {
 | 
												
													
														
															|  |              screens.forEachIndexed { index, screen ->
 |  |              screens.forEachIndexed { index, screen ->
 | 
												
											
												
													
														
															|  | @@ -126,7 +129,8 @@ fun BottomBarTV(navHostController: NavHostController, screens: List<BottomBarScr
 | 
												
													
														
															|  |                      screen = screen,
 |  |                      screen = screen,
 | 
												
													
														
															|  |                      currentDestination = currentDestination,
 |  |                      currentDestination = currentDestination,
 | 
												
													
														
															|  |                      navHostController = navHostController,
 |  |                      navHostController = navHostController,
 | 
												
													
														
															|  | -                    index
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    index,
 | 
												
													
														
															|  | 
 |  | +                    focusRequesterSettings
 | 
												
													
														
															|  |                  )
 |  |                  )
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
											
												
													
														
															|  | @@ -138,7 +142,8 @@ fun RowScope.AddItemTV(
 | 
												
													
														
															|  |      screen: BottomBarScreen,
 |  |      screen: BottomBarScreen,
 | 
												
													
														
															|  |      currentDestination: NavDestination?,
 |  |      currentDestination: NavDestination?,
 | 
												
													
														
															|  |      navHostController: NavHostController,
 |  |      navHostController: NavHostController,
 | 
												
													
														
															|  | -    index: Int
 |  | 
 | 
												
													
														
															|  | 
 |  | +    index: Int,
 | 
												
													
														
															|  | 
 |  | +    focusRequesterSettings: FocusRequester
 | 
												
													
														
															|  |  ) {
 |  |  ) {
 | 
												
													
														
															|  |      var isClicked by remember { mutableStateOf(false) }
 |  |      var isClicked by remember { mutableStateOf(false) }
 | 
												
													
														
															|  |      var isFocused by remember { mutableStateOf(false) }
 |  |      var isFocused by remember { mutableStateOf(false) }
 | 
												
											
												
													
														
															|  | @@ -207,6 +212,7 @@ fun RowScope.AddItemTV(
 | 
												
													
														
															|  |  //            }
 |  |  //            }
 | 
												
													
														
															|  |              .onFocusChanged {
 |  |              .onFocusChanged {
 | 
												
													
														
															|  |                  isFocused = it.isFocused
 |  |                  isFocused = it.isFocused
 | 
												
													
														
															|  | 
 |  | +//                if (it.isFocused) isClicked = it.isFocused
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                  Log.d(
 |  |                  Log.d(
 | 
												
													
														
															|  |                      "test_bottom_navbar",
 |  |                      "test_bottom_navbar",
 | 
												
											
												
													
														
															|  | @@ -248,23 +254,41 @@ fun RowScope.AddItemTV(
 | 
												
													
														
															|  |  //                else {
 |  |  //                else {
 | 
												
													
														
															|  |  //                    isFocused = it.isFocused
 |  |  //                    isFocused = it.isFocused
 | 
												
													
														
															|  |  //                }
 |  |  //                }
 | 
												
													
														
															|  | -//                isClicked = it.isFocused
 |  | 
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |              .focusable()
 |  |              .focusable()
 | 
												
													
														
															|  | -            .background(if (isFocused) Color.LightGray else Color.White)
 |  | 
 | 
												
													
														
															|  | -        ,
 |  | 
 | 
												
													
														
															|  | -        selected = currentDestination?.hierarchy?.any{
 |  | 
 | 
												
													
														
															|  | -                    it.route == screen.route
 |  | 
 | 
												
													
														
															|  | 
 |  | +            .background(if (isFocused) Color.LightGray else colorResource(id = R.color.background_color_gray)),
 | 
												
													
														
															|  | 
 |  | +        selected = currentDestination?.hierarchy?.any {
 | 
												
													
														
															|  | 
 |  | +            it.route == screen.route
 | 
												
													
														
															|  |          } == true,
 |  |          } == true,
 | 
												
													
														
															|  |          onClick = {
 |  |          onClick = {
 | 
												
													
														
															|  |              isClicked = true
 |  |              isClicked = true
 | 
												
													
														
															|  | -            Log.d("test_bottom_navbar", "onCLick = ${screen.route
 |  | 
 | 
												
													
														
															|  | -            }")
 |  | 
 | 
												
													
														
															|  | 
 |  | +            selectedItemIndex.value = index
 | 
												
													
														
															|  | 
 |  | +//            when (selectedItemIndex.value) {
 | 
												
													
														
															|  | 
 |  | +//                0 -> {
 | 
												
													
														
															|  | 
 |  | +//                    focusRequesterHome1.requestFocus()
 | 
												
													
														
															|  | 
 |  | +//                }
 | 
												
													
														
															|  | 
 |  | +//                1 -> {
 | 
												
													
														
															|  | 
 |  | +//                    focusRequesterSettings.requestFocus()
 | 
												
													
														
															|  | 
 |  | +//                }
 | 
												
													
														
															|  | 
 |  | +//                3 -> {
 | 
												
													
														
															|  | 
 |  | +//                    focusRequesterHelp1.requestFocus()
 | 
												
													
														
															|  | 
 |  | +//                }
 | 
												
													
														
															|  | 
 |  | +//                4 -> {
 | 
												
													
														
															|  | 
 |  | +//                    focusRequesterAccount1.requestFocus()
 | 
												
													
														
															|  | 
 |  | +//                }
 | 
												
													
														
															|  | 
 |  | +//            }
 | 
												
													
														
															|  | 
 |  | +            Log.d(
 | 
												
													
														
															|  | 
 |  | +                "test_bottom_navbar", "onCLick = ${
 | 
												
													
														
															|  | 
 |  | +                    screen.route
 | 
												
													
														
															|  | 
 |  | +                }"
 | 
												
													
														
															|  | 
 |  | +            )
 | 
												
													
														
															|  |              /* First time currentDestination is different when on BottomBar Item */
 |  |              /* First time currentDestination is different when on BottomBar Item */
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  |          icon = {
 |  |          icon = {
 | 
												
													
														
															|  | -            val iconWidth = if (StaticMethods.isTV(context)) 55.dp else if (isTablet()) 50.dp else 45.dp
 |  | 
 | 
												
													
														
															|  | -            val iconHeight = if (StaticMethods.isTV(context)) 55.dp else if (isTablet()) 44.dp else 39.dp
 |  | 
 | 
												
													
														
															|  | 
 |  | +            val iconWidth =
 | 
												
													
														
															|  | 
 |  | +                if (StaticMethods.isTV(context)) 55.dp else if (isTablet()) 50.dp else 45.dp
 | 
												
													
														
															|  | 
 |  | +            val iconHeight =
 | 
												
													
														
															|  | 
 |  | +                if (StaticMethods.isTV(context)) 55.dp else if (isTablet()) 44.dp else 39.dp
 | 
												
													
														
															|  |              if (currentDestination?.route == screen.route) {
 |  |              if (currentDestination?.route == screen.route) {
 | 
												
													
														
															|  |                  Icon(
 |  |                  Icon(
 | 
												
													
														
															|  |                      painter = painterResource(id = screen.icon),
 |  |                      painter = painterResource(id = screen.icon),
 | 
												
											
												
													
														
															|  | @@ -275,8 +299,7 @@ fun RowScope.AddItemTV(
 | 
												
													
														
															|  |                          .size(iconWidth, iconHeight)
 |  |                          .size(iconWidth, iconHeight)
 | 
												
													
														
															|  |                          .padding(top = 9.dp, bottom = if (isTablet()) 6.dp else 4.dp)
 |  |                          .padding(top = 9.dp, bottom = if (isTablet()) 6.dp else 4.dp)
 | 
												
													
														
															|  |                  )
 |  |                  )
 | 
												
													
														
															|  | -            }
 |  | 
 | 
												
													
														
															|  | -            else {
 |  | 
 | 
												
													
														
															|  | 
 |  | +            } else {
 | 
												
													
														
															|  |                  Icon(
 |  |                  Icon(
 | 
												
													
														
															|  |                      painter = painterResource(id = screen.icon),
 |  |                      painter = painterResource(id = screen.icon),
 | 
												
													
														
															|  |                      contentDescription = "Navigation Icon",
 |  |                      contentDescription = "Navigation Icon",
 | 
												
											
												
													
														
															|  | @@ -285,7 +308,8 @@ fun RowScope.AddItemTV(
 | 
												
													
														
															|  |                      modifier = Modifier
 |  |                      modifier = Modifier
 | 
												
													
														
															|  |                          .size(iconWidth, iconHeight)
 |  |                          .size(iconWidth, iconHeight)
 | 
												
													
														
															|  |                          .padding(top = 9.dp, bottom = if (isTablet()) 6.dp else 4.dp)
 |  |                          .padding(top = 9.dp, bottom = if (isTablet()) 6.dp else 4.dp)
 | 
												
													
														
															|  | -                        .alpha(0.5F))
 |  | 
 | 
												
													
														
															|  | 
 |  | +                        .alpha(0.5F)
 | 
												
													
														
															|  | 
 |  | +                )
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |          },
 |  |          },
 |