enable chapter name in portrait mode

This commit is contained in:
Bnyro 2022-07-10 13:01:24 +02:00
parent d369bd7e23
commit e3a2b32de7
3 changed files with 15 additions and 13 deletions

View File

@ -336,7 +336,7 @@ class PlayerFragment : Fragment() {
binding.linLayout.visibility = View.GONE
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen_exit)
playerBinding.exoTitle.visibility = View.VISIBLE
if (chapters.isNotEmpty()) playerBinding.chapterLL.visibility = View.VISIBLE
playerBinding.chapterLL.isClickable = true
val mainActivity = activity as MainActivity
val fullscreenOrientationPref = PreferenceHelper
@ -373,7 +373,7 @@ class PlayerFragment : Fragment() {
binding.linLayout.visibility = View.VISIBLE
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen)
playerBinding.exoTitle.visibility = View.INVISIBLE
playerBinding.chapterLL.visibility = View.INVISIBLE
playerBinding.chapterLL.isClickable = false
scaleControls(1F)
@ -715,6 +715,8 @@ class PlayerFragment : Fragment() {
if (response.chapters != null) {
chapters = response.chapters
initializeChapters()
// disabling chapterName click in portrait mode
playerBinding.chapterLL.isClickable = false
}
// set default playback speed
@ -976,11 +978,12 @@ class PlayerFragment : Fragment() {
binding.chaptersRecView.adapter = ChaptersAdapter(chapters, exoPlayer)
binding.chaptersRecView.visibility = View.VISIBLE
// enable chapters in the player
// enable the chapters dialog in the player
val titles = mutableListOf<String>()
chapters.forEach {
titles += it.title!!
}
playerBinding.chapterLL.visibility = View.VISIBLE
playerBinding.chapterLL.setOnClickListener {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.chapters)
@ -1213,6 +1216,7 @@ class PlayerFragment : Fragment() {
}
}
// lock the player
private fun lockPlayer(isLocked: Boolean) {
val visibility = if (isLocked) View.VISIBLE else View.GONE

View File

@ -83,8 +83,8 @@
android:id="@+id/speed_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
android:layout_gravity="center"
android:layout_marginHorizontal="5dp"
android:padding="@dimen/exo_icon_padding"
android:text="1x"
android:textColor="#FFFFFF" />
@ -93,8 +93,8 @@
android:id="@+id/quality_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
android:layout_gravity="center"
android:layout_marginHorizontal="5dp"
android:padding="@dimen/exo_icon_padding"
android:text="@string/hls"
android:textColor="#FFFFFF" />
@ -162,7 +162,6 @@
android:layout_height="15dp"
android:layout_gravity="center"
android:layout_marginStart="3dp"
android:layout_marginTop="2dp"
android:src="@drawable/ic_arrow_right" />
</LinearLayout>

View File

@ -49,7 +49,7 @@
android:id="@+id/player_description_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
@ -73,7 +73,7 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginStart="3dp"
android:layout_marginTop="2dp">
<ImageView
@ -93,7 +93,7 @@
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:rotation="180"
android:src="@drawable/ic_like" />
@ -119,7 +119,6 @@
android:id="@+id/chapters_recView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/comments_toggle"
android:layout_marginHorizontal="3dp"
android:layout_marginTop="20dp"
android:nestedScrollingEnabled="false"
@ -245,7 +244,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_toStartOf="@+id/player_subscribe"
android:layout_toEndOf="@+id/player_channelImage"
android:ellipsize="end"
@ -297,7 +296,7 @@
android:id="@+id/commentsToggle_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="@string/comments"
android:textSize="17sp"
app:layout_constraintStart_toStartOf="parent"
@ -307,7 +306,7 @@
android:id="@+id/commentsToggle_imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:src="@drawable/ic_arrow_up_down"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"