mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Fix top margin when viewing video in vertical fullscreen
This commit is contained in:
parent
9cd1fd9d58
commit
b33ecff67e
@ -237,13 +237,18 @@ class PlaylistFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showPlaylistVideos(playlist: Playlist) {
|
private fun showPlaylistVideos(playlist: Playlist) {
|
||||||
val videos = if (playlistType == PlaylistType.PUBLIC) playlistFeed
|
val videos = if (playlistType == PlaylistType.PUBLIC) {
|
||||||
else {
|
playlistFeed
|
||||||
|
} else {
|
||||||
when (selectedSortOrder) {
|
when (selectedSortOrder) {
|
||||||
0, 1 -> {
|
0, 1 -> {
|
||||||
if (playlistType == PlaylistType.LOCAL) playlistFeed.sortedBy {
|
if (playlistType == PlaylistType.LOCAL) {
|
||||||
|
playlistFeed.sortedBy {
|
||||||
it.url.orEmpty().toInt()
|
it.url.orEmpty().toInt()
|
||||||
} else playlistFeed
|
}
|
||||||
|
} else {
|
||||||
|
playlistFeed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
2, 3 -> {
|
2, 3 -> {
|
||||||
playlistFeed.sortedBy { it.duration }
|
playlistFeed.sortedBy { it.duration }
|
||||||
|
@ -219,6 +219,7 @@ internal class CustomExoPlayerView(
|
|||||||
|
|
||||||
playerViewModel?.isFullscreen?.observe(viewLifecycleOwner!!) { isFullscreen ->
|
playerViewModel?.isFullscreen?.observe(viewLifecycleOwner!!) { isFullscreen ->
|
||||||
WindowHelper.toggleFullscreen(activity, isFullscreen)
|
WindowHelper.toggleFullscreen(activity, isFullscreen)
|
||||||
|
updateTopBarMargin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,11 +645,13 @@ internal class CustomExoPlayerView(
|
|||||||
* Add extra margin to the top bar to not overlap the status bar
|
* Add extra margin to the top bar to not overlap the status bar
|
||||||
*/
|
*/
|
||||||
private fun updateTopBarMargin() {
|
private fun updateTopBarMargin() {
|
||||||
val isFullscreen =
|
val margin = when {
|
||||||
resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE ||
|
resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE -> 10
|
||||||
playerViewModel?.isFullscreen?.value == true
|
playerViewModel?.isFullscreen?.value == true -> 20
|
||||||
|
else -> 0
|
||||||
|
}
|
||||||
binding.topBar.updateLayoutParams<MarginLayoutParams> {
|
binding.topBar.updateLayoutParams<MarginLayoutParams> {
|
||||||
topMargin = (if (isFullscreen) 10 else 0).dpToPx().toInt()
|
topMargin = margin.dpToPx().toInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user