diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt index 4daa6248f..2f624435b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt @@ -22,6 +22,8 @@ import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.reques import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnResponseStartedFingerprint import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnSucceededFingerprint import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch +import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch +import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch import app.revanced.patches.youtube.misc.settings.SettingsPatch import app.revanced.util.resultOrThrow import com.android.tools.smali.dexlib2.AccessFlags @@ -38,6 +40,8 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod IntegrationsPatch::class, SettingsPatch::class, AddResourcesPatch::class, + NavigationBarHookPatch::class, + PlayerTypeHookPatch::class ], compatiblePackages = [ CompatiblePackage( @@ -127,25 +131,45 @@ object AlternativeThumbnailsPatch : BytecodePatch( override fun execute(context: BytecodeContext) { AddResourcesPatch(this::class) + val entries = "revanced_alt_thumbnail_options_entries" + val values = "revanced_alt_thumbnail_options_entry_values" SettingsPatch.PreferenceScreen.ALTERNATIVE_THUMBNAILS.addPreferences( - NonInteractivePreference( - "revanced_alt_thumbnail_about", - null, // Summary is dynamically updated based on the current settings. - tag = "app.revanced.integrations.youtube.settings.preference.AlternativeThumbnailsStatusPreference", + ListPreference("revanced_alt_thumbnail_home", + summaryKey = null, + entriesKey = entries, + entryValuesKey = values + ), + ListPreference("revanced_alt_thumbnail_subscription", + summaryKey = null, + entriesKey = entries, + entryValuesKey = values + ), + ListPreference("revanced_alt_thumbnail_library", + summaryKey = null, + entriesKey = entries, + entryValuesKey = values + ), + ListPreference("revanced_alt_thumbnail_player", + summaryKey = null, + entriesKey = entries, + entryValuesKey = values + ), + ListPreference("revanced_alt_thumbnail_search", + summaryKey = null, + entriesKey = entries, + entryValuesKey = values ), - SwitchPreference("revanced_alt_thumbnail_dearrow"), - SwitchPreference("revanced_alt_thumbnail_dearrow_connection_toast"), - TextPreference("revanced_alt_thumbnail_dearrow_api_url"), NonInteractivePreference( "revanced_alt_thumbnail_dearrow_about", // Custom about preference with link to the DeArrow website. tag = "app.revanced.integrations.youtube.settings.preference.AlternativeThumbnailsAboutDeArrowPreference", selectable = true, ), - SwitchPreference("revanced_alt_thumbnail_stills"), - ListPreference("revanced_alt_thumbnail_stills_time", summaryKey = null), - SwitchPreference("revanced_alt_thumbnail_stills_fast"), + SwitchPreference("revanced_alt_thumbnail_dearrow_connection_toast"), + TextPreference("revanced_alt_thumbnail_dearrow_api_url"), NonInteractivePreference("revanced_alt_thumbnail_stills_about"), + SwitchPreference("revanced_alt_thumbnail_stills_fast"), + ListPreference("revanced_alt_thumbnail_stills_time", summaryKey = null) ) fun MethodFingerprint.alsoResolve(fingerprint: MethodFingerprint) = diff --git a/src/main/resources/addresources/values/arrays.xml b/src/main/resources/addresources/values/arrays.xml index 064dcd05b..5fad2d884 100644 --- a/src/main/resources/addresources/values/arrays.xml +++ b/src/main/resources/addresources/values/arrays.xml @@ -44,15 +44,28 @@ + + @string/revanced_alt_thumbnail_options_entry_1 + @string/revanced_alt_thumbnail_options_entry_2 + @string/revanced_alt_thumbnail_options_entry_3 + @string/revanced_alt_thumbnail_options_entry_4 + + + + ORIGINAL + DEARROW + DEARROW_STILL_IMAGES + STILL_IMAGES + @string/revanced_alt_thumbnail_stills_time_entry_1 @string/revanced_alt_thumbnail_stills_time_entry_2 @string/revanced_alt_thumbnail_stills_time_entry_3 - 1 - 2 - 3 + BEGINNING + MIDDLE + END diff --git a/src/main/resources/addresources/values/strings.xml b/src/main/resources/addresources/values/strings.xml index b799eef24..2797468bc 100644 --- a/src/main/resources/addresources/values/strings.xml +++ b/src/main/resources/addresources/values/strings.xml @@ -847,33 +847,31 @@ Invalid seekbar color value. Using default value. - Thumbnails in use - Enable DeArrow thumbnails - Using DeArrow thumbnails - Not using DeArrow thumbnails + Home tab + Subscription tab + \'You\' tab + Player playlists, recommendations + Search results + Original thumbnails + DeArrow & Original thumbnails + DeArrow & Still captures + Still captures + DeArrow + DeArrow provides crowd-sourced thumbnails for YouTube videos. These thumbnails are often more relevant than those provided by YouTube\n\nIf enabled, video URLs will be sent to the API server and no other data is sent. If a video does not have DeArrow thumbnails, then the original or still captures are shown\n\nTap here to learn more about DeArrow Show a toast if API is not available Toast is shown if DeArrow is not available Toast is not shown if DeArrow is not available DeArrow API endpoint - The URL of the DeArrow thumbnail cache endpoint. Do not change this unless you know what you\'re doing - About DeArrow - DeArrow provides crowd-sourced thumbnails for YouTube videos. These thumbnails are often more relevant than those provided by YouTube. If enabled, video URLs will be sent to the API server and no other data is sent\n\nTap here to learn more about DeArrow - Enable still video captures - Using YouTube still video captures - Not using YouTube still video captures - Video time to take the still from - Beginning of video - Middle of video - End of video + The URL of the DeArrow thumbnail cache endpoint + Still video captures + Still captures are taken from the beginning/middle/end of each video. These images are built into YouTube and no external API is used Use fast still captures Using medium quality still captures. Thumbnails will load faster, but live streams, unreleased, or very old videos may show blank thumbnails Using high quality still captures - About still video captures - Still captures are taken from the beginning/middle/end of each video. These images are built into YouTube and no external API is used - Showing original YouTube thumbnails - Showing still video captures - Showing DeArrow thumbnails. If a video has no DeArrow thumbnails then the original YouTube thumbnails are shown - Showing DeArrow thumbnails. If a video has no DeArrow thumbnails then still video captures are shown + Video time to take still captures from + Beginning of video + Middle of video + End of video DeArrow temporarily not available (status code: %s) DeArrow temporarily not available