Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ class GeneratorPlayer : FullScreenPlayer() {
}
// setEpisodes(viewModel.getAllMeta() ?: emptyList())
isActive = true
setPlayerDimen(null)
updatePlayerInfo(reset = true)
setTitle()
if (!sameEpisode)
hasRequestedStamps = false
Expand Down Expand Up @@ -1830,26 +1830,18 @@ class GeneratorPlayer : FullScreenPlayer() {
playerBinding?.playerVideoTitle?.text = playerVideoTitle
playerBinding?.offlinePin?.isVisible = lastUsedGenerator is DownloadFileGenerator
}

@SuppressLint("SetTextI18n")
fun setPlayerDimen(widthHeight: Pair<Int, Int>?) {
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
Expand All @@ -1859,14 +1851,19 @@ 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(
audioTrack?.label,
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
Expand All @@ -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?) {
Expand Down
18 changes: 4 additions & 14 deletions app/src/main/res/layout/player_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,15 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2.5dp"
android:gravity="center"
android:textColor="@color/white"
tools:text="1920x1080" />


<TextView
android:id="@+id/player_video_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:gravity="center"
android:layout_marginBottom="2.5dp"
android:textColor="@color/white"
android:visibility="gone"
tools:text="HEVC" />
android:textColor="@color/grayTextColor"
android:textSize="12sp"
tools:text="1920x1080 • HDR10 • HEVC" />

<LinearLayout
android:id="@+id/player_video_title_holder"
Expand Down
21 changes: 4 additions & 17 deletions app/src/main/res/layout/player_custom_layout_tv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,30 +307,17 @@
android:layout_gravity="start"/>
</LinearLayout>

<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:gravity="end"
android:maxWidth="600dp"
android:textAlignment="viewEnd"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />

<TextView
android:id="@+id/player_video_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="2.5dp"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone"
android:textColor="@color/grayTextColor"
android:textSize="12sp"
android:layout_gravity="end"
tools:text="HDR10 • HEVC" />

tools:text="1920x1080 • HDR10 • HEVC" />

<FrameLayout
android:id="@+id/player_episode_filler_holder"
Expand Down
32 changes: 13 additions & 19 deletions app/src/main/res/layout/trailer_custom_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
android:id="@+id/player_top_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
>

<LinearLayout
android:layout_width="match_parent"
Expand All @@ -96,6 +96,17 @@
android:layout_marginEnd="32dp"
android:orientation="vertical">

<TextView
android:id="@+id/player_video_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="6dp"
android:textColor="@color/grayTextColor"
android:textSize="12sp"
android:ellipsize="end"
tools:text="1920x1080 • HDR10 • HEVC" />

<LinearLayout
android:id="@+id/player_video_title_holder"
android:layout_width="match_parent"
Expand All @@ -111,16 +122,7 @@
android:textSize="16sp"
android:textStyle="bold"
tools:text="Hello world" />
<TextView
android:id="@+id/player_video_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginBottom="2.5dp"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="gone"
tools:text="HDR10 • HEVC" />

<ImageView
android:id="@+id/offline_pin"
android:layout_width="16dp"
Expand All @@ -131,14 +133,6 @@
tools:visibility="visible"
android:layout_gravity="center"/>
</LinearLayout>
<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />

<FrameLayout
android:id="@+id/player_episode_filler_holder"
Expand Down