mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
Minor cleanup to the PlayerFragment
This commit is contained in:
parent
7af4f20e53
commit
88ecef18dd
@ -1209,8 +1209,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
}.flatten()
|
}.flatten()
|
||||||
.filter { it > 0 }
|
.filter { it > 0 }
|
||||||
.sortedDescending()
|
.sortedDescending()
|
||||||
.toSet()
|
.distinct()
|
||||||
.toList()
|
|
||||||
|
|
||||||
return resolutions.map {
|
return resolutions.map {
|
||||||
VideoResolution(
|
VideoResolution(
|
||||||
@ -1359,8 +1358,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
|
|
||||||
override fun onCaptionsClicked() {
|
override fun onCaptionsClicked() {
|
||||||
if (!this@PlayerFragment::streams.isInitialized ||
|
if (!this@PlayerFragment::streams.isInitialized ||
|
||||||
streams.subtitles == null ||
|
streams.subtitles.isNullOrEmpty()
|
||||||
streams.subtitles!!.isEmpty()
|
|
||||||
) {
|
) {
|
||||||
Toast.makeText(context, R.string.no_subtitles_available, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.no_subtitles_available, Toast.LENGTH_SHORT).show()
|
||||||
return
|
return
|
||||||
@ -1375,7 +1373,7 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
|
|
||||||
BaseBottomSheet()
|
BaseBottomSheet()
|
||||||
.setSimpleItems(subtitlesNamesList) { index ->
|
.setSimpleItems(subtitlesNamesList) { index ->
|
||||||
val language = if (index > 0) subtitleCodesList[index] else null
|
val language = subtitleCodesList.getOrNull(index)
|
||||||
updateCaptionsLanguage(language)
|
updateCaptionsLanguage(language)
|
||||||
this.captionLanguage = language
|
this.captionLanguage = language
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user