-
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 9 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 |
---|---|---|
@@ -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!!