small player fix

This commit is contained in:
LagradOst 2021-05-28 15:43:43 +02:00
parent 35040e793a
commit ffd3a443fa
2 changed files with 9 additions and 13 deletions

View file

@ -433,10 +433,12 @@ class PlayerFragment : Fragment() {
} }
val nextEp = percentage >= OPENING_PROCENTAGE val nextEp = percentage >= OPENING_PROCENTAGE
val data = localData
skip_op_text.text = if (nextEp) "Next Episode" else "Skip OP" skip_op_text.text = if (nextEp) "Next Episode" else "Skip OP"
val isVis = val isVis =
if (nextEp) hasNext //&& !isCurrentlySkippingEp if (nextEp) hasNext //&& !isCurrentlySkippingEp
else (localData is AnimeLoadResponse) else (data is AnimeLoadResponse && (data.type == TvType.Anime || data.type == TvType.ONA))
skip_op.visibility = if (isVis) View.VISIBLE else View.GONE skip_op.visibility = if (isVis) View.VISIBLE else View.GONE
} }
} }
@ -790,7 +792,7 @@ class PlayerFragment : Fragment() {
skip_op.setOnClickListener { skip_op.setOnClickListener {
if (exoPlayer.currentPosition * 100 / exoPlayer.duration >= OPENING_PROCENTAGE) { if (exoPlayer.currentPosition * 100 / exoPlayer.duration >= OPENING_PROCENTAGE) {
if (hasNextEpisode()) { if (hasNextEpisode()) {
// skip_op.visibility = View.GONE // skip_op.visibility = View.GONE
skipToNextEpisode() skipToNextEpisode()
} }
} else { } else {
@ -1051,7 +1053,7 @@ class PlayerFragment : Fragment() {
video_title_rez?.text = video_title_rez?.text =
if (height == null || width == null) currentUrl.name else "${currentUrl.name} - ${width}x${height}" if (height == null || width == null) currentUrl.name else "${currentUrl.name} - ${width}x${height}"
if(!hasUsedFirstRender) { // DON'T WANT TO SET MULTIPLE MESSAGES if (!hasUsedFirstRender) { // DON'T WANT TO SET MULTIPLE MESSAGES
println("FIRST RENDER") println("FIRST RENDER")
changeSkip() changeSkip()
exoPlayer exoPlayer
@ -1074,8 +1076,7 @@ class PlayerFragment : Fragment() {
.send() .send()
} } else {
else {
changeSkip() changeSkip()
} }
hasUsedFirstRender = true hasUsedFirstRender = true

View file

@ -104,8 +104,6 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="250dp"
android:layout_marginStart="250dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
android:gravity="center" android:gravity="center"
@ -119,16 +117,13 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="250dp"
android:layout_marginStart="250dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
android:gravity="center" android:gravity="center"
android:layout_marginTop="35dp" android:layout_marginTop="0dp"
android:textColor="@color/white" android:textColor="@color/white"
android:id="@+id/video_title_rez" android:id="@+id/video_title_rez"
tools:text="1920x1080" tools:text="1920x1080"
> app:layout_constraintTop_toBottomOf="@+id/video_title">
</TextView> </TextView>
<!-- <!--
<LinearLayout <LinearLayout
@ -619,8 +614,8 @@
card_view:cardBackgroundColor="@color/transparent" card_view:cardBackgroundColor="@color/transparent"
android:foreground="?attr/selectableItemBackgroundBorderless" android:foreground="?attr/selectableItemBackgroundBorderless"
android:id="@+id/skip_op" android:id="@+id/skip_op"
android:visibility="gone"
card_view:cardElevation="0dp" card_view:cardElevation="0dp"
> >
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"