mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-07-26 22:42:17 +00:00
feat(settings): add reset action to catalog and meta sections
This commit is contained in:
parent
333063bd1e
commit
51199f1908
3 changed files with 31 additions and 39 deletions
|
|
@ -31,6 +31,7 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
|||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.nuvio.app.core.ui.NuvioActionLabel
|
||||
import com.nuvio.app.features.home.HomeCatalogSettingsItem
|
||||
import com.nuvio.app.features.home.HomeCatalogSettingsRepository
|
||||
import com.nuvio.app.features.home.components.HomeEmptyStateCard
|
||||
|
|
@ -97,12 +98,13 @@ internal fun LazyListScope.homescreenSettingsContent(
|
|||
SettingsSection(
|
||||
title = "CATALOGS",
|
||||
isTablet = isTablet,
|
||||
actions = {
|
||||
NuvioActionLabel(
|
||||
text = "Reset",
|
||||
onClick = HomeCatalogSettingsRepository::resetToDefaults,
|
||||
)
|
||||
},
|
||||
) {
|
||||
SettingsActionRow(
|
||||
label = "Reset",
|
||||
isTablet = isTablet,
|
||||
onClick = HomeCatalogSettingsRepository::resetToDefaults,
|
||||
)
|
||||
HomescreenCatalogList(
|
||||
isTablet = isTablet,
|
||||
items = items,
|
||||
|
|
@ -232,7 +234,7 @@ private fun HomescreenCatalogList(
|
|||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(max = if (isTablet) 760.dp else 560.dp),
|
||||
.heightIn(max = if (isTablet) 900.dp else 680.dp),
|
||||
state = lazyListState,
|
||||
) {
|
||||
itemsIndexed(items, key = { _, item -> item.key }) { index, item ->
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
|
|||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.nuvio.app.core.ui.NuvioActionLabel
|
||||
import com.nuvio.app.features.details.MetaScreenSectionItem
|
||||
import com.nuvio.app.features.details.MetaScreenSettingsRepository
|
||||
import com.nuvio.app.features.details.MetaScreenSettingsUiState
|
||||
|
|
@ -45,12 +46,13 @@ internal fun LazyListScope.metaScreenSettingsContent(
|
|||
SettingsSection(
|
||||
title = "SECTIONS",
|
||||
isTablet = isTablet,
|
||||
actions = {
|
||||
NuvioActionLabel(
|
||||
text = "Reset",
|
||||
onClick = MetaScreenSettingsRepository::resetToDefaults,
|
||||
)
|
||||
},
|
||||
) {
|
||||
SettingsActionRow(
|
||||
label = "Reset",
|
||||
isTablet = isTablet,
|
||||
onClick = MetaScreenSettingsRepository::resetToDefaults,
|
||||
)
|
||||
SettingsGroup(isTablet = isTablet) {
|
||||
MetaSectionReorderableList(
|
||||
items = uiState.items,
|
||||
|
|
@ -78,7 +80,7 @@ private fun MetaSectionReorderableList(
|
|||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(max = if (isTablet) 680.dp else 520.dp),
|
||||
.heightIn(max = if (isTablet) 820.dp else 640.dp),
|
||||
state = lazyListState,
|
||||
) {
|
||||
itemsIndexed(items, key = { _, item -> item.key.name }) { index, item ->
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Arrangement
|
|||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
|
|
@ -30,7 +31,6 @@ import androidx.compose.material3.Surface
|
|||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.SwitchDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -44,6 +44,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
|
|||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.nuvio.app.core.ui.NuvioActionLabel
|
||||
import com.nuvio.app.core.ui.NuvioBackButton
|
||||
import com.nuvio.app.core.ui.NuvioSectionLabel
|
||||
import com.nuvio.app.features.home.HomeCatalogSettingsItem
|
||||
|
|
@ -175,37 +176,24 @@ internal fun SettingsSidebarItem(
|
|||
internal fun SettingsSection(
|
||||
title: String,
|
||||
isTablet: Boolean,
|
||||
actions: @Composable RowScope.() -> Unit = {},
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
Column {
|
||||
NuvioSectionLabel(text = title)
|
||||
Spacer(modifier = Modifier.height(if (isTablet) 12.dp else 10.dp))
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SettingsActionRow(
|
||||
label: String,
|
||||
isTablet: Boolean,
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
val horizontalPadding = if (isTablet) 20.dp else 16.dp
|
||||
val verticalPadding = if (isTablet) 10.dp else 8.dp
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalPadding, vertical = verticalPadding),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
) {
|
||||
TextButton(onClick = onClick) {
|
||||
Text(
|
||||
text = label,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
NuvioSectionLabel(text = title)
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.End,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
content = actions,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(if (isTablet) 12.dp else 10.dp))
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue