-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timetable detail screen Base #102
Changes from 7 commits
3591797
1486b72
c271530
fc0f877
3a694bc
981ddcd
2e57610
240e992
6a1712d
759643b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,10 +4,14 @@ | |||||
|
||||||
package io.github.droidkaigi.confsched2022.model | ||||||
|
||||||
import io.github.droidkaigi.confsched2022.model.TimetableItem.Session | ||||||
import kotlinx.collections.immutable.PersistentList | ||||||
import kotlinx.collections.immutable.persistentListOf | ||||||
import kotlinx.collections.immutable.toPersistentList | ||||||
import kotlinx.datetime.Instant | ||||||
import kotlinx.datetime.LocalDateTime | ||||||
import kotlinx.datetime.TimeZone | ||||||
import kotlinx.datetime.toInstant | ||||||
import kotlinx.datetime.toLocalDateTime | ||||||
import kotlinx.serialization.Serializable | ||||||
import kotlinx.serialization.UseSerializers | ||||||
|
@@ -41,7 +45,9 @@ sealed class TimetableItem { | |||||
val description: String, | ||||||
val speakers: PersistentList<TimetableSpeaker>, | ||||||
val message: MultiLangText?, | ||||||
) : TimetableItem() | ||||||
) : TimetableItem() { | ||||||
companion object | ||||||
} | ||||||
|
||||||
@Serializable | ||||||
data class Special( | ||||||
|
@@ -69,3 +75,51 @@ sealed class TimetableItem { | |||||
"${minutes}min" | ||||||
} | ||||||
} | ||||||
|
||||||
fun TimetableItem.Session.Companion.fake(): Session { | ||||||
return Session( | ||||||
id = TimetableItemId("2"), | ||||||
title = MultiLangText("DroidKaigiのアプリのアーキテクチャ", "DroidKaigi App Architecture"), | ||||||
startsAt = LocalDateTime.parse("2021-10-20T10:30:00") | ||||||
.toInstant(TimeZone.of("UTC+9")), | ||||||
endsAt = LocalDateTime.parse("2021-10-20T10:50:00") | ||||||
.toInstant(TimeZone.of("UTC+9")), | ||||||
category = TimetableCategory( | ||||||
id = 28654, | ||||||
title = MultiLangText( | ||||||
"Android FrameworkとJetpack", | ||||||
"Android Framework and Jetpack", | ||||||
), | ||||||
), | ||||||
room = TimetableRoom( | ||||||
id = 2, | ||||||
name = MultiLangText("Room1", "Room2"), | ||||||
sort = 1 | ||||||
), | ||||||
targetAudience = "For App developer アプリ開発者向け", | ||||||
language = "JAPANESE", | ||||||
asset = TimetableAsset( | ||||||
videoUrl = "https://www.youtube.com/watch?v=hFdKCyJ-Z9A", | ||||||
slideUrl = "https://droidkaigi.jp/2021/", | ||||||
), | ||||||
speakers = listOf( | ||||||
TimetableSpeaker( | ||||||
name = "taka", | ||||||
iconUrl = "https://github.com/takahirom.png", | ||||||
bio = "Likes Android", | ||||||
tagLine = "Android Engineer" | ||||||
), | ||||||
TimetableSpeaker( | ||||||
name = "ry", | ||||||
iconUrl = "https://github.com/ry-itto.png", | ||||||
bio = "Likes iOS", | ||||||
tagLine = "iOS Engineer", | ||||||
), | ||||||
).toPersistentList(), | ||||||
description = "これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。", | ||||||
message = null, | ||||||
levels = listOf( | ||||||
"INTERMEDIATE", | ||||||
).toPersistentList(), | ||||||
) | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [spotless] reported by reviewdog 🐶
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
package io.github.droidkaigi.confsched2022.feature.sessions | ||
|
||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import io.github.droidkaigi.confsched2022.model.TimetableItemId | ||
|
||
fun NavGraphBuilder.sessionsNavGraph(onNavigationIconClick: () -> Unit) { | ||
fun NavGraphBuilder.sessionsNavGraph( | ||
onNavigationIconClick: () -> Unit, | ||
onTimetableClick: (TimetableItemId) -> Unit, | ||
) { | ||
composable(route = SessionsNavGraph.sessionRoute) { | ||
SessionsScreenRoot(onNavigationIconClick = onNavigationIconClick) | ||
SessionsScreenRoot( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Q] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is ok. 👍 |
||
onNavigationIconClick = onNavigationIconClick, | ||
onTimetableClick = onTimetableClick, | ||
) | ||
} | ||
|
||
composable( | ||
route = "${SessionsNavGraph.sessionDetail}{id}", | ||
arguments = listOf( | ||
navArgument("id") { | ||
type = NavType.StringType | ||
} | ||
) | ||
) { | ||
// TODO make it savable | ||
val id = it.arguments?.getString("id") ?: "" | ||
TimetableDetailScreenRoot( | ||
timetableItemId = TimetableItemId(id), | ||
onNavigationIconClick = onNavigationIconClick, | ||
) | ||
} | ||
} | ||
|
||
object SessionsNavGraph { | ||
const val sessionRoute = "sessions" | ||
const val sessionDetail = "session/detail/" | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,33 @@ | ||||
package io.github.droidkaigi.confsched2022.feature.sessions | ||||
|
||||
import io.github.droidkaigi.confsched2022.model.TimetableItem | ||||
import io.github.droidkaigi.confsched2022.ui.Result | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [spotless] reported by reviewdog 🐶
Suggested change
|
||||
data class TimeTableDetailUiModel( | ||||
val timetableDetailState: TimetableDetailState, | ||||
) { | ||||
sealed interface TimetableDetailState { | ||||
|
||||
data class Loaded(val timetableItem: TimetableItem) : TimetableDetailState | ||||
|
||||
object Loading : TimetableDetailState | ||||
|
||||
companion object { | ||||
fun of(timetableItemResult: Result<TimetableItem>): TimetableDetailState { | ||||
return when (timetableItemResult) { | ||||
Result.Loading -> { | ||||
Loading | ||||
} | ||||
is Result.Success -> { | ||||
Loaded(timetableItemResult.data) | ||||
} | ||||
else -> { | ||||
// TODO | ||||
// SessionsState.Error | ||||
Loading | ||||
} | ||||
} | ||||
} | ||||
} | ||||
} | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this dependency is bad ... but I don't know what to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for TimetableItemId? I think this is not so bad. Because the model is used everywhere in this project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right.
I see. Thank you very much!!