Skip to content

Commit

Permalink
fix: card content on home screen & some tips for select danmaku episode
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Mar 22, 2024
1 parent f6fb10b commit 859d6b4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ A third party **android tv** client for a pirate anime video web.

## Requirement
最低Android版本: [API 24(Android 7.0 Nougat)](https://developer.android.com/about/versions/nougat)

## Others
- [AGETV](https://github.com/muedsa/AGETV)
- [BilibiliLiveTV](https://github.com/muedsa/BilibiliLiveTV)
- [HATV](https://github.com/muedsa/HATV)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package com.muedsa.jcytv.ui.features.detail

import androidx.activity.compose.BackHandler
import androidx.compose.animation.Crossfade
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsFocusedAsState
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -39,7 +41,7 @@ const val EpisodePageSize = 20
val EpisodeProgressStrokeWidth = 12.dp
val WideButtonCornerRadius = 12.dp

@OptIn(ExperimentalTvMaterial3Api::class)
@OptIn(ExperimentalTvMaterial3Api::class, ExperimentalFoundationApi::class)
@Composable
fun EpisodeListWidget(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -189,7 +191,7 @@ fun EpisodeListWidget(
verticalAlignment = Alignment.Bottom
) {
Text(
text = "更改弹幕剧情匹配模式",
text = "更改弹幕剧集匹配模式",
color = MaterialTheme.colorScheme.tertiary,
style = MaterialTheme.typography.titleLarge,
maxLines = 1
Expand Down Expand Up @@ -241,14 +243,26 @@ fun EpisodeListWidget(
items = danEpisodeList,
key = { _, item -> item.episodeId }
) { danEpisodePartIndex, danEpisode ->
val interactionSource = remember { MutableInteractionSource() }
WideButton(
modifier = Modifier.padding(end = 12.dp),
title = {
Text(
modifier = Modifier.basicMarquee(),
text = danEpisode.episodeTitle,
overflow = TextOverflow.Ellipsis
)
},
subtitle = {
val isFocused by interactionSource.collectIsFocusedAsState()
if(isFocused) {
Text(
modifier = Modifier.basicMarquee(),
text = "选此匹配: ${selectedEpisode.first}",
overflow = TextOverflow.Ellipsis
)
}
},
onClick = {
onChangeEpisodeRelation(listOf(selectedEpisode.first to danEpisode))
changeDanEpisodeMode = false
Expand All @@ -266,7 +280,8 @@ fun EpisodeListWidget(
}
})
changeDanEpisodeMode = false
}
},
interactionSource = interactionSource
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.muedsa.compose.tv.widget.ImageCardsRow
import com.muedsa.compose.tv.widget.LoadingScreen
import com.muedsa.compose.tv.widget.LocalErrorMsgBoxState
import com.muedsa.compose.tv.widget.ScreenBackgroundType
import com.muedsa.compose.tv.widget.StandardImageCardsRow
import com.muedsa.jcytv.ui.VideoPosterSize
import com.muedsa.jcytv.ui.features.home.LocalHomeScreenBackgroundState
import com.muedsa.jcytv.ui.nav.LocalAppNavController
Expand Down Expand Up @@ -136,13 +137,19 @@ fun MainScreen(

homeRows.subList(1, homeRows.size).forEach { row ->
item {
ImageCardsRow(
StandardImageCardsRow(
title = row.first,
modelList = row.second,
imageFn = { _, anime ->
anime.imageUrl
},
imageSize = VideoPosterSize,
contentFn = { _, anime ->
ContentModel(
title = anime.title,
subtitle = anime.subTitle
)
},
onItemFocus = { _, anime ->
backgroundState.type = ScreenBackgroundType.BLUR
backgroundState.url = anime.imageUrl
Expand Down

0 comments on commit 859d6b4

Please sign in to comment.