Kaynağa Gözat

Added focus on notification item on TV

Khubaib 4 ay önce
ebeveyn
işleme
47ce634121

+ 14 - 3
app/src/main/java/com/vpn/fastestvpnservice/customItems/NotificationItem.kt

@@ -33,6 +33,7 @@ import androidx.compose.runtime.remember
 import androidx.compose.runtime.setValue
 import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
+import androidx.compose.ui.focus.onFocusChanged
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.ColorFilter
 import androidx.compose.ui.input.pointer.pointerInput
@@ -194,9 +195,12 @@ fun NotificationItem(item: Notification) {
 fun NotificationItemTV(item: Notification) {
     val context = LocalContext.current
     var isNotificationItemSheetOpen by remember { mutableStateOf(false) }
+    var isRowFocused by remember { mutableStateOf(false) }
 
     Box(modifier = Modifier
-        .background(MaterialTheme.colorScheme.background)
+        .background(
+            MaterialTheme.colorScheme.background
+        )
         .fillMaxWidth()
     ) {
         Column() {
@@ -204,7 +208,13 @@ fun NotificationItemTV(item: Notification) {
                 modifier = Modifier
                     .fillMaxWidth()
                     .wrapContentHeight()
-                    .background(Color.Transparent)
+                    .background(
+                        if (isRowFocused) MaterialTheme.colorScheme.inverseOnSurface
+                        else Color.Transparent
+                    )
+                    .onFocusChanged {
+                        isRowFocused = it.isFocused
+                    }
                     .clickable {
                         isNotificationItemSheetOpen = true
                     },
@@ -219,6 +229,7 @@ fun NotificationItemTV(item: Notification) {
                     textAlign = TextAlign.Start,
                     modifier = Modifier
                         .padding(start = 16.dp, bottom = 0.dp, end = 35.dp)
+                        .padding(vertical = 20.dp)
 //                        .background(Color.LightGray)
 //                        .fillMaxWidth(),
                 )
@@ -245,7 +256,7 @@ fun NotificationItemTV(item: Notification) {
 //                    .fillMaxWidth(),
 //            )
 
-            Spacer(modifier = Modifier.height(25.dp))
+//            Spacer(modifier = Modifier.height(10.dp))
         }
 
         if (isNotificationItemSheetOpen) {