Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ sealed interface RoomTheme {
override val dimColor = Color(0xFF121E25)
}

data object Lunch : RoomTheme {
override val primaryColor = Color(0xFFC1C8C9)
override val containerColor = Color(0xFFC1C8C9).copy(alpha = 0.1f)
override val dimColor = Color(0xFF121E25)
}

val primaryColor: Color
val containerColor: Color
val dimColor: Color
Expand All @@ -49,6 +55,7 @@ sealed interface RoomTheme {
"giraffe" -> Giraffe
"flamingo" -> Flamingo
"jellyfish" -> Jellyfish
"lunch" -> Lunch
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public fun Timetable.Companion.fake(): Timetable {
val start = DroidKaigi2024Day.Workday.start + (index * 60 * 60 + dayOffsetSeconds).seconds
val end = DroidKaigi2024Day.Workday.start + (index * 60 * 60 + dayOffsetSeconds + 40 * 60).seconds
val fake = Session.fake()

add(
fake
.copy(
Expand All @@ -184,6 +185,32 @@ public fun Timetable.Companion.fake(): Timetable {
)
}
}
add(
TimetableItem.Special(
id = TimetableItemId("7"),
title = MultiLangText("Lunch break", "Lunch break"),
startsAt = DroidKaigi2024Day.ConferenceDay1.start + 13.hours,
endsAt = DroidKaigi2024Day.ConferenceDay1.start + 13.hours + 60.minutes,
category = TimetableCategory(
id = 28657,
title = MultiLangText("その他", "Other"),
),
sessionType = TimetableSessionType.NORMAL,
room = roomsIterator.next(),
targetAudience = "",
language = TimetableLanguage(
langOfSpeaker = "",
isInterpretationTarget = false,
),
asset = TimetableAsset(null, null),
levels = persistentListOf(),
speakers = persistentListOf(),
description = MultiLangText(
jaTitle = "Lunch break",
enTitle = "Lunch break",
),
),
)
add(
TimetableItem.Special(
id = TimetableItemId("3"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public sealed class TimetableItem {
"https://2024.droidkaigi.jp/en/timetable/${id.value}"
}

public val isLunch: Boolean get() = startsTimeString.startsWith("13:00") && title.enTitle.lowercase().contains("lunch")

fun getSupportedLangString(isJapaneseLocale: Boolean): String {
val japanese = if (isJapaneseLocale) "日本語" else "Japanese"
val english = if (isJapaneseLocale) "英語" else "English"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data class TimetableRoom(
return sort.compareTo(other.sort)
}

fun getThemeKey(): String = name.enTitle.lowercase()
fun getThemeKey(isLunch: Boolean? = false): String = if (isLunch == true) "lunch" else name.enTitle.lowercase()

// TODO: Names are updated but the shapes need to be checked
fun getShape(): Shapes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fun TimetableGridItem(
derivedStateOf { (height - TimetableGridItemSizes.padding * 2) / 4 > titleMinHeightDp * 3 / 2 }
}

ProvideRoomTheme(timetableItem.room.getThemeKey()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our formatter says this. Could you check it out?

/home/runner/work/conference-app-2024/conference-app-2024/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableGridItem.kt:109:22: Extra braces exist on this branch, remove them. [BracesOnIfStatements]
/home/runner/work/conference-app-2024/conference-app-2024/feature/sessions/src/commonMain/kotlin/io/github/droidkaigi/confsched/sessions/component/TimetableGridItem.kt:109:61: Extra braces exist on this branch, remove them. [BracesOnIfStatements]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. I ran the format fixer....

I will try to fix this.

ProvideRoomTheme(timetableItem.room.getThemeKey(timetableItem.isLunch)) {
val titleTextStyle = MaterialTheme.typography.labelLarge.let {
check(it.fontSize.isSp)
val (titleFontSize, titleLineHeight) = calculateFontSizeAndLineHeight(
Expand Down Expand Up @@ -161,13 +161,15 @@ fun TimetableGridItem(
modifier = Modifier
.weight(1f, fill = false),
) {
Icon(
modifier = Modifier.height(TimetableGridItemSizes.scheduleHeight),
imageVector = vectorResource(checkNotNull(timetableItem.room.icon)),
contentDescription = timetableItem.room.name.currentLangTitle,
tint = LocalRoomTheme.current.primaryColor,
)
Spacer(modifier = Modifier.width(4.dp))
if (!timetableItem.isLunch) {
Icon(
modifier = Modifier.height(TimetableGridItemSizes.scheduleHeight),
imageVector = vectorResource(checkNotNull(timetableItem.room.icon)),
contentDescription = timetableItem.room.name.currentLangTitle,
tint = LocalRoomTheme.current.primaryColor,
)
Spacer(modifier = Modifier.width(4.dp))
}
var scheduleTextStyle = MaterialTheme.typography.labelSmall
if (titleTextStyle.fontSize < scheduleTextStyle.fontSize) {
scheduleTextStyle =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,25 @@ private data class TimetableItemLayout(
private val displayEndsAt = timetableItem.endsAt.minus(1, DateTimeUnit.MINUTE)
val height =
((displayEndsAt - timetableItem.startsAt).inWholeMinutes * minutePx).roundToInt()
val width = with(density) { TimetableSizes.columnWidth.roundToPx() }
val left = rooms.indexOf(timetableItem.room) * width
val top = ((timetableItem.startsAt - dayStart).inWholeMinutes * minutePx).toInt()
val right = left + width
val bottom = top + height

val width: Int
val left: Int
val right: Int

init {
if (timetableItem.isLunch) {
width = with(density) { TimetableSizes.columnWidth.roundToPx() * 5 }
left = 0 // rooms.indexOf(RoomType.RoomF) * width //.indexOf(timetableItem.room) * width
right = left + width
} else {
width = with(density) { TimetableSizes.columnWidth.roundToPx() }
left = rooms.indexOf(timetableItem.room) * width
right = left + width
}
}

fun isVisible(
screenWidth: Int,
screenHeight: Int,
Expand All @@ -537,7 +550,9 @@ private data class TimetableItemLayout(
val screenTop = -scrollY
val screenBottom = -scrollY + screenHeight
val xInside =
left in screenLeft..screenRight || right in screenLeft..screenRight
left in screenLeft..screenRight || right in screenLeft..screenRight ||
left <= screenLeft && right >= screenRight

val yInside =
top in screenTop..screenBottom || bottom in screenTop..screenBottom ||
(top <= screenTop && screenBottom <= bottom)
Expand Down