Compare commits

..

No commits in common. "ui" and "2024-02-29" have entirely different histories.

7 changed files with 37 additions and 153 deletions

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State>
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_3a_API_34_extension_level_7_x86_64.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-02-26T15:23:42.854086595Z" />
</State>
</entry>
</value>
</component>
</project>

View File

@ -54,7 +54,7 @@ dependencies {
implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2") implementation("androidx.activity:activity-compose:1.8.2")
implementation(platform("androidx.compose:compose-bom:2024.02.01")) implementation(platform("androidx.compose:compose-bom:2023.08.00"))
implementation("androidx.compose.ui:ui") implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics") implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.ui:ui-tooling-preview")
@ -62,7 +62,7 @@ dependencies {
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2024.02.01")) androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4") androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling") debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest") debugImplementation("androidx.compose.ui:ui-test-manifest")

View File

@ -3,9 +3,6 @@ package it.edu.cassandroferminervi.flowschool
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Surface
import androidx.compose.ui.Modifier
import com.ramcosta.composedestinations.DestinationsNavHost import com.ramcosta.composedestinations.DestinationsNavHost
import com.ramcosta.composedestinations.NavGraphs import com.ramcosta.composedestinations.NavGraphs
import it.edu.cassandroferminervi.flowschool.ui.theme.FlowSchoolTheme import it.edu.cassandroferminervi.flowschool.ui.theme.FlowSchoolTheme
@ -15,11 +12,7 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContent { setContent {
FlowSchoolTheme { FlowSchoolTheme {
Surface( DestinationsNavHost(navGraph = NavGraphs.root)
modifier = Modifier.fillMaxSize()
) {
DestinationsNavHost(navGraph = NavGraphs.root)
}
} }
} }
} }

View File

@ -1,129 +1,20 @@
package it.edu.cassandroferminervi.flowschool.screens package it.edu.cassandroferminervi.flowschool.screens
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.background import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.ramcosta.composedestinations.TeacherScreenDestination
import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.Destination
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
@Destination @Destination
@Composable @Composable
fun SearchingScreen(navigator: DestinationsNavigator) { fun SearchingScreen() {
val teachers = listOf( Box (
"Mario Rossi", contentAlignment = Alignment.Center,
"Michele Verdi", modifier = Modifier.fillMaxSize()
"Fabio Bianchi" ) {
).groupBy { Text("Searching screen")
it.first()
}.toSortedMap()
.map {
Category(
it.key.toString(),
items = it.value
)
}
var filter by remember { mutableStateOf("") }
Column {
TextField(
value = filter,
onValueChange = { filter = it },
label = { Text("Cerca") },
singleLine = true,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
)
CategorizedLazyColumn(
categories = teachers,
navigator = navigator,
filter = filter
)
}
}
data class Category(
val name: String,
val items: List<String>
)
@Composable
private fun CategoryHeader(
text: String,
modifier: Modifier = Modifier
) {
Text(
text = text,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
modifier = modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.primaryContainer)
.padding(16.dp)
)
}
@Composable
private fun CategoryItem(
text: String,
navigator: DestinationsNavigator,
modifier: Modifier = Modifier
) {
TextButton(onClick = {
navigator.navigate(TeacherScreenDestination("test"))
}) {
Text(
text = text,
fontSize = 14.sp,
modifier = modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.background)
.padding(16.dp)
)
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun CategorizedLazyColumn(
categories: List<Category>,
navigator: DestinationsNavigator,
filter: String,
modifier: Modifier = Modifier
) {
LazyColumn(modifier) {
categories.forEach { category ->
if (category.items.any {
it.contains(filter, ignoreCase = true)
}) {
stickyHeader {
CategoryHeader(category.name)
}
}
items(items = category.items.filter {
it.contains(filter, ignoreCase = true)
}) { text ->
CategoryItem(text, navigator)
}
}
} }
} }

View File

@ -1,23 +0,0 @@
package it.edu.cassandroferminervi.flowschool.screens
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.ramcosta.composedestinations.annotation.Destination
@Destination
@Composable
fun TeacherScreen(codice: String) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxSize()
) {
Text("Codice prof: $codice")
Text("Presente: si")
}
}

View File

@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id("com.android.application") version "8.3.0" apply false id("com.android.application") version "8.2.2" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("org.jetbrains.kotlin.android") version "1.9.0" apply false
} }

View File

@ -1,6 +1,6 @@
#Wed Feb 21 15:30:24 CET 2024 #Wed Feb 21 15:30:24 CET 2024
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists