add custom-double-tap-length patch

This commit is contained in:
inotia00
2023-04-30 18:23:09 +09:00
parent 4ef5714ce4
commit e46f2adf7b
6 changed files with 112 additions and 15 deletions

View File

@ -14,8 +14,8 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.options.PatchOptions
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.video.customspeed.bytecode.patch.CustomVideoSpeedBytecodePatch
import app.revanced.util.resources.ResourceHelper.addSpeedEntries
import app.revanced.util.resources.ResourceHelper.addSpeedEntryValues
import app.revanced.util.resources.ResourceHelper.addEntries
import app.revanced.util.resources.ResourceHelper.addEntryValues
import app.revanced.util.resources.ResourceUtils.copyXmlNode
@Patch
@ -45,8 +45,8 @@ class CustomVideoSpeedPatch : ResourcePatch {
if (splits.isEmpty()) throw IllegalArgumentException("Invalid speed elements")
val speedElements = splits.map { it }
for (index in 0 until splits.count()) {
context.addSpeedEntries(speedElements[index] + "x")
context.addSpeedEntryValues(speedElements[index])
context.addEntries(TARGET_ARRAY_PATH, speedElements[index] + "x", TARGET_ENTRY_VALUE_NAME)
context.addEntryValues(TARGET_ARRAY_PATH, speedElements[index], TARGET_ENTRIES_NAME)
}
/*
@ -63,4 +63,9 @@ class CustomVideoSpeedPatch : ResourcePatch {
return PatchResultSuccess()
}
private companion object {
private const val TARGET_ARRAY_PATH = "res/values/arrays.xml"
private const val TARGET_ENTRIES_NAME = "revanced_custom_video_speed_entry"
private const val TARGET_ENTRY_VALUE_NAME = "revanced_custom_video_speed_entry_value"
}
}