refactor: reorganize package structure and rename TvHomeScreen to TvHomeContent for clarity

This commit is contained in:
2026-04-01 21:55:46 +02:00
parent 6e4ea692d5
commit 61ce6abb39
4 changed files with 44 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
package hu.bbara.purefin.tv.home package hu.bbara.purefin.tv
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@@ -22,7 +22,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LifecycleResumeEffect import androidx.lifecycle.compose.LifecycleResumeEffect
import hu.bbara.purefin.feature.shared.home.AppViewModel import hu.bbara.purefin.feature.shared.home.AppViewModel
import hu.bbara.purefin.feature.shared.library.LibraryViewModel import hu.bbara.purefin.feature.shared.library.LibraryViewModel
import hu.bbara.purefin.tv.home.ui.TvHomeScreen import hu.bbara.purefin.tv.home.TvHomeScreen
import hu.bbara.purefin.tv.home.ui.TvHomeTabDestination import hu.bbara.purefin.tv.home.ui.TvHomeTabDestination
import hu.bbara.purefin.tv.home.ui.TvHomeTabItem import hu.bbara.purefin.tv.home.ui.TvHomeTabItem
import hu.bbara.purefin.tv.home.ui.TvHomeTopBar import hu.bbara.purefin.tv.home.ui.TvHomeTopBar

View File

@@ -0,0 +1,35 @@
package hu.bbara.purefin.tv.home
import android.annotation.SuppressLint
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import hu.bbara.purefin.feature.shared.home.ContinueWatchingItem
import hu.bbara.purefin.feature.shared.home.LibraryItem
import hu.bbara.purefin.feature.shared.home.NextUpItem
import hu.bbara.purefin.feature.shared.home.PosterItem
import hu.bbara.purefin.tv.home.ui.TvHomeContent
import org.jellyfin.sdk.model.UUID
@SuppressLint("RememberInComposition")
@Composable
fun TvHomeScreen(
libraries: List<LibraryItem>,
libraryContent: Map<UUID, List<PosterItem>>,
continueWatching: List<ContinueWatchingItem>,
nextUp: List<NextUpItem>,
onMovieSelected: (UUID) -> Unit,
onSeriesSelected: (UUID) -> Unit,
onEpisodeSelected: (UUID, UUID, UUID) -> Unit,
modifier: Modifier = Modifier
) {
TvHomeContent(
libraries = libraries,
libraryContent = libraryContent,
continueWatching = continueWatching,
nextUp = nextUp,
onMovieSelected = onMovieSelected,
onSeriesSelected = onSeriesSelected,
onEpisodeSelected = onEpisodeSelected,
modifier = modifier
)
}

View File

@@ -1,6 +1,5 @@
package hu.bbara.purefin.tv.home.ui package hu.bbara.purefin.tv.home.ui
import android.annotation.SuppressLint
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
@@ -23,9 +22,8 @@ import hu.bbara.purefin.feature.shared.home.NextUpItem
import hu.bbara.purefin.feature.shared.home.PosterItem import hu.bbara.purefin.feature.shared.home.PosterItem
import org.jellyfin.sdk.model.UUID import org.jellyfin.sdk.model.UUID
@SuppressLint("RememberInComposition")
@Composable @Composable
fun TvHomeScreen( fun TvHomeContent(
libraries: List<LibraryItem>, libraries: List<LibraryItem>,
libraryContent: Map<UUID, List<PosterItem>>, libraryContent: Map<UUID, List<PosterItem>>,
continueWatching: List<ContinueWatchingItem>, continueWatching: List<ContinueWatchingItem>,
@@ -44,7 +42,6 @@ fun TvHomeScreen(
libraryContent.keys.associateWith { FocusRequester() } libraryContent.keys.associateWith { FocusRequester() }
} }
LazyColumn( LazyColumn(
modifier = modifier modifier = modifier
.fillMaxSize() .fillMaxSize()
@@ -59,7 +56,7 @@ fun TvHomeScreen(
onMovieSelected = onMovieSelected, onMovieSelected = onMovieSelected,
onEpisodeSelected = onEpisodeSelected, onEpisodeSelected = onEpisodeSelected,
modifier = Modifier.focusRequester(continueWatchingRef) modifier = Modifier.focusRequester(continueWatchingRef)
.focusProperties{ .focusProperties {
down = nextUpRef down = nextUpRef
} }
) )
@@ -72,7 +69,7 @@ fun TvHomeScreen(
items = nextUp, items = nextUp,
onEpisodeSelected = onEpisodeSelected, onEpisodeSelected = onEpisodeSelected,
modifier = Modifier.focusRequester(nextUpRef) modifier = Modifier.focusRequester(nextUpRef)
.focusProperties{ .focusProperties {
up = continueWatchingRef up = continueWatchingRef
libraryRefs.values.firstOrNull()?.let { down = it } libraryRefs.values.firstOrNull()?.let { down = it }
} }
@@ -96,7 +93,8 @@ fun TvHomeScreen(
modifier = if (ref != null) Modifier.focusRequester(ref) else Modifier modifier = if (ref != null) Modifier.focusRequester(ref) else Modifier
.focusProperties { .focusProperties {
up = nextUpRef up = nextUpRef
libraryRefs.values.dropWhile { it != ref }.drop(1).firstOrNull()?.let { down = it } libraryRefs.values.dropWhile { it != ref }.drop(1).firstOrNull()
?.let { down = it }
} }
) )
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))

View File

@@ -7,7 +7,7 @@ import hu.bbara.purefin.app.content.series.SeriesScreen
import hu.bbara.purefin.core.data.navigation.LocalNavigationManager import hu.bbara.purefin.core.data.navigation.LocalNavigationManager
import hu.bbara.purefin.core.data.navigation.Route import hu.bbara.purefin.core.data.navigation.Route
import hu.bbara.purefin.login.ui.LoginScreen import hu.bbara.purefin.login.ui.LoginScreen
import hu.bbara.purefin.tv.home.TvAppScreen import hu.bbara.purefin.tv.TvAppScreen
import hu.bbara.purefin.tv.library.ui.TvLibraryScreen import hu.bbara.purefin.tv.library.ui.TvLibraryScreen
import hu.bbara.purefin.tv.player.TvPlayerScreen import hu.bbara.purefin.tv.player.TvPlayerScreen