mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
reorder items
This commit is contained in:
parent
50f8ae898c
commit
45c04a0af6
@ -142,7 +142,7 @@ internal class CustomExoPlayerView(
|
|||||||
private fun initializeAdvancedOptions(context: Context) {
|
private fun initializeAdvancedOptions(context: Context) {
|
||||||
binding.toggleOptions.setOnClickListener {
|
binding.toggleOptions.setOnClickListener {
|
||||||
val bottomSheetFragment = BottomSheet().apply {
|
val bottomSheetFragment = BottomSheet().apply {
|
||||||
val items = listOf(
|
val items = mutableListOf(
|
||||||
BottomSheetItem(
|
BottomSheetItem(
|
||||||
context.getString(R.string.player_autoplay),
|
context.getString(R.string.player_autoplay),
|
||||||
R.drawable.ic_play,
|
R.drawable.ic_play,
|
||||||
@ -152,14 +152,6 @@ internal class CustomExoPlayerView(
|
|||||||
context.getString(R.string.disabled)
|
context.getString(R.string.disabled)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
BottomSheetItem(
|
|
||||||
context.getString(R.string.playback_speed),
|
|
||||||
R.drawable.ic_speed,
|
|
||||||
"${player?.playbackParameters?.speed
|
|
||||||
.toString()
|
|
||||||
.replace(".0", "")
|
|
||||||
}x"
|
|
||||||
),
|
|
||||||
BottomSheetItem(
|
BottomSheetItem(
|
||||||
context.getString(R.string.repeat_mode),
|
context.getString(R.string.repeat_mode),
|
||||||
R.drawable.ic_repeat,
|
R.drawable.ic_repeat,
|
||||||
@ -179,26 +171,42 @@ internal class CustomExoPlayerView(
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
BottomSheetItem(
|
BottomSheetItem(
|
||||||
context.getString(R.string.quality),
|
context.getString(R.string.playback_speed),
|
||||||
R.drawable.ic_hd,
|
R.drawable.ic_speed,
|
||||||
"${player?.videoSize?.height}p"
|
"${player?.playbackParameters?.speed
|
||||||
),
|
.toString()
|
||||||
BottomSheetItem(
|
.replace(".0", "")
|
||||||
context.getString(R.string.captions),
|
}x"
|
||||||
R.drawable.ic_caption,
|
|
||||||
if (trackSelector != null && trackSelector!!.parameters.preferredTextLanguages.isNotEmpty()) {
|
|
||||||
trackSelector!!.parameters.preferredTextLanguages[0]
|
|
||||||
} else {
|
|
||||||
context.getString(R.string.none)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (playerOptionsInterface != null) {
|
||||||
|
items.add(
|
||||||
|
BottomSheetItem(
|
||||||
|
context.getString(R.string.quality),
|
||||||
|
R.drawable.ic_hd,
|
||||||
|
"${player?.videoSize?.height}p"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
items.add(
|
||||||
|
BottomSheetItem(
|
||||||
|
context.getString(R.string.captions),
|
||||||
|
R.drawable.ic_caption,
|
||||||
|
if (trackSelector != null && trackSelector!!.parameters.preferredTextLanguages.isNotEmpty()) {
|
||||||
|
trackSelector!!.parameters.preferredTextLanguages[0]
|
||||||
|
} else {
|
||||||
|
context.getString(R.string.none)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
setItems(items) { index ->
|
setItems(items) { index ->
|
||||||
when (index) {
|
when (index) {
|
||||||
0 -> onAutoplayClicked()
|
0 -> onAutoplayClicked()
|
||||||
1 -> onPlaybackSpeedClicked()
|
1 -> onRepeatModeClicked()
|
||||||
2 -> onRepeatModeClicked()
|
2 -> onResizeModeClicked()
|
||||||
3 -> onResizeModeClicked()
|
3 -> onPlaybackSpeedClicked()
|
||||||
4 -> playerOptionsInterface?.onQualityClicked()
|
4 -> playerOptionsInterface?.onQualityClicked()
|
||||||
5 -> playerOptionsInterface?.onCaptionClicked()
|
5 -> playerOptionsInterface?.onCaptionClicked()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user