Compare commits

..

1 Commits

Author SHA1 Message Date
Mariano Riefolo
30ab8e2fe9 Improved menu interface 2024-05-03 22:28:31 +02:00
2 changed files with 77 additions and 10 deletions

View File

@ -1,12 +1,18 @@
package it.edu.cassandroferminervi.flowschool.screens package it.edu.cassandroferminervi.flowschool.screens
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@ -24,18 +30,79 @@ fun HomeScreen(navigator: DestinationsNavigator, token: String) {
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(horizontal = 50.dp)
) { ) {
Button(onClick = { ElevatedCard(
navigator.navigate(PermissionScreenDestination(token)) elevation = CardDefaults.cardElevation(
}, modifier = Modifier.align(Alignment.CenterHorizontally)) { defaultElevation = 6.dp
Text("Scannerizza codice QR") ),
modifier = Modifier
.fillMaxHeight(0.5F)
.fillMaxWidth()
.padding(25.dp)
) {
Text(
"Scannerizza codice QR",
style = MaterialTheme.typography.headlineMedium,
modifier = Modifier
.padding(16.dp)
)
Text(
"Scannerizzando il codice QR generato dinamicamente dal dispositivo situato nella scuola ti permette di segnare la presenza in modo efficiente.",
modifier = Modifier
.padding(16.dp)
)
Box(
modifier = Modifier
.fillMaxSize()
) {
Button(
onClick = {
navigator.navigate(PermissionScreenDestination(token))
}, modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp)
) {
Text("Prosegui")
}
}
} }
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))
Button(onClick = { ElevatedCard(
navigator.navigate(SearchingScreenDestination(token)) elevation = CardDefaults.cardElevation(
}, modifier = Modifier.align(Alignment.CenterHorizontally)) { defaultElevation = 6.dp
Text("Cerca professore") ),
modifier = Modifier
.fillMaxHeight()
.fillMaxWidth()
.padding(25.dp)
) {
Text(
"Cerca professore",
style = MaterialTheme.typography.headlineMedium,
modifier = Modifier
.padding(16.dp)
)
Text(
"Cerca il professore sul quale vuoi ottenere informazioni come l'orario di entrata, l'orario di uscita e la classe in cui presiede attualmente.",
modifier = Modifier
.padding(16.dp)
)
Box(
modifier = Modifier
.fillMaxSize()
) {
Button(
onClick = {
navigator.navigate(SearchingScreenDestination(token))
}, modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp)
) {
Text("Prosegui")
}
}
} }
} }
} }

View File

@ -16,7 +16,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class QrAnalyzer(private val context: Context, val navigator: DestinationsNavigator, val token: String) : ImageAnalysis.Analyzer { class QrAnalyzer(private val context: Context, private val navigator: DestinationsNavigator, val token: String) : ImageAnalysis.Analyzer {
private val options = BarcodeScannerOptions.Builder() private val options = BarcodeScannerOptions.Builder()
.setBarcodeFormats(Barcode.FORMAT_QR_CODE) .setBarcodeFormats(Barcode.FORMAT_QR_CODE)
.build() .build()