Ver código fonte

custom navigation working fine on TV, focus set on Settings Screen

Khubaib 9 meses atrás
pai
commit
a61be3ec9b

+ 25 - 37
app/src/main/java/com/vpn/fastestvpnservice/screensTV/SettingsScreenTV.kt

@@ -504,45 +504,33 @@ fun ColumnScope.AddRowSettingsColumnTV(
             .clip(RoundedCornerShape(4.dp))
             .background(if (isFirstRowFocused) Color.LightGray else Color.White)
             .height(61.dp)
-            .onKeyEvent {
-                when (it.key) {
-                    Key.DirectionDown -> {
-                        Log.d("test_settings_keys", "DirectionDown")
-//                        Toast
-//                            .makeText(
-//                                context, "DirectionDown", Toast.LENGTH_SHORT
-//                            )
-//                            .show()
-                        focusRequester2.requestFocus()
-                        true
-                    }
-                    Key.DirectionLeft -> {
-                        Log.d("test_settings_keys", "DirectionLeft")
-//                        Toast
-//                            .makeText(
-//                                context, "DirectionLeft", Toast.LENGTH_SHORT
-//                            )
-//                            .show()
-                        customNavigation(navHostController = navHostController, screen = BottomBarScreen.Settings)
-                        true
-                    }
-//
-//                    Key.DirectionRight -> {
-//                        Log.d("test_settings_keys", "DirectionRight")
-//                        Toast
-//                            .makeText(
-//                                context, "DirectionRight", Toast.LENGTH_SHORT
-//                            )
-//                            .show()
-//                        customNavigation(navHostController = navHostController, screen = BottomBarScreen.Help)
+//            .onKeyEvent {
+//                when (it.key) {
+//                    Key.DirectionDown -> {
+//                        Log.d("test_settings_keys", "DirectionDown")
+////                        Toast
+////                            .makeText(
+////                                context, "DirectionDown", Toast.LENGTH_SHORT
+////                            )
+////                            .show()
+//                        focusRequester2.requestFocus()
 //                        true
 //                    }
-
-                    else -> {
-                        false
-                    }
-                }
-            }
+//                    Key.DirectionLeft -> {
+//                        Log.d("test_settings_keys", "DirectionLeft")
+////                        Toast
+////                            .makeText(
+////                                context, "DirectionLeft", Toast.LENGTH_SHORT
+////                            )
+////                            .show()
+////                        customNavigation(navHostController = navHostController, screen = BottomBarScreen.Settings)
+//                        true
+//                    }
+//                    else -> {
+//                        false
+//                    }
+//                }
+//            }
             .focusRequester(focusRequester1)
             .onFocusChanged {
                 isFirstRowFocused = it.isFocused