diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.kt b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.kt index 4f030be340d..f854606100f 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.kt @@ -7,8 +7,8 @@ import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.core.os.bundleOf import androidx.fragment.app.Fragment -import org.schabi.newpipe.compose.playlist.Playlist -import org.schabi.newpipe.compose.theme.AppTheme +import org.schabi.newpipe.ui.screens.PlaylistScreen +import org.schabi.newpipe.ui.theme.AppTheme import org.schabi.newpipe.util.KEY_SERVICE_ID import org.schabi.newpipe.util.KEY_URL @@ -21,7 +21,7 @@ class PlaylistFragment : Fragment() { setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setContent { AppTheme { - Playlist() + PlaylistScreen() } } } diff --git a/app/src/main/java/org/schabi/newpipe/paging/PlaylistItemsSource.kt b/app/src/main/java/org/schabi/newpipe/paging/PlaylistItemsSource.kt index 369ede2bfdb..809ed6f7ce9 100644 --- a/app/src/main/java/org/schabi/newpipe/paging/PlaylistItemsSource.kt +++ b/app/src/main/java/org/schabi/newpipe/paging/PlaylistItemsSource.kt @@ -4,10 +4,10 @@ import androidx.paging.PagingSource import androidx.paging.PagingState import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import org.schabi.newpipe.compose.playlist.PlaylistInfo import org.schabi.newpipe.extractor.NewPipe import org.schabi.newpipe.extractor.Page import org.schabi.newpipe.extractor.stream.StreamInfoItem +import org.schabi.newpipe.ui.components.playlist.PlaylistInfo import org.schabi.newpipe.extractor.playlist.PlaylistInfo as ExtractorPlaylistInfo class PlaylistItemsSource( diff --git a/app/src/main/java/org/schabi/newpipe/ui/components/common/Utils.kt b/app/src/main/java/org/schabi/newpipe/ui/components/common/Utils.kt index 90a513eefdf..5a7be7fbdf3 100644 --- a/app/src/main/java/org/schabi/newpipe/ui/components/common/Utils.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/common/Utils.kt @@ -1,8 +1,9 @@ -package org.schabi.newpipe.compose.util +package org.schabi.newpipe.ui.components.common import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.stringResource import androidx.preference.PreferenceManager import androidx.window.core.layout.WindowWidthSizeClass import org.schabi.newpipe.R @@ -10,17 +11,16 @@ import org.schabi.newpipe.info_list.ItemViewMode @Composable fun determineItemViewMode(): ItemViewMode { - val context = LocalContext.current - val listMode = PreferenceManager.getDefaultSharedPreferences(context) + val listMode = PreferenceManager.getDefaultSharedPreferences(LocalContext.current) .getString( - context.getString(R.string.list_view_mode_key), - context.getString(R.string.list_view_mode_value) + stringResource(R.string.list_view_mode_key), + stringResource(R.string.list_view_mode_value) ) return when (listMode) { - context.getString(R.string.list_view_mode_list_key) -> ItemViewMode.LIST - context.getString(R.string.list_view_mode_grid_key) -> ItemViewMode.GRID - context.getString(R.string.list_view_mode_card_key) -> ItemViewMode.CARD + stringResource(R.string.list_view_mode_list_key) -> ItemViewMode.LIST + stringResource(R.string.list_view_mode_grid_key) -> ItemViewMode.GRID + stringResource(R.string.list_view_mode_card_key) -> ItemViewMode.CARD else -> { // Auto mode - evaluate whether to use Grid based on screen real estate. val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass diff --git a/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt b/app/src/main/java/org/schabi/newpipe/ui/components/playlist/PlaylistHeader.kt similarity index 97% rename from app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/playlist/PlaylistHeader.kt index fca84c0de37..b46abc606fe 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistHeader.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/playlist/PlaylistHeader.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.playlist +package org.schabi.newpipe.ui.components.playlist import android.content.res.Configuration import androidx.compose.animation.animateContentSize @@ -35,12 +35,12 @@ import androidx.compose.ui.unit.dp import androidx.fragment.app.FragmentActivity import coil.compose.AsyncImage import org.schabi.newpipe.R -import org.schabi.newpipe.compose.common.DescriptionText -import org.schabi.newpipe.compose.theme.AppTheme import org.schabi.newpipe.error.ErrorUtil import org.schabi.newpipe.extractor.ServiceList import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper import org.schabi.newpipe.extractor.stream.Description +import org.schabi.newpipe.ui.components.common.DescriptionText +import org.schabi.newpipe.ui.theme.AppTheme import org.schabi.newpipe.util.Localization import org.schabi.newpipe.util.NavigationHelper import org.schabi.newpipe.util.image.ImageStrategy diff --git a/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistInfo.kt b/app/src/main/java/org/schabi/newpipe/ui/components/playlist/PlaylistInfo.kt similarity index 92% rename from app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistInfo.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/playlist/PlaylistInfo.kt index ded4d7b7ecf..5147d57a6db 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/playlist/PlaylistInfo.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/playlist/PlaylistInfo.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.playlist +package org.schabi.newpipe.ui.components.playlist import androidx.compose.runtime.Immutable import org.schabi.newpipe.extractor.Image diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamCardItem.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamCardItem.kt similarity index 97% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamCardItem.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamCardItem.kt index b558e099d28..14c07456847 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamCardItem.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamCardItem.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import android.content.res.Configuration import androidx.compose.foundation.ExperimentalFoundationApi @@ -19,8 +19,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import org.schabi.newpipe.compose.theme.AppTheme import org.schabi.newpipe.extractor.stream.StreamInfoItem +import org.schabi.newpipe.ui.theme.AppTheme @OptIn(ExperimentalFoundationApi::class) @Composable diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamGridItem.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamGridItem.kt similarity index 96% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamGridItem.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamGridItem.kt index eea1a0d416a..7190986e9d4 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamGridItem.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamGridItem.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import android.content.res.Configuration import androidx.compose.foundation.ExperimentalFoundationApi @@ -16,8 +16,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import org.schabi.newpipe.compose.theme.AppTheme import org.schabi.newpipe.extractor.stream.StreamInfoItem +import org.schabi.newpipe.ui.theme.AppTheme @OptIn(ExperimentalFoundationApi::class) @Composable diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamList.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamList.kt similarity index 96% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamList.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamList.kt index bcf9fc62eb7..21a9cc1378c 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamList.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamList.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListScope @@ -18,9 +18,9 @@ import androidx.fragment.app.FragmentActivity import androidx.paging.compose.LazyPagingItems import my.nanihadesuka.compose.LazyColumnScrollbar import my.nanihadesuka.compose.LazyVerticalGridScrollbar -import org.schabi.newpipe.compose.util.determineItemViewMode import org.schabi.newpipe.extractor.stream.StreamInfoItem import org.schabi.newpipe.info_list.ItemViewMode +import org.schabi.newpipe.ui.components.common.determineItemViewMode import org.schabi.newpipe.util.NavigationHelper @Composable diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamListItem.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamListItem.kt similarity index 96% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamListItem.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamListItem.kt index 7bcf9c797c7..04efbddd431 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamListItem.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamListItem.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import android.content.res.Configuration import androidx.compose.foundation.ExperimentalFoundationApi @@ -20,8 +20,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import org.schabi.newpipe.compose.theme.AppTheme import org.schabi.newpipe.extractor.stream.StreamInfoItem +import org.schabi.newpipe.ui.theme.AppTheme @OptIn(ExperimentalFoundationApi::class) @Composable diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamMenu.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamMenu.kt similarity index 97% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamMenu.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamMenu.kt index af7f2e63c2e..a6c4135e097 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamMenu.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamMenu.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamThumbnail.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamThumbnail.kt similarity index 97% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamThumbnail.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamThumbnail.kt index 05907e65674..2d0d1353c70 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamThumbnail.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamThumbnail.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box diff --git a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamUtils.kt b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamUtils.kt similarity index 98% rename from app/src/main/java/org/schabi/newpipe/compose/stream/StreamUtils.kt rename to app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamUtils.kt index 06284dd2d91..9c012eac730 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/stream/StreamUtils.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/components/stream/StreamUtils.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.stream +package org.schabi.newpipe.ui.components.stream import androidx.compose.runtime.Composable import androidx.compose.runtime.saveable.rememberSaveable diff --git a/app/src/main/java/org/schabi/newpipe/compose/playlist/Playlist.kt b/app/src/main/java/org/schabi/newpipe/ui/screens/PlaylistScreen.kt similarity index 79% rename from app/src/main/java/org/schabi/newpipe/compose/playlist/Playlist.kt rename to app/src/main/java/org/schabi/newpipe/ui/screens/PlaylistScreen.kt index 7d649e49c63..01669e3c00f 100644 --- a/app/src/main/java/org/schabi/newpipe/compose/playlist/Playlist.kt +++ b/app/src/main/java/org/schabi/newpipe/ui/screens/PlaylistScreen.kt @@ -1,4 +1,4 @@ -package org.schabi.newpipe.compose.playlist +package org.schabi.newpipe.ui.screens import android.content.res.Configuration import androidx.compose.foundation.lazy.grid.GridItemSpan @@ -15,25 +15,27 @@ import androidx.paging.PagingData import androidx.paging.compose.collectAsLazyPagingItems import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf -import org.schabi.newpipe.compose.common.LoadingIndicator -import org.schabi.newpipe.compose.stream.StreamInfoItem -import org.schabi.newpipe.compose.stream.StreamList -import org.schabi.newpipe.compose.theme.AppTheme import org.schabi.newpipe.extractor.stream.Description import org.schabi.newpipe.extractor.stream.StreamInfoItem import org.schabi.newpipe.extractor.stream.StreamType +import org.schabi.newpipe.ui.components.common.LoadingIndicator +import org.schabi.newpipe.ui.components.playlist.PlaylistHeader +import org.schabi.newpipe.ui.components.playlist.PlaylistInfo +import org.schabi.newpipe.ui.components.stream.StreamInfoItem +import org.schabi.newpipe.ui.components.stream.StreamList +import org.schabi.newpipe.ui.theme.AppTheme import org.schabi.newpipe.viewmodels.PlaylistViewModel @Composable -fun Playlist(playlistViewModel: PlaylistViewModel = viewModel()) { +fun PlaylistScreen(playlistViewModel: PlaylistViewModel = viewModel()) { Surface(color = MaterialTheme.colorScheme.background) { val playlistInfo by playlistViewModel.playlistInfo.collectAsState() - Playlist(playlistInfo, playlistViewModel.streamItems) + PlaylistScreen(playlistInfo, playlistViewModel.streamItems) } } @Composable -private fun Playlist( +private fun PlaylistScreen( playlistInfo: PlaylistInfo?, streamFlow: Flow> ) { @@ -75,7 +77,7 @@ private fun PlaylistPreview() { AppTheme { Surface(color = MaterialTheme.colorScheme.background) { - Playlist(playlistInfo, streamFlow) + PlaylistScreen(playlistInfo, streamFlow) } } } diff --git a/app/src/main/java/org/schabi/newpipe/viewmodels/PlaylistViewModel.kt b/app/src/main/java/org/schabi/newpipe/viewmodels/PlaylistViewModel.kt index 7e480277fee..8efe697913e 100644 --- a/app/src/main/java/org/schabi/newpipe/viewmodels/PlaylistViewModel.kt +++ b/app/src/main/java/org/schabi/newpipe/viewmodels/PlaylistViewModel.kt @@ -14,10 +14,10 @@ import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.stateIn -import org.schabi.newpipe.compose.playlist.PlaylistInfo import org.schabi.newpipe.extractor.NewPipe import org.schabi.newpipe.extractor.stream.Description import org.schabi.newpipe.paging.PlaylistItemsSource +import org.schabi.newpipe.ui.components.playlist.PlaylistInfo import org.schabi.newpipe.util.KEY_SERVICE_ID import org.schabi.newpipe.util.KEY_URL import org.schabi.newpipe.util.NO_SERVICE_ID