-
Notifications
You must be signed in to change notification settings - Fork 200
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
Apply timetable item(session) detail design roughly #85
Merged
takahirom
merged 22 commits into
main
from
yamada-ika/brush-up-timetable-item-detail-screen
Jul 3, 2024
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0759049
feat: brush up bottom bar
Yamada-Ika aa98d23
feat: brush up top bar
Yamada-Ika 64f84a9
feat: brush up headline
Yamada-Ika 5d7fb7d
feat: add timetable summary
Yamada-Ika 62b5bf8
feat: add audience and archive section
Yamada-Ika d30867a
fix: format
Yamada-Ika 24a0393
fix: minor refactor
Yamada-Ika 1bc6a4a
fix: minor refactor
Yamada-Ika 5378ef2
fix: minor refactor
Yamada-Ika cd83ca1
fix: minor refactor
Yamada-Ika b2b1e5b
fix: Special TimetableItem is not fixed
Yamada-Ika 1625b67
feat: switch timetable description language
Yamada-Ika 26a40fc
feat: apply color to headline
Yamada-Ika 1f73c00
fix: space size
Yamada-Ika b454b2e
feat: apply color to summary card
Yamada-Ika f3d0682
fix: space size
Yamada-Ika d1ed1fb
feat: apply color to other section
Yamada-Ika 8944cb6
fix: favorite color
Yamada-Ika b691273
fix: rename resource directory
Yamada-Ika f4442d6
fix: use calendar add icon
Yamada-Ika a9c42d6
fix: format
Yamada-Ika d0ef34e
fix: add preview
Yamada-Ika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
|
@@ -4,19 +4,15 @@ import androidx.compose.animation.AnimatedVisibility | |
import androidx.compose.animation.fadeIn | ||
import androidx.compose.animation.fadeOut | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Button | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.LargeTopAppBar | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.SnackbarHost | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
|
@@ -25,7 +21,6 @@ import androidx.compose.runtime.remember | |
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.input.nestedscroll.nestedScroll | ||
import androidx.compose.ui.platform.testTag | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.compose.composable | ||
|
@@ -36,13 +31,16 @@ import io.github.droidkaigi.confsched.designsystem.preview.MultiLanguagePreviews | |
import io.github.droidkaigi.confsched.designsystem.preview.MultiThemePreviews | ||
import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme | ||
import io.github.droidkaigi.confsched.model.Lang | ||
import io.github.droidkaigi.confsched.model.Lang.JAPANESE | ||
import io.github.droidkaigi.confsched.model.MultiLangText | ||
import io.github.droidkaigi.confsched.model.TimetableItem | ||
import io.github.droidkaigi.confsched.model.TimetableItem.Session | ||
import io.github.droidkaigi.confsched.model.fake | ||
import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loaded | ||
import io.github.droidkaigi.confsched.sessions.TimetableItemDetailScreenUiState.Loading | ||
import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailContent | ||
import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailHeadline | ||
import io.github.droidkaigi.confsched.sessions.component.TimeTableItemDetailSummaryCard | ||
import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailBottomAppBar | ||
import io.github.droidkaigi.confsched.sessions.component.TimetableItemDetailTopAppBar | ||
import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect | ||
import io.github.droidkaigi.confsched.ui.UserMessageStateHolder | ||
import io.github.droidkaigi.confsched.ui.UserMessageStateHolderImpl | ||
|
@@ -151,82 +149,49 @@ private fun TimetableItemDetailScreen( | |
.nestedScroll(scrollBehavior.nestedScrollConnection), | ||
topBar = { | ||
if (uiState is Loaded) { | ||
LargeTopAppBar(title = { | ||
Row { | ||
Button(onClick = { onNavigationIconClick() }) { | ||
Text( | ||
text = "Back", | ||
style = MaterialTheme.typography.bodySmall, | ||
) | ||
} | ||
Text( | ||
modifier = Modifier.weight(1F), | ||
text = uiState.timetableItem.title.currentLangTitle, | ||
style = MaterialTheme.typography.bodyLarge, | ||
) | ||
if (uiState.isLangSelectable) { | ||
Button(onClick = { onSelectedLanguage(JAPANESE) }) { | ||
Text( | ||
text = "日本語", | ||
style = MaterialTheme.typography.bodySmall, | ||
) | ||
} | ||
Button(onClick = { onSelectedLanguage(Lang.ENGLISH) }) { | ||
Text( | ||
text = "English", | ||
style = MaterialTheme.typography.bodySmall, | ||
) | ||
} | ||
} | ||
} | ||
}) | ||
TimetableItemDetailTopAppBar( | ||
isLangSelectable = uiState.isLangSelectable, | ||
onNavigationIconClick = onNavigationIconClick, | ||
onSelectedLanguage = onSelectedLanguage, | ||
scrollBehavior = scrollBehavior, | ||
) | ||
} | ||
}, | ||
bottomBar = { | ||
if (uiState is Loaded) { | ||
Column { | ||
Button( | ||
modifier = Modifier.testTag(TimetableItemDetailBookmarkIconTestTag), | ||
onClick = { onBookmarkClick(uiState.timetableItem) }, | ||
) { | ||
Text(text = "Bookmark: ${uiState.isBookmarked}") | ||
} | ||
Button( | ||
|
||
onClick = { onCalendarRegistrationClick(uiState.timetableItem) }, | ||
) { | ||
Text(text = "Calendar") | ||
} | ||
Button(onClick = { onShareClick(uiState.timetableItem) }) { | ||
Text(text = "Share") | ||
} | ||
} | ||
TimetableItemDetailBottomAppBar( | ||
timetableItem = uiState.timetableItem, | ||
isBookmarked = uiState.isBookmarked, | ||
onBookmarkClick = onBookmarkClick, | ||
onCalendarRegistrationClick = onCalendarRegistrationClick, | ||
onShareClick = onShareClick, | ||
) | ||
} | ||
}, | ||
snackbarHost = { SnackbarHost(hostState = snackbarHostState) }, | ||
) { innerPadding -> | ||
if (uiState is Loaded) { | ||
Column( | ||
Modifier.padding( | ||
top = innerPadding.calculateTopPadding(), | ||
), | ||
LazyColumn( | ||
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. 👍 |
||
modifier = Modifier.fillMaxSize().padding(innerPadding), | ||
) { | ||
val currentLang = uiState.currentLang ?: Lang.ENGLISH | ||
fun MultiLangText.getByLang(lang: Lang): String { | ||
return if (lang == JAPANESE) { | ||
jaTitle | ||
} else { | ||
enTitle | ||
} | ||
item { | ||
TimeTableItemDetailHeadline( | ||
timetableItem = uiState.timetableItem, | ||
) | ||
} | ||
Text( | ||
text = when (val item = uiState.timetableItem) { | ||
is TimetableItem.Session -> item.description.getByLang(currentLang) | ||
is TimetableItem.Special -> item.description.getByLang(currentLang) | ||
}, | ||
) | ||
Button(onClick = { onLinkClick(uiState.timetableItem.url) }) { | ||
Text(text = "Link") | ||
|
||
item { | ||
TimeTableItemDetailSummaryCard( | ||
timetableItem = uiState.timetableItem, | ||
) | ||
} | ||
|
||
item { | ||
TimeTableItemDetailContent( | ||
timetableItem = uiState.timetableItem, | ||
currentLang = uiState.currentLang, | ||
onLinkClick = onLinkClick, | ||
) | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
renamed directory to enable the use of vector images
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.
Nice!