|
@@ -0,0 +1,107 @@
|
|
|
+package com.vpn.fastestvpnservice.screensTV
|
|
|
+
|
|
|
+import android.widget.Toast
|
|
|
+import androidx.compose.foundation.background
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
+import androidx.compose.foundation.layout.BoxScope
|
|
|
+import androidx.compose.foundation.layout.Column
|
|
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
+import androidx.compose.foundation.layout.fillMaxSize
|
|
|
+import androidx.compose.foundation.layout.height
|
|
|
+import androidx.compose.foundation.layout.padding
|
|
|
+import androidx.compose.foundation.layout.size
|
|
|
+import androidx.compose.foundation.lazy.LazyColumn
|
|
|
+import androidx.compose.foundation.lazy.items
|
|
|
+import androidx.compose.material.Icon
|
|
|
+import androidx.compose.material.IconButton
|
|
|
+import androidx.compose.material.Surface
|
|
|
+import androidx.compose.material.Text
|
|
|
+import androidx.compose.material3.MaterialTheme
|
|
|
+import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.runtime.LaunchedEffect
|
|
|
+import androidx.compose.runtime.livedata.observeAsState
|
|
|
+import androidx.compose.ui.Alignment
|
|
|
+import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.platform.LocalContext
|
|
|
+import androidx.compose.ui.res.colorResource
|
|
|
+import androidx.compose.ui.res.painterResource
|
|
|
+import androidx.compose.ui.unit.dp
|
|
|
+import androidx.lifecycle.viewmodel.compose.viewModel
|
|
|
+import androidx.navigation.NavHostController
|
|
|
+import com.vpn.fastestvpnservice.R
|
|
|
+import com.vpn.fastestvpnservice.customItems.NotificationItem
|
|
|
+import com.vpn.fastestvpnservice.customItems.NotificationItemTV
|
|
|
+import com.vpn.fastestvpnservice.screens.settingsScreenAll.HeaderRowNS
|
|
|
+import com.vpn.fastestvpnservice.viewmodels.NotificationViewModel
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun NotificationsTV(navHostController: NavHostController) {
|
|
|
+ val notificationViewModel: NotificationViewModel = viewModel()
|
|
|
+ val context = LocalContext.current
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .background(
|
|
|
+ color = colorResource(id = R.color.background_color_gray)
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ LaunchedEffect(key1 = Unit) {
|
|
|
+ notificationViewModel.getNotifications()
|
|
|
+ }
|
|
|
+ HeaderRowNSTV(navHostController = navHostController)
|
|
|
+
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(top = 60.dp)
|
|
|
+ .fillMaxSize()
|
|
|
+ ) {
|
|
|
+ val notifications = notificationViewModel.liveDataNotification.observeAsState().value
|
|
|
+
|
|
|
+ LazyColumn() {
|
|
|
+
|
|
|
+ notifications?.let {
|
|
|
+ items(it) { item ->
|
|
|
+ NotificationItemTV(item = item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@Composable
|
|
|
+fun BoxScope.HeaderRowNSTV(navHostController: NavHostController) {
|
|
|
+// IconButton(
|
|
|
+// onClick = {
|
|
|
+// navHostController.popBackStack()
|
|
|
+//// navHostController.navigate(BottomBarScreen.Help.route)
|
|
|
+// },
|
|
|
+// modifier = Modifier
|
|
|
+// .align(Alignment.TopStart)
|
|
|
+// .padding(top = 50.dp)
|
|
|
+// .padding(start = 16.dp)
|
|
|
+// .size(30.dp, 32.dp)
|
|
|
+// ) {
|
|
|
+// Icon(
|
|
|
+// painter = painterResource(id = R.drawable.backarrow3x),
|
|
|
+// contentDescription = "Arrow-Back",
|
|
|
+// tint = MaterialTheme.colorScheme.primary,
|
|
|
+// modifier = Modifier.size(18.dp, 12.dp)
|
|
|
+// )
|
|
|
+// }
|
|
|
+ Surface(
|
|
|
+ modifier = Modifier
|
|
|
+ .padding(start = 14.dp, top = 16.dp)
|
|
|
+ .height(32.dp)
|
|
|
+ .align(Alignment.TopStart),
|
|
|
+ color = colorResource(id = R.color.transparent)
|
|
|
+ ) {
|
|
|
+ Text(text = "Notifications",
|
|
|
+ color = MaterialTheme.colorScheme.primary,
|
|
|
+ style = MaterialTheme.typography.bodyMedium,
|
|
|
+ modifier = Modifier.fillMaxHeight()
|
|
|
+
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|