Second lab
This commit is contained in:
parent
10a4202277
commit
5a820b661e
@ -9,7 +9,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.example.mobile_labs"
|
applicationId = "com.example.mobile_labs"
|
||||||
minSdk = 24
|
minSdk = 26
|
||||||
targetSdk = 33
|
targetSdk = 33
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0"
|
versionName = "1.0"
|
||||||
|
@ -34,6 +34,7 @@ import androidx.navigation.navArgument
|
|||||||
import com.example.mobile_labs.ui.theme.Mobile_LabsTheme
|
import com.example.mobile_labs.ui.theme.Mobile_LabsTheme
|
||||||
import com.example.mobile_labs.R
|
import com.example.mobile_labs.R
|
||||||
import com.example.mobile_labs.composeui.About
|
import com.example.mobile_labs.composeui.About
|
||||||
|
import com.example.mobile_labs.event.composeui.Schedule
|
||||||
import com.example.mobile_labs.performance.composeui.PerformanceView
|
import com.example.mobile_labs.performance.composeui.PerformanceView
|
||||||
import com.example.mobile_labs.performance.composeui.Repertoire
|
import com.example.mobile_labs.performance.composeui.Repertoire
|
||||||
import com.example.mobile_labs.person.composeui.PeopleList
|
import com.example.mobile_labs.person.composeui.PeopleList
|
||||||
@ -103,10 +104,10 @@ fun Navhost(
|
|||||||
) {
|
) {
|
||||||
NavHost(
|
NavHost(
|
||||||
navController,
|
navController,
|
||||||
startDestination = Screen.Repertoire.route,
|
startDestination = Screen.Schedule.route,
|
||||||
modifier.padding(innerPadding)
|
modifier.padding(innerPadding)
|
||||||
) {
|
) {
|
||||||
//composable(Screen.Schedule.route) { StudentList(navController) }
|
composable(Screen.Schedule.route) { Schedule(navController) }
|
||||||
composable(Screen.Repertoire.route) { Repertoire(navController) }
|
composable(Screen.Repertoire.route) { Repertoire(navController) }
|
||||||
composable(Screen.PeopleList.route) { PeopleList(navController) }
|
composable(Screen.PeopleList.route) { PeopleList(navController) }
|
||||||
composable(Screen.About.route) { About() }
|
composable(Screen.About.route) { About() }
|
||||||
|
@ -34,6 +34,7 @@ enum class Screen(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val bottomBarItems = listOf(
|
val bottomBarItems = listOf(
|
||||||
|
Schedule,
|
||||||
Repertoire,
|
Repertoire,
|
||||||
PeopleList,
|
PeopleList,
|
||||||
About,
|
About,
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.example.mobile_labs.event.composeui
|
||||||
|
|
||||||
|
import android.content.res.Configuration
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Surface
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.layout.ContentScale
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.navigation.NavController
|
||||||
|
import coil.compose.AsyncImage
|
||||||
|
import com.example.mobile_labs.composeui.navigation.Screen
|
||||||
|
import com.example.mobile_labs.event.model.getTestEvents
|
||||||
|
import com.example.mobile_labs.ui.theme.Mobile_LabsTheme
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Schedule(navController: NavController?) {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(all = 10.dp)
|
||||||
|
.verticalScroll(rememberScrollState())) {
|
||||||
|
getTestEvents().forEachIndexed() { _, event ->
|
||||||
|
val performanceId = Screen.PerformanceView.route.replace("{id}", event.performance.id.toString())
|
||||||
|
Row(Modifier.padding(all = 10.dp)) {
|
||||||
|
Text(modifier = Modifier.padding(all = 5.dp), textAlign = TextAlign.Center, text = event.date.format(DateTimeFormatter.ofPattern("dd.MM")))
|
||||||
|
AsyncImage(model = event.performance.previewImageURL,
|
||||||
|
contentDescription = "performance preview image",
|
||||||
|
contentScale = ContentScale.Crop,
|
||||||
|
modifier = Modifier
|
||||||
|
.height(100.dp)
|
||||||
|
.width(100.dp))
|
||||||
|
Button(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(all = 10.dp),
|
||||||
|
onClick = { navController?.navigate(performanceId) }) {
|
||||||
|
Text(event.performance.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||||
|
@Preview(name = "Dark Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||||
|
@Composable
|
||||||
|
fun SchedulePreview() {
|
||||||
|
Mobile_LabsTheme {
|
||||||
|
Surface(
|
||||||
|
color = MaterialTheme.colorScheme.background
|
||||||
|
) {
|
||||||
|
Schedule(navController = null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.example.mobile_labs.event.model
|
||||||
|
|
||||||
|
import com.example.mobile_labs.performance.model.Performance
|
||||||
|
import com.example.mobile_labs.person.model.Person
|
||||||
|
import java.io.Serializable
|
||||||
|
import java.time.LocalDate
|
||||||
|
|
||||||
|
data class Event(
|
||||||
|
val date: LocalDate,
|
||||||
|
val performance: Performance,
|
||||||
|
) : Serializable
|
||||||
|
|
||||||
|
fun getTestEvents(): List<Event> {
|
||||||
|
val director = Person("Иванов", "Иван", "https://bolshoi.ru/media/members/photos/86_ru_twyyatusbnifnzi_300x300_p.jpg");
|
||||||
|
val author = Person("Петров", "Петр", "https://bolshoi.ru/media/members/photos/86_ru_twyyatusbnifnzi_300x300_p.jpg");
|
||||||
|
val actors = listOf(director, author);
|
||||||
|
val performances = listOf(
|
||||||
|
Performance(0,"Представление #1", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
|
Performance(1,"Представление #2", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
|
Performance(2,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
|
)
|
||||||
|
return listOf(
|
||||||
|
Event(LocalDate.parse("2023-10-15"), performances[0]),
|
||||||
|
Event(LocalDate.parse("2023-10-16"), performances[1]),
|
||||||
|
Event(LocalDate.parse("2023-10-17"), performances[2])
|
||||||
|
)
|
||||||
|
}
|
@ -51,7 +51,7 @@ fun Repertoire(navController: NavController?) {
|
|||||||
TextField(value = title, label = {Text(text = "Поиск...")}, onValueChange = { title = it; performances =
|
TextField(value = title, label = {Text(text = "Поиск...")}, onValueChange = { title = it; performances =
|
||||||
if (title != "") getTestPerformances().filter { performance -> performance.title.contains(title) } else getTestPerformances() })
|
if (title != "") getTestPerformances().filter { performance -> performance.title.contains(title) } else getTestPerformances() })
|
||||||
performances.forEachIndexed() { index, performance ->
|
performances.forEachIndexed() { index, performance ->
|
||||||
val performanceId = Screen.PerformanceView.route.replace("{id}", index.toString())
|
val performanceId = Screen.PerformanceView.route.replace("{id}", performance.id.toString())
|
||||||
Row(Modifier.padding(all = 10.dp)) {
|
Row(Modifier.padding(all = 10.dp)) {
|
||||||
AsyncImage(model = performance.previewImageURL,
|
AsyncImage(model = performance.previewImageURL,
|
||||||
contentDescription = "performance preview image",
|
contentDescription = "performance preview image",
|
||||||
|
@ -4,6 +4,7 @@ import com.example.mobile_labs.person.model.Person
|
|||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
|
|
||||||
data class Performance(
|
data class Performance(
|
||||||
|
val id: Int,
|
||||||
val title: String,
|
val title: String,
|
||||||
val description: String,
|
val description: String,
|
||||||
val author: Person,
|
val author: Person,
|
||||||
@ -18,16 +19,16 @@ fun getTestPerformances(): List<Performance> {
|
|||||||
val author = Person("Петров", "Петр", "https://bolshoi.ru/media/members/photos/86_ru_twyyatusbnifnzi_300x300_p.jpg");
|
val author = Person("Петров", "Петр", "https://bolshoi.ru/media/members/photos/86_ru_twyyatusbnifnzi_300x300_p.jpg");
|
||||||
val actors = listOf(director, author);
|
val actors = listOf(director, author);
|
||||||
return listOf(
|
return listOf(
|
||||||
Performance("Представление #1", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(0,"Представление #1", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #2", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(1,"Представление #2", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(2,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(3,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(4,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(5,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(6,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(7,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(8,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(9,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
Performance("Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
Performance(10,"Представление #3", "Netus quis congue nascetur ullamcorper nibh, nostra iaculis turpis!", author, director, actors, "https://img.freepik.com/free-photo/empty-stage-with-few-props-red-seats_181624-57595.jpg?w=1380&t=st=1696959739~exp=1696960339~hmac=2107448a1d874f1315b5cf246c71df70dc653707c7c8be4a38581d3b73f842ba", "https://www.theatreinparis.com/uploads/images/article/theatre-de-l-athenee-dr.jpg"),
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user