fifth labwork fix
This commit is contained in:
parent
3cc69552b6
commit
0c373056e8
@ -9,7 +9,7 @@ data class Note(
|
|||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
val id: Int?,
|
val id: Int?,
|
||||||
@ColumnInfo(name = "text")
|
@ColumnInfo(name = "text")
|
||||||
var Text: String,
|
var text: String,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
|
@ -61,12 +61,16 @@ fun AddNewEvent(navController: NavController, eventViewModel: EventViewModel) {
|
|||||||
|
|
||||||
TextField(
|
TextField(
|
||||||
value = name,
|
value = name,
|
||||||
onValueChange = { name = it })
|
onValueChange = { name = it },
|
||||||
|
placeholder = {name = "Название события"})
|
||||||
|
|
||||||
TextField(
|
TextField(
|
||||||
value = date,
|
value = date,
|
||||||
onValueChange = { date = it })
|
onValueChange = { date = it },
|
||||||
var event = Event(null, name, date)
|
placeholder = {date = "Дата"})
|
||||||
|
val formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy")
|
||||||
|
val current = date.format(formatter)
|
||||||
|
var event = Event(null, name, current)
|
||||||
Button(onClick = {
|
Button(onClick = {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
context.createEvent(navController, eventViewModel, event)
|
context.createEvent(navController, eventViewModel, event)
|
||||||
|
@ -103,11 +103,11 @@ import kotlinx.coroutines.launch
|
|||||||
Text("Регистрация", color = Color.Black)
|
Text("Регистрация", color = Color.Black)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row(verticalAlignment = Alignment.Bottom) {
|
// Row(verticalAlignment = Alignment.Bottom) {
|
||||||
TextButton(onClick = {navController?.navigate(Screen.Report.route)}) {
|
// TextButton(onClick = {navController?.navigate(Screen.Report.route)}) {
|
||||||
Text("Оставить отзыв", color = Color.Black)
|
// Text("Оставить отзыв", color = Color.Black)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ fun MounthView(navController: NavHostController){
|
|||||||
Row {
|
Row {
|
||||||
for (l: Event in list) {
|
for (l: Event in list) {
|
||||||
//val date = LocalDate.parse(l.Date.toString())
|
//val date = LocalDate.parse(l.Date.toString())
|
||||||
Row(Modifier.padding(5.dp)) {
|
Column(Modifier.padding(5.dp)) {
|
||||||
Text(formattedString, color = Color.Blue)
|
Text(formattedString, color = Color.Blue)
|
||||||
Text(l.Name, color = Color.Black)
|
Text(l.Name, color = Color.Black)
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
@ -63,14 +64,15 @@ fun WeekView(navController: NavHostController, eventViewModel: EventViewModel)
|
|||||||
}
|
}
|
||||||
var list = events.value
|
var list = events.value
|
||||||
|
|
||||||
Column(Modifier.verticalScroll(state = rememberScrollState())) {
|
Column(modifier = Modifier
|
||||||
|
.verticalScroll(rememberScrollState()).fillMaxWidth()) {
|
||||||
while (date <= endOfWeek) {
|
while (date <= endOfWeek) {
|
||||||
val pattern = "yyyy-MM-dd"
|
val pattern = "yyyy-MM-dd"
|
||||||
val simpleDateFormat = SimpleDateFormat(pattern)
|
val simpleDateFormat = SimpleDateFormat(pattern)
|
||||||
val daten = simpleDateFormat.format(date)
|
val daten = simpleDateFormat.format(date)
|
||||||
Column {
|
Column {
|
||||||
Row {
|
Row {
|
||||||
Text(daten, fontSize = 5.em)
|
Text(daten, fontSize = 6.em)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
@ -89,7 +91,7 @@ fun WeekView(navController: NavHostController, eventViewModel: EventViewModel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Text(" пусто", fontSize = 7.em, fontStyle = FontStyle.Italic,
|
Text(" пусто", fontSize = 5.em, fontStyle = FontStyle.Italic,
|
||||||
color = Color.LightGray
|
color = Color.LightGray
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ import com.example.pmu_dozorova.room.repository.EventRepository
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class EventViewModel
|
class EventViewModel
|
||||||
( private val eventRepository: EventRepository): ViewModel() {
|
(
|
||||||
|
private val eventRepository: EventRepository): ViewModel() {
|
||||||
private val _events = MutableLiveData<List<Event>>()
|
private val _events = MutableLiveData<List<Event>>()
|
||||||
val events: LiveData<List<Event>> get() = _events
|
val events: LiveData<List<Event>> get() = _events
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user