cleanup stream items
This commit is contained in:
parent
1e39f97bee
commit
38bf37e88a
|
@ -80,8 +80,6 @@ fun BottomUI(
|
|||
colors = customizedSeekerColors()
|
||||
)
|
||||
|
||||
//Slider(value = 0.4F, onValueChange = {}, modifier = Modifier.weight(1F))
|
||||
|
||||
Text(getTimeStringFromMs(uiState.durationInMs, getLocale() ?: locale))
|
||||
|
||||
val embeddedUiConfig = getEmbeddedUiConfig(LocalContext.current as Activity)
|
||||
|
|
|
@ -95,7 +95,6 @@ fun StreamSelectUI(
|
|||
modifier = Modifier
|
||||
.padding(innerPadding)
|
||||
.fillMaxSize(),
|
||||
// verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
contentPadding = PaddingValues(start = 8.dp, end = 4.dp)
|
||||
) {
|
||||
if (isChapterSelect) {
|
||||
|
|
|
@ -68,7 +68,7 @@ fun ChapterItem(
|
|||
.padding(5.dp)
|
||||
.clickable { onClicked(id) }
|
||||
) {
|
||||
val contentDescription = stringResource(R.string.chapter)
|
||||
val contentDescription = stringResource(R.string.chapter_thumbnail)
|
||||
if (thumbnail != null) {
|
||||
when (thumbnail) {
|
||||
is OnlineThumbnail -> AsyncImage(
|
||||
|
|
|
@ -65,7 +65,68 @@ import net.newpipe.newplayer.utils.VectorThumbnail
|
|||
import net.newpipe.newplayer.utils.getLocale
|
||||
import net.newpipe.newplayer.utils.getTimeStringFromMs
|
||||
|
||||
@Composable
|
||||
private fun Thumbnail(thumbnail: Thumbnail?, contentDescription: String) {
|
||||
if (thumbnail != null) {
|
||||
when (thumbnail) {
|
||||
is OnlineThumbnail -> AsyncImage(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
model = thumbnail.url,
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
|
||||
is BitmapThumbnail -> Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
bitmap = thumbnail.img,
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
|
||||
is VectorThumbnail -> Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
imageVector = thumbnail.vec,
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Image(
|
||||
painter = painterResource(R.drawable.tiny_placeholder),
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
private fun DragComposable(onDragStart: () -> Unit, onDragEnd: () -> Unit) {
|
||||
Box(modifier = Modifier
|
||||
.aspectRatio(1f)
|
||||
.fillMaxSize()
|
||||
.pointerInteropFilter {
|
||||
when (it.action) {
|
||||
MotionEvent.ACTION_UP -> {
|
||||
onDragEnd()
|
||||
false
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
onDragStart()
|
||||
false
|
||||
}
|
||||
|
||||
else -> true
|
||||
}
|
||||
}) {
|
||||
Icon(
|
||||
modifier = Modifier
|
||||
.size(25.dp)
|
||||
.align(Alignment.Center),
|
||||
imageVector = Icons.Filled.DragHandle,
|
||||
//contentDescription = stringResource(R.string.stream_item_drag_handle)
|
||||
contentDescription = "placeholer, TODO: FIXME"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun StreamItem(
|
||||
modifier: Modifier = Modifier,
|
||||
|
@ -86,37 +147,10 @@ fun StreamItem(
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.aspectRatio(16f / 9f)
|
||||
.wrapContentHeight()
|
||||
.fillMaxWidth()
|
||||
.wrapContentSize()
|
||||
) {
|
||||
val contentDescription = stringResource(R.string.chapter)
|
||||
if (thumbnail != null) {
|
||||
when (thumbnail) {
|
||||
is OnlineThumbnail -> AsyncImage(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
model = thumbnail.url,
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
|
||||
is BitmapThumbnail -> Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
bitmap = thumbnail.img,
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
|
||||
is VectorThumbnail -> Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
imageVector = thumbnail.vec,
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Image(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
painter = painterResource(R.drawable.tiny_placeholder),
|
||||
contentDescription = contentDescription
|
||||
)
|
||||
}
|
||||
val contentDescription = stringResource(R.string.stream_item_thumbnail)
|
||||
Thumbnail(thumbnail, contentDescription)
|
||||
Surface(
|
||||
color = CONTROLLER_UI_BACKGROUND_COLOR,
|
||||
modifier = Modifier
|
||||
|
@ -141,7 +175,7 @@ fun StreamItem(
|
|||
modifier = Modifier
|
||||
.padding(1.dp)
|
||||
.weight(1f)
|
||||
.height(IntrinsicSize.Min)
|
||||
.wrapContentHeight()
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
|
@ -156,37 +190,12 @@ fun StreamItem(
|
|||
}
|
||||
}
|
||||
|
||||
Box(modifier = Modifier
|
||||
.aspectRatio(1f)
|
||||
.fillMaxSize()
|
||||
.pointerInteropFilter {
|
||||
when (it.action) {
|
||||
MotionEvent.ACTION_UP -> {
|
||||
onDragEnd(id)
|
||||
false
|
||||
}
|
||||
DragComposable(onDragStart = { onDragStart(id) }, onDragEnd = { onDragEnd(id) })
|
||||
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
onDragStart(id)
|
||||
false
|
||||
}
|
||||
|
||||
else -> true
|
||||
}
|
||||
}) {
|
||||
Icon(
|
||||
modifier = Modifier
|
||||
.size(25.dp)
|
||||
.align(Alignment.Center),
|
||||
imageVector = Icons.Filled.DragHandle,
|
||||
//contentDescription = stringResource(R.string.stream_item_drag_handle)
|
||||
contentDescription = "placeholer, TODO: FIXME"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(device = "spec:width=1080px,height=200px,dpi=440,orientation=landscape")
|
||||
@Preview(device = "spec:width=1080px,height=400px,dpi=440,orientation=landscape")
|
||||
@Composable
|
||||
fun StreamItemPreview() {
|
||||
VideoPlayerTheme {
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
<string name="close_chapter_selection">Close chapter selection</string>
|
||||
<string name="close_stream_selection">Close stream selection</string>
|
||||
<string name="chapter">Chapter</string>
|
||||
<string name="chapter_thumbnail">Chapter Thumbnail</string>
|
||||
<string name="chapter_thumbnail">Chapter thumbnail</string>
|
||||
<string name="stream_item_thumbnail">Stream item thumbnail</string>
|
||||
<string name="stream_item_drag_handle">Stream item drag handle</string>
|
||||
<string name="repeat_mode_no_repeat">Repeat mode: No repeat</string>
|
||||
<string name="repeat_mode_repeat_all">Repeat mode: Repeat all</string>
|
||||
|
|
Loading…
Reference in New Issue