Merge pull request #4726 from Bnyro/master

feat: preference to disable sponsorblock submit button
This commit is contained in:
Bnyro 2023-09-08 23:23:04 +02:00 committed by GitHub
commit 0bf19d9437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 MAX_CONCURRENT_DOWNLOADS = "max_concurrent_downloads"
const val DISABLE_VIDEO_IMAGE_PROXY = "disable_video_image_proxy"
const val CONTRIBUTE_TO_SB = "sb_contribute_key"
/**
* History

View File

@ -13,8 +13,10 @@ import androidx.media3.exoplayer.trackselection.TrackSelector
import androidx.media3.ui.PlayerView.ControllerVisibilityListener
import com.github.libretube.R
import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.extensions.toID
import com.github.libretube.helpers.PlayerHelper
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.helpers.WindowHelper
import com.github.libretube.obj.BottomSheetItem
import com.github.libretube.ui.base.BaseActivity
@ -166,7 +168,7 @@ class OnlinePlayerView(
PlayerHelper.autoPlayEnabled = isChecked
}
binding.sbSubmit.isVisible = PlayerHelper.sponsorBlockEnabled
binding.sbSubmit.isVisible = PreferenceHelper.getBoolean(PreferenceKeys.CONTRIBUTE_TO_SB, false)
binding.sbSubmit.setOnClickListener {
val currentPosition = player?.currentPosition?.takeIf { it != C.TIME_UNSET } ?: 0
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="segment_type">Segment type</string>
<string name="sb_invalid_segment">Invalid segment start or end</string>
<string name="contribute_to_sponsorblock">Contribute to SponsorBlock</string>
<!-- Notification channel strings -->
<string name="download_channel_name">Download Service</string>

View File

@ -17,6 +17,14 @@
app:key="sb_notifications_key"
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
app:defaultValue="false"
app:key="dearrow"