mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
feat(ui): added option to reset sub delay
Added option for resetting subtitle delay on next episode
This commit is contained in:
parent
5db541d7cc
commit
a25a625538
4 changed files with 33 additions and 7 deletions
|
@ -1,7 +1,10 @@
|
|||
package com.lagradost.cloudstream3.ui.player
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.*
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.graphics.drawable.AnimatedImageDrawable
|
||||
import android.graphics.drawable.AnimatedVectorDrawable
|
||||
import android.media.metrics.PlaybackErrorEvent
|
||||
|
@ -24,11 +27,7 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.media3.common.PlaybackException
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.session.MediaSession
|
||||
import androidx.media3.ui.AspectRatioFrameLayout
|
||||
import androidx.media3.ui.DefaultTimeBar
|
||||
import androidx.media3.ui.PlayerView
|
||||
import androidx.media3.ui.SubtitleView
|
||||
import androidx.media3.ui.TimeBar
|
||||
import androidx.media3.ui.*
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
|
||||
import com.github.rubensousa.previewseekbar.PreviewBar
|
||||
|
@ -380,7 +379,6 @@ abstract class AbstractPlayerFragment(
|
|||
// return super.onMediaButtonEvent(mediaButtonEvent)
|
||||
// }
|
||||
//}
|
||||
|
||||
/** This receives the events from the player, if you want to append functionality you do it here,
|
||||
* do note that this only receives events for UI changes,
|
||||
* and returning early WONT stop it from changing in eg the player time or pause status */
|
||||
|
@ -442,6 +440,15 @@ abstract class AbstractPlayerFragment(
|
|||
|
||||
is VideoEndedEvent -> {
|
||||
context?.let { ctx ->
|
||||
if (PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||
?.getBoolean(
|
||||
ctx.getString(R.string.reset_delay_key),
|
||||
false
|
||||
) == true
|
||||
) {
|
||||
player.setSubtitleOffset(0)
|
||||
}
|
||||
|
||||
// Only play next episode if autoplay is on (default)
|
||||
if (PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||
?.getBoolean(
|
||||
|
|
|
@ -1118,6 +1118,14 @@ class CS3IPlayer : IPlayer {
|
|||
}
|
||||
|
||||
Player.STATE_ENDED -> {
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context)
|
||||
?.getBoolean(
|
||||
context.getString(com.lagradost.cloudstream3.R.string.reset_delay_key),
|
||||
false) == true
|
||||
) {
|
||||
setSubtitleOffset(0)
|
||||
}
|
||||
|
||||
// Only play next episode if autoplay is on (default)
|
||||
if (PreferenceManager.getDefaultSharedPreferences(context)
|
||||
?.getBoolean(
|
||||
|
|
|
@ -768,4 +768,7 @@
|
|||
<string name="audio_book_singular">Audio Book</string>
|
||||
<string name="custom_media_singluar">Media</string>
|
||||
<string name="reset_btn">Reset</string>
|
||||
<string name="reset_delay_settings">Reset delay on next episode</string>
|
||||
<string name="reset_delay_settings_des">Resets subtitle delay on next episode</string>
|
||||
<string name="reset_delay_key" translatable="false">reset_delay_key</string>
|
||||
</resources>
|
|
@ -80,6 +80,14 @@
|
|||
android:title="@string/autoplay_next_settings"
|
||||
app:defaultValue="true"
|
||||
app:key="@string/autoplay_next_key" />
|
||||
<SwitchPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:icon="@drawable/ic_baseline_skip_next_24"
|
||||
android:summary="@string/reset_delay_settings_des"
|
||||
android:title="@string/reset_delay_settings"
|
||||
app:defaultValue="false"
|
||||
app:key="@string/reset_delay_key"/>
|
||||
<SwitchPreference
|
||||
android:icon="@drawable/ic_baseline_skip_next_24"
|
||||
android:title="@string/video_skip_op"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue