AttendanceScreenContent
This commit is contained in:
@@ -26,7 +26,8 @@ import java.io.IOException
|
||||
data class UpdateInfo(
|
||||
val version: String = "",
|
||||
val url: String = "",
|
||||
val isNew: Boolean = false
|
||||
val isNew: Boolean = false,
|
||||
val releaseNote : String = ""
|
||||
)
|
||||
|
||||
object UpdateChecker {
|
||||
@@ -68,7 +69,8 @@ object UpdateChecker {
|
||||
|
||||
UpdateInfo(
|
||||
version = document.getString("version") ?: throw UpdateCheckException("Version field missing"),
|
||||
url = document.getString("url") ?: throw UpdateCheckException("URL field missing")
|
||||
url = document.getString("url") ?: throw UpdateCheckException("URL field missing"),
|
||||
releaseNote = document.getString("ReleaseNote") ?: throw UpdateCheckException("ReleaseNote field missing")
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
throw UpdateCheckException("Failed to fetch update info", e)
|
||||
|
||||
@@ -1,37 +1,11 @@
|
||||
package `in`.sminnovations.attendanceapp.screens.home.ui.componets
|
||||
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
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.magnifier
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedCard
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.google.accompanist.permissions.ExperimentalPermissionsApi
|
||||
import com.google.accompanist.permissions.PermissionState
|
||||
import com.google.accompanist.permissions.isGranted
|
||||
@@ -49,8 +23,6 @@ internal fun AttendanceScreenContent(
|
||||
) {
|
||||
|
||||
Box(modifier = modifier.fillMaxSize()) {
|
||||
|
||||
|
||||
Column {
|
||||
when {
|
||||
!cameraPermissionState.status.isGranted -> {
|
||||
@@ -104,99 +76,3 @@ internal fun AttendanceScreenContent(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun ScannerToggleButton(
|
||||
isScanning: Boolean, onClick: () -> Unit, modifier: Modifier = Modifier
|
||||
) {
|
||||
OutlinedCard(
|
||||
onClick = onClick, colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.primary
|
||||
), modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp),
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isScanning) Icons.Default.Close else Icons.Default.KeyboardArrowUp,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.padding(end = 8.dp)
|
||||
)
|
||||
Text(
|
||||
text = if (isScanning) "Close Scanner" else "Open Scanner",
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
private fun LoadingOverlay() {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.Black.copy(alpha = 0.3f)),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
CircularProgressIndicator(
|
||||
color = MaterialTheme.colorScheme.primary, modifier = Modifier.size(48.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
private fun AttendanceStatusCard(
|
||||
title: String, userName: String?
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
OutlinedCard {
|
||||
Text(
|
||||
text = title,
|
||||
letterSpacing = 2.sp,
|
||||
lineHeight = 40.sp,
|
||||
fontSize = 30.sp,
|
||||
color = Color.Green,
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = Modifier.padding(10.dp, 5.dp)
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
Text(
|
||||
text = userName ?: "",
|
||||
letterSpacing = 2.sp,
|
||||
lineHeight = 40.sp,
|
||||
fontSize = 30.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
private fun ScannerContent(
|
||||
onQrCodeScanned: (String) -> Unit, onClose: () -> Unit
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
QRCodeScannerScreen(onQrCodeScanned)
|
||||
IconButton(
|
||||
onClick = onClose, modifier = Modifier
|
||||
.align(Alignment.TopStart)
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Icon(Icons.Default.ArrowBack, contentDescription = "Close Scanner")
|
||||
}
|
||||
}
|
||||
|
||||
BackHandler { onClose() }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user