[fix&feat] Fix local judgment logic to prevent partial downloaded projects from being judged as local, Better playlists
This commit is contained in:
@@ -12,6 +12,8 @@ import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -28,7 +30,9 @@ import kotlinx.coroutines.launch
|
||||
@Composable
|
||||
fun PlaylistPanel(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewModel)
|
||||
{
|
||||
val colorScheme = MaterialTheme.colorScheme
|
||||
val name by videoPlayerViewModel.currentName
|
||||
val id by videoPlayerViewModel.currentId
|
||||
|
||||
LazyRow(
|
||||
modifier = modifier
|
||||
@@ -48,7 +52,13 @@ fun PlaylistPanel(modifier: Modifier, videoPlayerViewModel: VideoPlayerViewModel
|
||||
videoPlayerViewModel.viewModelScope.launch {
|
||||
videoPlayerViewModel.startPlay(it)
|
||||
}
|
||||
}
|
||||
},
|
||||
colors =
|
||||
if (it.id == id)
|
||||
CardDefaults.cardColors(containerColor = colorScheme.primary)
|
||||
else
|
||||
CardDefaults.cardColors()
|
||||
|
||||
) {
|
||||
Box(Modifier.padding(8.dp).fillMaxSize())
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.io.File
|
||||
import kotlin.collections.sortedWith
|
||||
|
||||
@Composable
|
||||
fun TransmissionScreen(
|
||||
@@ -120,9 +121,12 @@ private fun VideoDownloadCard(
|
||||
{
|
||||
val downloaded = viewModel.fetchManager.getAllDownloadsAsync().filter {
|
||||
it.status == Status.COMPLETED && it.extras.getString(
|
||||
"isComic",
|
||||
"class",
|
||||
""
|
||||
) != "true"
|
||||
) != "comic" && it.extras.getString(
|
||||
"type",
|
||||
""
|
||||
) == "main"
|
||||
}
|
||||
|
||||
val jsonQuery = downloaded.map {
|
||||
@@ -152,7 +156,7 @@ private fun VideoDownloadCard(
|
||||
|
||||
if (video != null) {
|
||||
val group = fv.filter { it.klass == video.klass && it.video.group == video.video.group }
|
||||
for (i in group) {
|
||||
for (i in group.sortedWith(compareBy(naturalOrder()) { it.video.name })) {
|
||||
playList.add("${i.klass}/${i.id}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +108,11 @@ fun VideoPlayerPortal(
|
||||
val duration by videoPlayerViewModel.currentDuration
|
||||
|
||||
ToggleFullScreen(false)
|
||||
Column(Modifier
|
||||
.nestedScroll(nestedScrollConnection)
|
||||
.fillMaxHeight())
|
||||
Column(
|
||||
Modifier
|
||||
.nestedScroll(nestedScrollConnection)
|
||||
.fillMaxHeight()
|
||||
)
|
||||
{
|
||||
Box {
|
||||
PortalCorePlayer(
|
||||
@@ -194,13 +196,15 @@ fun VideoPlayerPortal(
|
||||
fontWeight = FontWeight.Bold,
|
||||
)
|
||||
|
||||
Row(Modifier
|
||||
.align(Alignment.Start)
|
||||
.padding(horizontal = 4.dp)
|
||||
.alpha(0.5f)) {
|
||||
Row(
|
||||
Modifier
|
||||
.align(Alignment.Start)
|
||||
.padding(horizontal = 4.dp)
|
||||
.alpha(0.5f)
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 8.dp),
|
||||
text = klass,
|
||||
text = "$klass.$id",
|
||||
fontSize = 14.sp,
|
||||
maxLines = 1,
|
||||
fontWeight = FontWeight.Bold,
|
||||
@@ -217,12 +221,18 @@ fun VideoPlayerPortal(
|
||||
|
||||
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
||||
|
||||
PlaylistPanel(
|
||||
Modifier,
|
||||
videoPlayerViewModel = videoPlayerViewModel
|
||||
)
|
||||
if (videoPlayerViewModel.videos.size > 1) {
|
||||
PlaylistPanel(
|
||||
Modifier,
|
||||
videoPlayerViewModel = videoPlayerViewModel
|
||||
)
|
||||
|
||||
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
||||
HorizontalDivider(
|
||||
Modifier.padding(vertical = 8.dp),
|
||||
1.dp,
|
||||
DividerDefaults.color
|
||||
)
|
||||
}
|
||||
|
||||
HorizontalGallery(videoPlayerViewModel)
|
||||
HorizontalDivider(Modifier.padding(vertical = 8.dp), 1.dp, DividerDefaults.color)
|
||||
|
||||
Reference in New Issue
Block a user