title in fullscreen

This commit is contained in:
Bnyro 2022-06-27 19:02:10 +02:00
parent eda4133261
commit e548905873
2 changed files with 30 additions and 7 deletions

View File

@ -267,8 +267,13 @@ class PlayerFragment : Fragment() {
toggleComments()
}
// FullScreen button trigger
val fullScreenButton = view.findViewById<ImageButton>(R.id.fullscreen)
val exoTitle = view.findViewById<TextView>(R.id.exo_title)
val mainContainer = view.findViewById<ConstraintLayout>(R.id.main_container)
val linLayout = view.findViewById<LinearLayout>(R.id.linLayout)
// FullScreen button trigger
fullScreenButton.setOnClickListener {
exoPlayerView.hideController()
if (!isFullScreen) {
@ -276,24 +281,29 @@ class PlayerFragment : Fragment() {
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
enableTransition(R.id.yt_transition, false)
}
view.findViewById<ConstraintLayout>(R.id.main_container).isClickable = true
view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.GONE
mainContainer.isClickable = true
linLayout.visibility = View.GONE
fullScreenButton.setImageResource(R.drawable.ic_fullscreen_exit)
exoTitle.visibility = View.VISIBLE
val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
isFullScreen = true
} else {
with(motionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
enableTransition(R.id.yt_transition, true)
}
view.findViewById<ConstraintLayout>(R.id.main_container).isClickable = false
view.findViewById<LinearLayout>(R.id.linLayout).visibility = View.VISIBLE
mainContainer.isClickable = false
linLayout.visibility = View.VISIBLE
fullScreenButton.setImageResource(R.drawable.ic_fullscreen)
exoTitle.visibility = View.GONE
val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
isFullScreen = false
}
isFullScreen = !isFullScreen
}
// switching between original aspect ratio (black bars) and zoomed to fill device screen
@ -564,6 +574,8 @@ class PlayerFragment : Fragment() {
view.findViewById<TextView>(R.id.player_title).text = response.title
view.findViewById<TextView>(R.id.player_description).text = response.description
view.findViewById<TextView>(R.id.exo_title).text = response.title
// Listener for play and pause icon change
exoPlayer.addListener(object : Player.Listener {
override fun onIsPlayingChanged(isPlaying: Boolean) {

View File

@ -63,6 +63,17 @@
android:src="@drawable/ic_unlocked"
android:padding="@dimen/exo_icon_padding"
android:background="#00FFFFFF" />
<TextView
android:id="@+id/exo_title"
android:layout_width="500dp"
android:layout_height="match_parent"
android:layout_marginHorizontal="10dp"
android:textSize="20sp"
android:textColor="@android:color/white"
android:maxLines="1"
android:ellipsize="end"
android:visibility="gone"/>
</LinearLayout>
<LinearLayout