Ещё больше визуальных изменений.
This commit is contained in:
2024-09-23 00:33:58 +04:00
parent f929ba2f93
commit f7596749e3
4 changed files with 99 additions and 76 deletions

View File

@@ -17,6 +17,15 @@
</option> </option>
<option name="signal" value="SIGNAL_UNSPECIFIED" /> <option name="signal" value="SIGNAL_UNSPECIFIED" />
<option name="timeIntervalDays" value="THIRTY_DAYS" /> <option name="timeIntervalDays" value="THIRTY_DAYS" />
<option name="versions">
<list>
<VersionSetting>
<option name="buildVersion" value="2" />
<option name="displayName" value="1.1 (2)" />
<option name="displayVersion" value="1.1" />
</VersionSetting>
</list>
</option>
<option name="visibilityType" value="ALL" /> <option name="visibilityType" value="ALL" />
</InsightsFilterSettings> </InsightsFilterSettings>
</value> </value>

View File

@@ -32,8 +32,8 @@ android {
applicationId = "ru.n08i40k.polytechnic.next" applicationId = "ru.n08i40k.polytechnic.next"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 4 versionCode = 5
versionName = "1.2.1" versionName = "1.2.2"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {

View File

@@ -52,8 +52,8 @@ class FakeScheduleRepository : ScheduleRepository {
defaultIndex = 2, defaultIndex = 2,
name = "Операционные системы и среды", name = "Операционные системы и среды",
time = LessonTime(655, 735), time = LessonTime(655, 735),
cabinets = arrayListOf("42"), cabinets = arrayListOf("42", "52"),
teacherNames = arrayListOf("Сергачева А.О."), teacherNames = arrayListOf("Сергачева А.О.", "Не Сергачева А.О."),
), ),
Lesson( Lesson(
type = LessonType.DEFAULT, type = LessonType.DEFAULT,
@@ -61,7 +61,7 @@ class FakeScheduleRepository : ScheduleRepository {
name = "Физическая культура", name = "Физическая культура",
time = LessonTime(755, 835), time = LessonTime(755, 835),
cabinets = arrayListOf("c/3"), cabinets = arrayListOf("c/3"),
teacherNames = arrayListOf("Васюнин В.Г."), teacherNames = arrayListOf("Васюнин В.Г.", "Не Васюнин В.Г."),
), ),
Lesson( Lesson(
type = LessonType.DEFAULT, type = LessonType.DEFAULT,

View File

@@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material3.Card
import androidx.compose.material3.CardColors import androidx.compose.material3.CardColors
import androidx.compose.material3.CardDefaults import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Text import androidx.compose.material3.Text
@@ -19,7 +20,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
@@ -67,7 +67,8 @@ fun LessonExtraInfo(
mutableExpanded: MutableState<Boolean> = mutableStateOf(true) mutableExpanded: MutableState<Boolean> = mutableStateOf(true)
) { ) {
Dialog(onDismissRequest = { mutableExpanded.value = false }) { Dialog(onDismissRequest = { mutableExpanded.value = false }) {
Column(modifier = Modifier.padding(5.dp)) { Card {
Column(Modifier.padding(10.dp)) {
Text(lesson.name) Text(lesson.name)
if (lesson.teacherNames.isNotEmpty()) { if (lesson.teacherNames.isNotEmpty()) {
@@ -82,7 +83,8 @@ fun LessonExtraInfo(
val duration = buildString { val duration = buildString {
append(stringResource(R.string.lesson_duration)) append(stringResource(R.string.lesson_duration))
append(" - ") append(" - ")
val duration = if (lesson.time != null) lesson.time.end - lesson.time.start else 0 val duration =
if (lesson.time != null) lesson.time.end - lesson.time.start else 0
val hours = duration / 60 val hours = duration / 60
val minutes = duration % 60 val minutes = duration % 60
@@ -105,6 +107,7 @@ fun LessonExtraInfo(
} }
} }
} }
}
} }
@Preview(showBackground = true) @Preview(showBackground = true)
@@ -114,7 +117,7 @@ private fun LessonViewRow(
time: LessonTime? = LessonTime(0, 60), time: LessonTime? = LessonTime(0, 60),
timeFormat: LessonTimeFormat = LessonTimeFormat.FROM_TO, timeFormat: LessonTimeFormat = LessonTimeFormat.FROM_TO,
name: String = "Test", name: String = "Test",
teacherNames: String? = "Хомченко Н.Е.", teacherNames: ArrayList<String> = arrayListOf("Хомченко Н.Е.", "Хомченко Н.Е."),
cabinets: ArrayList<String> = arrayListOf("14", "31"), cabinets: ArrayList<String> = arrayListOf("14", "31"),
cardColors: CardColors = CardDefaults.cardColors(), cardColors: CardColors = CardDefaults.cardColors(),
verticalPadding: Dp = 10.dp verticalPadding: Dp = 10.dp
@@ -123,8 +126,7 @@ private fun LessonViewRow(
if (timeFormat == LessonTimeFormat.FROM_TO) cardColors.contentColor else cardColors.disabledContentColor if (timeFormat == LessonTimeFormat.FROM_TO) cardColors.contentColor else cardColors.disabledContentColor
Row( Row(
modifier = Modifier modifier = Modifier.padding(10.dp, verticalPadding),
.padding(10.dp, verticalPadding),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
Text( Text(
@@ -145,9 +147,7 @@ private fun LessonViewRow(
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center
) { ) {
Text( Text(
text = formattedTime[0], text = formattedTime[0], fontFamily = FontFamily.Monospace, color = contentColor
fontFamily = FontFamily.Monospace,
color = contentColor
) )
if (formattedTime.count() > 1) { if (formattedTime.count() > 1) {
Text( Text(
@@ -164,21 +164,26 @@ private fun LessonViewRow(
Column( Column(
verticalArrangement = Arrangement.Center verticalArrangement = Arrangement.Center
) { ) {
val fraction = val fraction = if (cabinets.size == 0) 1F
if (cabinets.size == 0) 1F
else if (cabinets.any { it.contains("/") }) 0.9F else if (cabinets.any { it.contains("/") }) 0.9F
else 0.925F else 0.925F
Row {
Column {
Text( Text(
modifier = Modifier.fillMaxWidth(fraction), modifier = Modifier.fillMaxWidth(fraction),
text = name, text = name,
fontWeight = FontWeight.Medium,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = contentColor color = contentColor
) )
if (!teacherNames.isNullOrEmpty()) {
for (listIdx: Int in 0..<teacherNames.size) {
Text( Text(
modifier = Modifier.fillMaxWidth(fraction), modifier = Modifier.fillMaxWidth(fraction),
text = teacherNames, text = teacherNames[listIdx],
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = contentColor color = contentColor
@@ -186,20 +191,29 @@ private fun LessonViewRow(
} }
} }
Column(verticalArrangement = Arrangement.Center) { Column {
cabinets.forEach { if (cabinets.size <= teacherNames.size) {
Text( Text(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.End, text = "",
text = it, maxLines = 1
fontFamily = FontFamily.Monospace, )
fontWeight = FontWeight.Bold, }
for (listIdx: Int in 0..<cabinets.size) {
Text(
modifier = Modifier.fillMaxWidth(),
text = cabinets[listIdx],
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = contentColor color = contentColor
) )
} }
} }
} }
}
}
} }
@Preview(showBackground = true) @Preview(showBackground = true)
@@ -216,7 +230,7 @@ fun FreeLessonRow(
) else null, ) else null,
LessonTimeFormat.ONLY_MINUTES_DURATION, LessonTimeFormat.ONLY_MINUTES_DURATION,
stringResource(R.string.lesson_break), stringResource(R.string.lesson_break),
null, arrayListOf(),
arrayListOf(), arrayListOf(),
cardColors, cardColors,
2.5.dp 2.5.dp
@@ -235,7 +249,7 @@ fun LessonRow(
lesson.time, lesson.time,
LessonTimeFormat.FROM_TO, LessonTimeFormat.FROM_TO,
lesson.name, lesson.name,
lesson.teacherNames.joinToString(", "), lesson.teacherNames,
lesson.cabinets, lesson.cabinets,
cardColors, cardColors,
5.dp 5.dp