mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
make it a preference
This commit is contained in:
parent
b997b60d19
commit
31a52f004e
@ -77,6 +77,7 @@ object PreferenceKeys {
|
||||
const val PICTURE_IN_PICTURE = "picture_in_picture"
|
||||
const val PLAYER_RESIZE_MODE = "player_resize_mode"
|
||||
const val SB_SKIP_MANUALLY = "sb_skip_manually_key"
|
||||
const val SB_SHOW_MARKERS = "sb_show_markers"
|
||||
const val LIMIT_HLS = "limit_hls"
|
||||
const val PROGRESSIVE_LOADING_INTERVAL_SIZE = "progressive_loading_interval"
|
||||
|
||||
|
@ -7,6 +7,8 @@ import android.graphics.Paint
|
||||
import android.graphics.Rect
|
||||
import android.util.AttributeSet
|
||||
import com.github.libretube.api.obj.Segment
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.util.PreferenceHelper
|
||||
import com.google.android.exoplayer2.Player
|
||||
import com.google.android.exoplayer2.ui.DefaultTimeBar
|
||||
|
||||
@ -30,6 +32,8 @@ class MarkableTimeBar(
|
||||
private fun drawSegments(canvas: Canvas) {
|
||||
if (player == null) return
|
||||
|
||||
if (!PreferenceHelper.getBoolean(PreferenceKeys.SB_SHOW_MARKERS, false)) return
|
||||
|
||||
canvas.save()
|
||||
length = canvas.width - 2 * HORIZONTAL_OFFSET
|
||||
|
||||
@ -38,9 +42,9 @@ class MarkableTimeBar(
|
||||
segments.forEach {
|
||||
canvas.drawRect(
|
||||
Rect(
|
||||
it.segment!!.first().toLength() + HORIZONTAL_OFFSET,
|
||||
(it.segment!!.first() + HORIZONTAL_OFFSET).toLength(),
|
||||
marginY,
|
||||
it.segment.last().toLength(),
|
||||
(it.segment.last() + HORIZONTAL_OFFSET).toLength(),
|
||||
canvas.height - marginY
|
||||
),
|
||||
Paint().apply {
|
||||
|
@ -22,6 +22,12 @@
|
||||
app:key="sb_skip_manually_key"
|
||||
app:title="@string/sb_skip_manual" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:summary="@string/sb_markers_summary"
|
||||
app:defaultValue="false"
|
||||
app:key="sb_show_markers"
|
||||
app:title="@string/sb_markers" />
|
||||
|
||||
<PreferenceCategory app:title="@string/category_segments">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
|
Loading…
x
Reference in New Issue
Block a user