From e9fe9621e5f269ac3cbdbf32f755de85513a8133 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 8 Sep 2023 22:19:20 +0200 Subject: [PATCH] feat: preference to disable sponsorblock submit button --- .../java/com/github/libretube/constants/PreferenceKeys.kt | 1 + .../com/github/libretube/ui/views/OnlinePlayerView.kt | 4 +++- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/sponsorblock_settings.xml | 8 ++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt index f5ebba6cb..c17a3324d 100644 --- a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt +++ b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt @@ -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 diff --git a/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt index b70170176..25aa479b1 100644 --- a/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/OnlinePlayerView.kt @@ -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 } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 07df94dbd..1f029f16e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -471,6 +471,7 @@ Create segment Segment type Invalid segment start or end + Contribute to SponsorBlock Download Service diff --git a/app/src/main/res/xml/sponsorblock_settings.xml b/app/src/main/res/xml/sponsorblock_settings.xml index d2efe27d2..41816d153 100644 --- a/app/src/main/res/xml/sponsorblock_settings.xml +++ b/app/src/main/res/xml/sponsorblock_settings.xml @@ -17,6 +17,14 @@ app:key="sb_notifications_key" app:title="@string/sponsorblock_notifications" /> + +