Compare commits

..

No commits in common. "master" and "2024-04-14" have entirely different histories.

2 changed files with 10 additions and 77 deletions

View File

@ -1,18 +1,12 @@
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
@ -30,79 +24,18 @@ fun HomeScreen(navigator: DestinationsNavigator, token: String) {
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(horizontal = 50.dp)
) { ) {
ElevatedCard( Button(onClick = {
elevation = CardDefaults.cardElevation(
defaultElevation = 6.dp
),
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)) navigator.navigate(PermissionScreenDestination(token))
}, modifier = Modifier }, modifier = Modifier.align(Alignment.CenterHorizontally)) {
.align(Alignment.BottomEnd) Text("Scannerizza codice QR")
.padding(16.dp)
) {
Text("Prosegui")
}
}
} }
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))
ElevatedCard( Button(onClick = {
elevation = CardDefaults.cardElevation(
defaultElevation = 6.dp
),
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)) navigator.navigate(SearchingScreenDestination(token))
}, modifier = Modifier }, modifier = Modifier.align(Alignment.CenterHorizontally)) {
.align(Alignment.BottomEnd) Text("Cerca professore")
.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, private val navigator: DestinationsNavigator, val token: String) : ImageAnalysis.Analyzer { class QrAnalyzer(private val context: Context, 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()