mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
feat(ui): settings for thumbnail on seekbar (#1256)
This commit is contained in:
parent
fcac19737c
commit
c4ccc5d351
6 changed files with 35 additions and 5 deletions
|
@ -25,10 +25,13 @@ import androidx.core.view.isGone
|
|||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.media3.common.PlaybackException
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.session.MediaSession
|
||||
import androidx.media3.ui.*
|
||||
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.preference.PreferenceManager
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
|
||||
import com.github.rubensousa.previewseekbar.PreviewBar
|
||||
|
|
|
@ -8,6 +8,9 @@ import android.os.Build
|
|||
import android.util.Log
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.core.graphics.scale
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.lagradost.cloudstream3.AcraApplication
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
|
@ -62,8 +65,12 @@ interface IPreviewGenerator {
|
|||
|
||||
companion object {
|
||||
fun new(): IPreviewGenerator {
|
||||
val userDisabled = AcraApplication.context?.let { ctx ->
|
||||
PreferenceManager.getDefaultSharedPreferences(ctx)?.getBoolean(
|
||||
ctx.getString(R.string.preview_seekbar_key), true) == false
|
||||
} ?: false
|
||||
/** because TV has low ram + not show we disable this for now */
|
||||
return if (isLayout(TV)) {
|
||||
return if (isLayout(TV) || userDisabled) {
|
||||
empty()
|
||||
} else {
|
||||
PreviewGenerator()
|
||||
|
|
|
@ -45,7 +45,8 @@ class SettingsPlayer : PreferenceFragmentCompat() {
|
|||
),
|
||||
TV or EMULATOR
|
||||
)
|
||||
|
||||
|
||||
getPref(R.string.preview_seekbar_key)?.hideOn(TV)
|
||||
getPref(R.string.pref_category_android_tv_key)?.hideOn(PHONE)
|
||||
|
||||
getPref(R.string.video_buffer_length_key)?.setOnPreferenceClickListener {
|
||||
|
@ -243,4 +244,4 @@ class SettingsPlayer : PreferenceFragmentCompat() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
10
app/src/main/res/drawable/preview_seekbar_24.xml
Normal file
10
app/src/main/res/drawable/preview_seekbar_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/white">
|
||||
<path
|
||||
android:pathData="m480,540 l240,-160 -240,-160v320ZM508,760h224q-7,26 -24,42t-44,20L228,875q-33,5 -59.5,-15.5T138,806L85,369q-4,-33 16,-59t53,-30l46,-6v80l-36,5 54,437 290,-36ZM360,680q-33,0 -56.5,-23.5T280,600v-440q0,-33 23.5,-56.5T360,80h440q33,0 56.5,23.5T880,160v440q0,33 -23.5,56.5T800,680L360,680ZM360,600h440v-440L360,160v440ZM580,380ZM218,796Z"
|
||||
android:fillColor="@android:color/white"/>
|
||||
</vector>
|
|
@ -811,4 +811,7 @@
|
|||
<string name="sort_release_date_old">Release Date (Old to New)</string>
|
||||
<string name="hide_player_control_names_key" translatable="false">hide_player_control_names_key</string>
|
||||
<string name="hide_player_control_names">Hide names of the player\'s controls</string>
|
||||
<string name="preview_seekbar_key" translatable="false">preview_seekbar_key</string>
|
||||
<string name="preview_seekbar">Seekbar preview</string>
|
||||
<string name="preview_seekbar_desc">Enable preview thumbnail on seekbar</string>
|
||||
</resources>
|
|
@ -104,6 +104,12 @@
|
|||
app:defaultValue="false"
|
||||
android:summary="@string/auto_rotate_video_desc"
|
||||
app:key="@string/auto_rotate_video_key" />
|
||||
<SwitchPreference
|
||||
android:icon="@drawable/preview_seekbar_24"
|
||||
android:title="@string/preview_seekbar"
|
||||
app:defaultValue="true"
|
||||
android:summary="@string/preview_seekbar_desc"
|
||||
app:key="@string/preview_seekbar_key" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
|
Loading…
Reference in a new issue