mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 00:35:26 +02:00
Thank you, Google, very cool
RIP AnimatedVisibility in Lazy layouts
This commit is contained in:
parent
d039f00141
commit
050c0dbe1d
@ -26,11 +26,13 @@ import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
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.foundation.layout.wrapContentWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Colorize
|
||||
import androidx.compose.material.icons.filled.DarkMode
|
||||
@ -153,11 +155,12 @@ private fun DisplayScreen(
|
||||
title = stringResource(R.string.display_settings),
|
||||
navigationIcon = { NavigateUpButton(navigateUp) }
|
||||
) { paddingValues ->
|
||||
LazyColumn(contentPadding = paddingValues) {
|
||||
|
||||
item { Header(stringResource(R.string.color_scheme)) }
|
||||
|
||||
item {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(paddingValues)
|
||||
) {
|
||||
UnittoListItem(
|
||||
leadingContent = {
|
||||
Icon(
|
||||
@ -168,9 +171,7 @@ private fun DisplayScreen(
|
||||
headlineContent = { Text(stringResource(R.string.color_theme)) },
|
||||
supportingContent = { Text(stringResource(R.string.color_theme_support)) },
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
Row(
|
||||
Modifier
|
||||
.horizontalScroll(rememberScrollState())
|
||||
@ -197,9 +198,7 @@ private fun DisplayScreen(
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
AnimatedVisibility(
|
||||
visible = currentThemingMode != ThemingMode.FORCE_LIGHT,
|
||||
enter = expandVertically() + fadeIn(),
|
||||
@ -214,10 +213,8 @@ private fun DisplayScreen(
|
||||
onSwitchChange = onAmoledThemeChange
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
item {
|
||||
UnittoListItem(
|
||||
icon = Icons.Default.Colorize,
|
||||
iconDescription = stringResource(R.string.enable_dynamic_colors),
|
||||
@ -226,9 +223,7 @@ private fun DisplayScreen(
|
||||
switchState = isDynamicThemeEnabled,
|
||||
onSwitchChange = onDynamicThemeChange
|
||||
)
|
||||
}
|
||||
|
||||
item {
|
||||
AnimatedVisibility(
|
||||
visible = !isDynamicThemeEnabled,
|
||||
enter = expandVertically() + fadeIn(),
|
||||
@ -248,9 +243,7 @@ private fun DisplayScreen(
|
||||
modifier = Modifier.padding(start = 40.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
AnimatedVisibility(
|
||||
visible = (!isDynamicThemeEnabled) and (selectedColor != Color.Unspecified),
|
||||
enter = expandVertically() + fadeIn(),
|
||||
@ -272,11 +265,9 @@ private fun DisplayScreen(
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item { Header(stringResource(R.string.additional_settings_group)) }
|
||||
Header(stringResource(R.string.additional_settings_group))
|
||||
|
||||
item {
|
||||
UnittoListItem(
|
||||
icon = Icons.Default.FontDownload,
|
||||
iconDescription = stringResource(R.string.system_font_setting),
|
||||
@ -285,10 +276,7 @@ private fun DisplayScreen(
|
||||
switchState = systemFont,
|
||||
onSwitchChange = updateSystemFont
|
||||
)
|
||||
}
|
||||
|
||||
// MIDDLE ZERO
|
||||
item {
|
||||
UnittoListItem(
|
||||
icon = Icons.Default.ExposureZero,
|
||||
iconDescription = stringResource(R.string.middle_zero_option),
|
||||
@ -297,10 +285,7 @@ private fun DisplayScreen(
|
||||
switchState = middleZero,
|
||||
onSwitchChange = updateMiddleZero
|
||||
)
|
||||
}
|
||||
|
||||
// LANGUAGE
|
||||
item {
|
||||
UnittoListItem(
|
||||
icon = Icons.Default.Language,
|
||||
iconDescription = stringResource(R.string.language_setting),
|
||||
@ -310,7 +295,6 @@ private fun DisplayScreen(
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
|
Loading…
x
Reference in New Issue
Block a user