2023-02-19 23:54:29 +01:00
|
|
|
package app.revanced.patches.youtube.layout.hide.seekbar.patch
|
2022-09-21 02:58:39 +02:00
|
|
|
|
|
|
|
import app.revanced.patcher.annotation.Description
|
|
|
|
import app.revanced.patcher.annotation.Name
|
2022-10-05 04:03:10 +02:00
|
|
|
import app.revanced.patcher.data.BytecodeContext
|
2023-06-07 03:46:13 +02:00
|
|
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
2022-12-18 22:18:28 +01:00
|
|
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
2022-10-05 04:03:10 +02:00
|
|
|
import app.revanced.patcher.patch.BytecodePatch
|
2023-08-27 04:26:14 +02:00
|
|
|
import app.revanced.patcher.patch.PatchResult
|
|
|
|
import app.revanced.patcher.patch.PatchResultSuccess
|
2022-09-21 02:58:39 +02:00
|
|
|
import app.revanced.patcher.patch.annotations.DependsOn
|
|
|
|
import app.revanced.patcher.patch.annotations.Patch
|
2022-12-18 22:18:28 +01:00
|
|
|
import app.revanced.patches.shared.fingerprints.SeekbarFingerprint
|
|
|
|
import app.revanced.patches.shared.fingerprints.SeekbarOnDrawFingerprint
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
2023-02-19 23:54:29 +01:00
|
|
|
import app.revanced.patches.youtube.layout.hide.seekbar.annotations.HideSeekbarCompatibility
|
2023-05-11 08:22:37 +02:00
|
|
|
import app.revanced.patches.youtube.layout.seekbar.bytecode.patch.SeekbarColorBytecodePatch
|
2023-05-27 09:52:03 +02:00
|
|
|
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarPreferencesPatch
|
2022-09-21 02:58:39 +02:00
|
|
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
|
|
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
|
|
|
|
|
|
|
@Patch
|
2023-05-11 08:22:37 +02:00
|
|
|
@DependsOn([
|
|
|
|
IntegrationsPatch::class,
|
|
|
|
SettingsPatch::class,
|
2023-05-27 09:52:03 +02:00
|
|
|
// Does not alter the behavior of the seek bar by default.
|
|
|
|
SeekbarColorBytecodePatch::class,
|
|
|
|
// Used to add preferences to the seekbar settings menu.
|
|
|
|
SeekbarPreferencesPatch::class
|
2023-05-11 08:22:37 +02:00
|
|
|
])
|
2023-07-10 20:02:05 +02:00
|
|
|
@Name("Hide seekbar")
|
2023-02-19 23:54:29 +01:00
|
|
|
@Description("Hides the seekbar.")
|
|
|
|
@HideSeekbarCompatibility
|
|
|
|
class HideSeekbarPatch : BytecodePatch(
|
|
|
|
listOf(SeekbarFingerprint)
|
2022-09-21 02:58:39 +02:00
|
|
|
) {
|
2023-08-27 04:26:14 +02:00
|
|
|
override fun execute(context: BytecodeContext): PatchResult {
|
2023-05-27 09:52:03 +02:00
|
|
|
SeekbarPreferencesPatch.addPreferences(
|
2022-09-21 02:58:39 +02:00
|
|
|
SwitchPreference(
|
2023-02-19 23:54:29 +01:00
|
|
|
"revanced_hide_seekbar",
|
2023-05-27 09:52:03 +02:00
|
|
|
StringResource("revanced_hide_seekbar_title", "Hide seekbar in video player"),
|
|
|
|
StringResource("revanced_hide_seekbar_summary_on", "Video player seekbar is hidden"),
|
|
|
|
StringResource("revanced_hide_seekbar_summary_off", "Video player seekbar is shown")
|
|
|
|
),
|
|
|
|
SwitchPreference(
|
|
|
|
"revanced_hide_seekbar_thumbnail",
|
|
|
|
StringResource("revanced_hide_seekbar_thumbnail_title", "Hide seekbar in video thumbnails"),
|
|
|
|
StringResource("revanced_hide_seekbar_thumbnail_summary_on", "Thumbnail seekbar is hidden"),
|
|
|
|
StringResource("revanced_hide_seekbar_thumbnail_summary_off", "Thumbnail seekbar is shown")
|
2022-09-21 02:58:39 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-02-19 23:54:29 +01:00
|
|
|
SeekbarFingerprint.result!!.let {
|
2022-12-18 22:18:28 +01:00
|
|
|
SeekbarOnDrawFingerprint.apply { resolve(context, it.mutableClass) }
|
2023-06-07 03:46:13 +02:00
|
|
|
}.result!!.mutableMethod.addInstructionsWithLabels(
|
|
|
|
0,
|
|
|
|
"""
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-static { }, Lapp/revanced/integrations/patches/HideSeekbarPatch;->hideSeekbar()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :hide_seekbar
|
|
|
|
return-void
|
|
|
|
:hide_seekbar
|
|
|
|
nop
|
|
|
|
"""
|
2022-09-21 02:58:39 +02:00
|
|
|
)
|
2023-08-27 04:26:14 +02:00
|
|
|
|
|
|
|
return PatchResultSuccess()
|
2022-09-21 02:58:39 +02:00
|
|
|
}
|
|
|
|
}
|