Skip to content

Commit

Permalink
Merge pull request #270 from ooni/fix-zoom-transitions
Browse files Browse the repository at this point in the history
Remove zoom transitions by always providing content on screens
  • Loading branch information
sdsantos authored Nov 13, 2024
2 parents 7e2f903 + 987efa2 commit 83c6aa8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,23 @@ fun DescriptorScreen(
state: DescriptorViewModel.State,
onEvent: (DescriptorViewModel.Event) -> Unit,
) {
val descriptor = state.descriptor ?: return

val pullRefreshState = rememberPullToRefreshState()
Box(
Modifier
.pullToRefresh(
isRefreshing = state.isRefreshing,
onRefresh = { onEvent(DescriptorViewModel.Event.FetchUpdatedDescriptor) },
state = pullRefreshState,
enabled = descriptor.source is Descriptor.Source.Installed,
enabled = state.descriptor?.source is Descriptor.Source.Installed,
)
.background(MaterialTheme.colorScheme.background),
) {
Column {
val descriptorColor = descriptor.color ?: MaterialTheme.colorScheme.primary
val descriptorColor = state.descriptor?.color ?: MaterialTheme.colorScheme.primary
val onDescriptorColor = LocalCustomColors.current.onDescriptor
TopBar(
title = {
Text(descriptor.title.invoke())
Text(state.descriptor?.title?.invoke().orEmpty())
},
navigationIcon = {
IconButton(onClick = { onEvent(DescriptorViewModel.Event.BackClicked) }) {
Expand All @@ -113,6 +111,8 @@ fun DescriptorScreen(
.padding(WindowInsets.navigationBars.asPaddingValues())
.padding(bottom = 32.dp),
) {
val descriptor = state.descriptor ?: return

DescriptorDetails(state, onEvent)

descriptor.metadata()?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ fun SettingsCategoryScreen(
state: SettingsCategoryViewModel.State,
onEvent: (SettingsCategoryViewModel.Event) -> Unit,
) {
val category = state.category ?: return

Column(Modifier.background(MaterialTheme.colorScheme.background)) {
TopBar(
title = {
Text(stringResource(category.title))
Text(state.category?.title?.let { stringResource(it) }.orEmpty())
},
navigationIcon = {
IconButton(onClick = { onEvent(SettingsCategoryViewModel.Event.BackClicked) }) {
Expand All @@ -77,6 +75,7 @@ fun SettingsCategoryScreen(
.verticalScroll(rememberScrollState())
.padding(WindowInsets.navigationBars.asPaddingValues()),
) {
val category = state.category ?: return
Column {
category.settings?.forEach { preferenceItem ->
when (preferenceItem.type) {
Expand Down

0 comments on commit 83c6aa8

Please sign in to comment.