From 66782f55abb345eab07ec217ccaa1a3f0b71e67b Mon Sep 17 00:00:00 2001 From: Eugene Date: Mon, 22 Jun 2026 18:53:42 +0300 Subject: [PATCH] ui fixes --- .../vbox/client/androidApp/proguard-rules.pro | 5 +++ .../vbox/shared/presentation/MainScreen.kt | 24 +++--------- .../offline/OfflineVideoComponent.kt | 5 ++- .../overview/season/SeasonOverviewScreen.kt | 2 +- .../presentation/saved/SavedMovieScreen.kt | 39 +++++++++++-------- .../settings/tag/LinkTagBottomSheet.kt | 6 ++- .../presentation/settings/tag/TagScreen.kt | 6 ++- 7 files changed, 49 insertions(+), 38 deletions(-) diff --git a/apps/vbox/client/androidApp/proguard-rules.pro b/apps/vbox/client/androidApp/proguard-rules.pro index bf6dd8c..544f9a8 100644 --- a/apps/vbox/client/androidApp/proguard-rules.pro +++ b/apps/vbox/client/androidApp/proguard-rules.pro @@ -39,3 +39,8 @@ -keep class ru.shadowsparky.vbox.shared.domain.RemoteEvent$OnSaved { *; } -keep class ru.shadowsparky.vbox.shared.domain.RemoteEvent$OnRecent { *; } -keep class ru.shadowsparky.vbox.shared.domain.RemoteEvent$OnSearch { *; } + +# Сохраняем все классы, реализующие Parcelable, и их обязательное поле CREATOR +-keepclassmembers class * implements android.os.Parcelable { + static ** CREATOR; +} diff --git a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/MainScreen.kt b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/MainScreen.kt index 4c39bd3..5211853 100644 --- a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/MainScreen.kt +++ b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/MainScreen.kt @@ -2,7 +2,6 @@ package ru.shadowsparky.vbox.shared.presentation import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.LargeTopAppBar import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults @@ -13,8 +12,6 @@ import androidx.compose.ui.Modifier import ru.shadowsparky.ui.BaseScreen import ru.shadowsparky.ui.LocalBlurState import ru.shadowsparky.ui.applyBlurEffect -import ru.shadowsparky.ui.currentWindowType -import ru.shadowsparky.ui.isCompact import ru.shadowsparky.ui.rememberBlurState import ru.shadowsparky.ui.theme.ComponentDefaults import ru.shadowsparky.vbox.shared.presentation.list.VideoContent @@ -65,21 +62,12 @@ private fun MainScreenInternal(route: Route, child: Child, onNavigate: (Route) - BaseMainScreen( appBar = { navList.findTitle(route)?.let { title -> - if (currentWindowType().isCompact) { - LargeTopAppBar( - title = { Text(title) }, - scrollBehavior = scrollBehavior, - modifier = Modifier.applyBlurEffect(LocalBlurState.current), - colors = ComponentDefaults.topAppBarColors() - ) - } else { - TopAppBar( - title = { Text(title) }, - scrollBehavior = scrollBehavior, - modifier = Modifier.applyBlurEffect(LocalBlurState.current), - colors = ComponentDefaults.topAppBarColors() - ) - } + TopAppBar( + title = { Text(title) }, + scrollBehavior = scrollBehavior, + modifier = Modifier.applyBlurEffect(LocalBlurState.current), + colors = ComponentDefaults.topAppBarColors() + ) } }, route = route, diff --git a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/offline/OfflineVideoComponent.kt b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/offline/OfflineVideoComponent.kt index 1cf4aab..cfa1a9b 100644 --- a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/offline/OfflineVideoComponent.kt +++ b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/offline/OfflineVideoComponent.kt @@ -1,6 +1,8 @@ package ru.shadowsparky.vbox.shared.presentation.offline import com.arkivanov.decompose.ComponentContext +import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.launch import org.koin.core.annotation.Factory import org.koin.core.annotation.Named @@ -20,7 +22,8 @@ class OfflineVideoComponent( private val showPlayer: (Route.Overview.Player) -> Unit, val onBack: () -> Unit ) : ComponentContext by context { - val info = interactor.info + @OptIn(FlowPreview::class) + val info = interactor.info.debounce(300) private val componentScope = createComponentScope() fun play(item: OfflineVideo) { diff --git a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/overview/season/SeasonOverviewScreen.kt b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/overview/season/SeasonOverviewScreen.kt index a6ef99e..c245079 100644 --- a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/overview/season/SeasonOverviewScreen.kt +++ b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/overview/season/SeasonOverviewScreen.kt @@ -56,7 +56,7 @@ fun SeasonOverviewScreen(component: SeasonOverviewComponent) { title = { Text(stringResource(Res.string.seasons_overview)) }, navigationIcon = { - BackButton { component.doBack } + BackButton { component.doBack() } }, scrollBehavior = scrollBehavior, colors = ComponentDefaults.topAppBarColors(), modifier = Modifier.applyBlurEffect(blurState) diff --git a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/saved/SavedMovieScreen.kt b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/saved/SavedMovieScreen.kt index 7ddb520..b07b3aa 100644 --- a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/saved/SavedMovieScreen.kt +++ b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/saved/SavedMovieScreen.kt @@ -2,6 +2,7 @@ package ru.shadowsparky.vbox.shared.presentation.saved import androiddev.apps.vbox.client.shared.generated.resources.Res import androiddev.apps.vbox.client.shared.generated.resources.filter_list +import androiddev.apps.vbox.client.shared.generated.resources.saved_movies import androiddev.apps.vbox.client.shared.generated.resources.saved_movies_not_found import androiddev.apps.vbox.client.shared.generated.resources.user_tags import androiddev.apps.vbox.client.shared.generated.resources.user_tags_filter_disable @@ -22,6 +23,7 @@ import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -33,12 +35,12 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.stringResource +import ru.shadowsparky.ui.LocalBlurState +import ru.shadowsparky.ui.applyBlurEffect import ru.shadowsparky.ui.components.LazyColumn import ru.shadowsparky.ui.theme.ComponentDefaults import ru.shadowsparky.vbox.shared.domain.tag.TagInfo import ru.shadowsparky.vbox.shared.presentation.BaseMainScreen -import ru.shadowsparky.vbox.shared.presentation.createNavigationList -import ru.shadowsparky.vbox.shared.presentation.findTitle import ru.shadowsparky.vbox.shared.presentation.list.VideoScreenContent import ru.shadowsparky.vbox.shared.presentation.nav.Route @@ -46,20 +48,11 @@ import ru.shadowsparky.vbox.shared.presentation.nav.Route @Composable fun SavedMovieScreen(comp: SavedMovieScreenComponent, route: Route, onNavigate: (Route) -> Unit) { val tags by comp.userTags.collectAsStateWithLifecycle(null) - val navList = createNavigationList() var filterBottomSheetVisible by rememberSaveable { mutableStateOf(false) } - if (filterBottomSheetVisible) { - FilterBottomSheet( - comp.filterTag, - tags, - { filterBottomSheetVisible = false }, - onFilterBy = { comp.filterByTag(it) } - ) - } BaseMainScreen( appBar = { TopAppBar( - title = { navList.findTitle(route)?.let { Text(it) } }, + title = { Text(stringResource(Res.string.saved_movies)) }, actions = { IconButton( onClick = { filterBottomSheetVisible = true } @@ -70,13 +63,24 @@ fun SavedMovieScreen(comp: SavedMovieScreenComponent, route: Route, onNavigate: ) } }, - colors = ComponentDefaults.topAppBarColors() + colors = ComponentDefaults.topAppBarColors(), + modifier = Modifier.applyBlurEffect(LocalBlurState.current) ) }, route = route, scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(), onNavigate = onNavigate, - content = { SavedMovieContent(comp, it) } + content = { + if (filterBottomSheetVisible) { + FilterBottomSheet( + comp.filterTag, + tags, + { filterBottomSheetVisible = false }, + onFilterBy = { comp.filterByTag(it) } + ) + } + SavedMovieContent(comp, it) + } ) } @@ -103,8 +107,11 @@ private fun FilterBottomSheet( onFilterBy: (String?) -> Unit ) { allTags ?: return - ModalBottomSheet(onDismissRequest = onDismiss) { - LazyColumn(modifier = Modifier.fillMaxWidth().padding(8.dp)) { + ModalBottomSheet( + onDismissRequest = onDismiss, + sheetState = rememberModalBottomSheetState(true) + ) { + LazyColumn(modifier = Modifier.padding(8.dp)) { item { Text( text = stringResource(Res.string.user_tags), diff --git a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/LinkTagBottomSheet.kt b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/LinkTagBottomSheet.kt index 7c1cfd3..60ffc2b 100644 --- a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/LinkTagBottomSheet.kt +++ b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/LinkTagBottomSheet.kt @@ -16,6 +16,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -35,7 +36,10 @@ fun LinkTagBottomSheet( requestTagsScreen: () -> Unit, updateTag: (String, Boolean) -> Unit ) { - ModalBottomSheet(onDismissRequest = onDismiss) { + ModalBottomSheet( + onDismissRequest = onDismiss, + sheetState = rememberModalBottomSheetState(true) + ) { Column( modifier = Modifier.fillMaxWidth().padding(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp) diff --git a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/TagScreen.kt b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/TagScreen.kt index f66e858..f266870 100644 --- a/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/TagScreen.kt +++ b/apps/vbox/client/shared/src/commonMain/kotlin/ru/shadowsparky/vbox/shared/presentation/settings/tag/TagScreen.kt @@ -22,6 +22,7 @@ import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text import androidx.compose.material3.TextField +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -121,7 +122,10 @@ private fun AddTagBottomSheet( keyboardController?.show() } - ModalBottomSheet(onDismissRequest = onDismiss) { + ModalBottomSheet( + onDismissRequest = onDismiss, + sheetState = rememberModalBottomSheetState(true) + ) { Column( modifier = Modifier.padding(8.dp), verticalArrangement = Arrangement.spacedBy(6.dp)