cleanup stream items
This commit is contained in:
parent
1e39f97bee
commit
38bf37e88a
|
@ -80,8 +80,6 @@ fun BottomUI(
|
||||||
colors = customizedSeekerColors()
|
colors = customizedSeekerColors()
|
||||||
)
|
)
|
||||||
|
|
||||||
//Slider(value = 0.4F, onValueChange = {}, modifier = Modifier.weight(1F))
|
|
||||||
|
|
||||||
Text(getTimeStringFromMs(uiState.durationInMs, getLocale() ?: locale))
|
Text(getTimeStringFromMs(uiState.durationInMs, getLocale() ?: locale))
|
||||||
|
|
||||||
val embeddedUiConfig = getEmbeddedUiConfig(LocalContext.current as Activity)
|
val embeddedUiConfig = getEmbeddedUiConfig(LocalContext.current as Activity)
|
||||||
|
|
|
@ -95,7 +95,6 @@ fun StreamSelectUI(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(innerPadding)
|
.padding(innerPadding)
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
// verticalArrangement = Arrangement.spacedBy(10.dp),
|
|
||||||
contentPadding = PaddingValues(start = 8.dp, end = 4.dp)
|
contentPadding = PaddingValues(start = 8.dp, end = 4.dp)
|
||||||
) {
|
) {
|
||||||
if (isChapterSelect) {
|
if (isChapterSelect) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ fun ChapterItem(
|
||||||
.padding(5.dp)
|
.padding(5.dp)
|
||||||
.clickable { onClicked(id) }
|
.clickable { onClicked(id) }
|
||||||
) {
|
) {
|
||||||
val contentDescription = stringResource(R.string.chapter)
|
val contentDescription = stringResource(R.string.chapter_thumbnail)
|
||||||
if (thumbnail != null) {
|
if (thumbnail != null) {
|
||||||
when (thumbnail) {
|
when (thumbnail) {
|
||||||
is OnlineThumbnail -> AsyncImage(
|
is OnlineThumbnail -> AsyncImage(
|
||||||
|
|
|
@ -65,7 +65,68 @@ import net.newpipe.newplayer.utils.VectorThumbnail
|
||||||
import net.newpipe.newplayer.utils.getLocale
|
import net.newpipe.newplayer.utils.getLocale
|
||||||
import net.newpipe.newplayer.utils.getTimeStringFromMs
|
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)
|
@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
|
@Composable
|
||||||
fun StreamItem(
|
fun StreamItem(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
@ -86,37 +147,10 @@ fun StreamItem(
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.aspectRatio(16f / 9f)
|
.aspectRatio(16f / 9f)
|
||||||
.wrapContentHeight()
|
.wrapContentSize()
|
||||||
.fillMaxWidth()
|
|
||||||
) {
|
) {
|
||||||
val contentDescription = stringResource(R.string.chapter)
|
val contentDescription = stringResource(R.string.stream_item_thumbnail)
|
||||||
if (thumbnail != null) {
|
Thumbnail(thumbnail, contentDescription)
|
||||||
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
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Surface(
|
Surface(
|
||||||
color = CONTROLLER_UI_BACKGROUND_COLOR,
|
color = CONTROLLER_UI_BACKGROUND_COLOR,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
@ -141,7 +175,7 @@ fun StreamItem(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(1.dp)
|
.padding(1.dp)
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.height(IntrinsicSize.Min)
|
.wrapContentHeight()
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
@ -156,37 +190,12 @@ fun StreamItem(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(modifier = Modifier
|
DragComposable(onDragStart = { onDragStart(id) }, onDragEnd = { onDragEnd(id) })
|
||||||
.aspectRatio(1f)
|
|
||||||
.fillMaxSize()
|
|
||||||
.pointerInteropFilter {
|
|
||||||
when (it.action) {
|
|
||||||
MotionEvent.ACTION_UP -> {
|
|
||||||
onDragEnd(id)
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
@Composable
|
||||||
fun StreamItemPreview() {
|
fun StreamItemPreview() {
|
||||||
VideoPlayerTheme {
|
VideoPlayerTheme {
|
||||||
|
|
|
@ -43,7 +43,8 @@
|
||||||
<string name="close_chapter_selection">Close chapter selection</string>
|
<string name="close_chapter_selection">Close chapter selection</string>
|
||||||
<string name="close_stream_selection">Close stream selection</string>
|
<string name="close_stream_selection">Close stream selection</string>
|
||||||
<string name="chapter">Chapter</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="stream_item_drag_handle">Stream item drag handle</string>
|
||||||
<string name="repeat_mode_no_repeat">Repeat mode: No repeat</string>
|
<string name="repeat_mode_no_repeat">Repeat mode: No repeat</string>
|
||||||
<string name="repeat_mode_repeat_all">Repeat mode: Repeat all</string>
|
<string name="repeat_mode_repeat_all">Repeat mode: Repeat all</string>
|
||||||
|
|
Loading…
Reference in New Issue