diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt index be94d96597..deb35235bc 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt @@ -444,12 +444,7 @@ open class FullScreenPlayer : AbstractPlayerFragment() { start() } } - playerBinding?.playerVideoTitleRez?.let { - ObjectAnimator.ofFloat(it, "translationY", titleMove).apply { - duration = 200 - start() - } - } + playerBinding?.playerVideoInfo?.let { ObjectAnimator.ofFloat(it, "translationY", titleMove).apply { duration = 200 @@ -1001,7 +996,6 @@ open class FullScreenPlayer : AbstractPlayerFragment() { // video_bar.startAnimation(fadeAnimation) // TITLE - playerVideoTitleRez.startAnimation(fadeAnimation) playerVideoInfo.startAnimation(fadeAnimation) playerEpisodeFiller.startAnimation(fadeAnimation) playerVideoTitleHolder.startAnimation(fadeAnimation) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt index 933d5de325..96db19b995 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/GeneratorPlayer.kt @@ -512,7 +512,7 @@ class GeneratorPlayer : FullScreenPlayer() { } // setEpisodes(viewModel.getAllMeta() ?: emptyList()) isActive = true - setPlayerDimen(null) + updatePlayerInfo(reset = true) setTitle() if (!sameEpisode) hasRequestedStamps = false @@ -1830,26 +1830,18 @@ class GeneratorPlayer : FullScreenPlayer() { playerBinding?.playerVideoTitle?.text = playerVideoTitle playerBinding?.offlinePin?.isVisible = lastUsedGenerator is DownloadFileGenerator } - - @SuppressLint("SetTextI18n") - fun setPlayerDimen(widthHeight: Pair?) { - val resolution = widthHeight?.let { "${it.first}x${it.second}" } - val name = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name - val title = getHeaderName() - - val result = listOfNotNull( - title?.takeIf { showTitle && it.isNotBlank() }, - name?.takeIf { showName && it.isNotBlank() }, - resolution?.takeIf { showResolution && it.isNotBlank() }, - ).joinToString(" - ") - - playerBinding?.playerVideoTitleRez?.apply { - text = result - isVisible = result.isNotBlank() + /** + * Show the current playback information (e.g. resolution, codec) in the player info text view. + * + * If [reset] is set to `true`, the text view will be cleared instead. + */ + private fun updatePlayerInfo(reset: Boolean = false) { + if (reset) { + playerBinding?.playerVideoInfo?.text = "" + playerBinding?.playerVideoInfo?.isGone = true + return } - } - private fun updatePlayerInfo() { val tracks = player.getVideoTracks() val videoTrack = tracks.currentVideoTrack @@ -1859,6 +1851,10 @@ class GeneratorPlayer : FullScreenPlayer() { val prefs = PreferenceManager.getDefaultSharedPreferences(ctx) showMediaInfo = prefs.getBoolean(ctx.getString(R.string.show_media_info_key), false) + val resolution = videoTrack?.let { "${it.width}x${it.height}" } + val source = currentSelectedLink?.first?.name ?: currentSelectedLink?.second?.name + val headerName = getHeaderName().orEmpty() + val videoCodec = videoTrack?.sampleMimeType?.substringAfterLast('/')?.uppercase() val audioCodec = audioTrack?.sampleMimeType?.substringAfterLast('/')?.uppercase() val language = listOfNotNull( @@ -1866,7 +1862,8 @@ class GeneratorPlayer : FullScreenPlayer() { fromTagToLanguageName(audioTrack?.language)?.let { "[$it]" } ).joinToString(" ") - val stats = arrayOf(videoCodec, audioCodec, language).filter { !it.isNullOrBlank() }.joinToString(" • ") + val stats = arrayOf(source, headerName, resolution, videoCodec, audioCodec, language) + .filter { !it.isNullOrBlank() }.joinToString(" • ") playerBinding?.playerVideoInfo?.apply { text = stats @@ -1876,7 +1873,7 @@ class GeneratorPlayer : FullScreenPlayer() { override fun playerDimensionsLoaded(width: Int, height: Int) { super.playerDimensionsLoaded(width, height) - setPlayerDimen(width to height) + updatePlayerInfo() } private fun unwrapBundle(savedInstanceState: Bundle?) { diff --git a/app/src/main/res/layout/player_custom_layout.xml b/app/src/main/res/layout/player_custom_layout.xml index 7974159c4d..9bd8cd527a 100644 --- a/app/src/main/res/layout/player_custom_layout.xml +++ b/app/src/main/res/layout/player_custom_layout.xml @@ -146,25 +146,15 @@ app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent"> - - - + android:textColor="@color/grayTextColor" + android:textSize="12sp" + tools:text="1920x1080 • HDR10 • HEVC" /> - - - + tools:text="1920x1080 • HDR10 • HEVC" /> + > + + - + -