feat: preference to disable sponsorblock submit button

This commit is contained in:
Bnyro 2023-09-08 22:19:20 +02:00
parent b22e026ec0
commit e9fe9621e5
4 changed files with 13 additions and 1 deletions

View File

@ -144,6 +144,7 @@ object PreferenceKeys {
const val CLEAR_BOOKMARKS = "clear_bookmarks" const val CLEAR_BOOKMARKS = "clear_bookmarks"
const val MAX_CONCURRENT_DOWNLOADS = "max_concurrent_downloads" const val MAX_CONCURRENT_DOWNLOADS = "max_concurrent_downloads"
const val DISABLE_VIDEO_IMAGE_PROXY = "disable_video_image_proxy" const val DISABLE_VIDEO_IMAGE_PROXY = "disable_video_image_proxy"
const val CONTRIBUTE_TO_SB = "sb_contribute_key"
/** /**
* History * History

View File

@ -13,8 +13,10 @@ import androidx.media3.exoplayer.trackselection.TrackSelector
import androidx.media3.ui.PlayerView.ControllerVisibilityListener import androidx.media3.ui.PlayerView.ControllerVisibilityListener
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.extensions.toID import com.github.libretube.extensions.toID
import com.github.libretube.helpers.PlayerHelper import com.github.libretube.helpers.PlayerHelper
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.helpers.WindowHelper import com.github.libretube.helpers.WindowHelper
import com.github.libretube.obj.BottomSheetItem import com.github.libretube.obj.BottomSheetItem
import com.github.libretube.ui.base.BaseActivity import com.github.libretube.ui.base.BaseActivity
@ -166,7 +168,7 @@ class OnlinePlayerView(
PlayerHelper.autoPlayEnabled = isChecked PlayerHelper.autoPlayEnabled = isChecked
} }
binding.sbSubmit.isVisible = PlayerHelper.sponsorBlockEnabled binding.sbSubmit.isVisible = PreferenceHelper.getBoolean(PreferenceKeys.CONTRIBUTE_TO_SB, false)
binding.sbSubmit.setOnClickListener { binding.sbSubmit.setOnClickListener {
val currentPosition = player?.currentPosition?.takeIf { it != C.TIME_UNSET } ?: 0 val currentPosition = player?.currentPosition?.takeIf { it != C.TIME_UNSET } ?: 0
val duration = player?.duration?.takeIf { it != C.TIME_UNSET } val duration = player?.duration?.takeIf { it != C.TIME_UNSET }

View File

@ -471,6 +471,7 @@
<string name="sb_create_segment">Create segment</string> <string name="sb_create_segment">Create segment</string>
<string name="segment_type">Segment type</string> <string name="segment_type">Segment type</string>
<string name="sb_invalid_segment">Invalid segment start or end</string> <string name="sb_invalid_segment">Invalid segment start or end</string>
<string name="contribute_to_sponsorblock">Contribute to SponsorBlock</string>
<!-- Notification channel strings --> <!-- Notification channel strings -->
<string name="download_channel_name">Download Service</string> <string name="download_channel_name">Download Service</string>

View File

@ -17,6 +17,14 @@
app:key="sb_notifications_key" app:key="sb_notifications_key"
app:title="@string/sponsorblock_notifications" /> app:title="@string/sponsorblock_notifications" />
<SwitchPreferenceCompat
android:dependency="sb_contribute_key"
android:summaryOff="@string/disabled"
android:summaryOn="@string/enabled"
app:defaultValue="false"
app:key="sb_contribute_key"
app:title="@string/contribute_to_sponsorblock" />
<SwitchPreferenceCompat <SwitchPreferenceCompat
app:defaultValue="false" app:defaultValue="false"
app:key="dearrow" app:key="dearrow"