-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add timetable detail screen Base (#102)
* add timetableDetail transition * add Coil * add Timetable Detail Screen * Format * Put Japanese into English in comment * Use fake method * Fix spotless * Fix test * Fix test Co-authored-by: taijionishi <69178389+taijionishifc@users.noreply.github.com> Co-authored-by: takahirom <takam.dev@gmail.com>
- Loading branch information
1 parent
6e17b80
commit 90729dd
Showing
10 changed files
with
413 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 28 additions & 2 deletions
30
...ons/src/main/java/io/github/droidkaigi/confsched2022/feature/sessions/SessionsNavGraph.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( | ||
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/" | ||
} |
33 changes: 33 additions & 0 deletions
33
...c/main/java/io/github/droidkaigi/confsched2022/feature/sessions/TimeTableDetailUiModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.