mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 15:14:34 +02:00
feat(youtube/append-time-stamps-information): change patch name enable-time-stamps-speed
→ append-time-stamps-information
This commit is contained in:
parent
68b34f0f37
commit
09a94b88b7
@ -1,9 +1,10 @@
|
||||
package app.revanced.patches.youtube.seekbar.speed.patch
|
||||
package app.revanced.patches.youtube.seekbar.append.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
@ -12,6 +13,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.fingerprints.TotalTimeFingerprint
|
||||
import app.revanced.patches.youtube.utils.overridequality.patch.OverrideQualityHookPatch
|
||||
import app.revanced.patches.youtube.utils.overridespeed.patch.OverrideSpeedHookPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@ -21,43 +23,49 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
|
||||
@Patch
|
||||
@Name("Enable time stamps speed")
|
||||
@Description("Add the current playback speed in brackets next to the current time.")
|
||||
@Name("Append time stamps information")
|
||||
@Description("Add the current video quality or playback speed in brackets next to the current time.")
|
||||
@DependsOn(
|
||||
[
|
||||
OverrideQualityHookPatch::class,
|
||||
OverrideSpeedHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
class AppendSpeedPatch : BytecodePatch(
|
||||
class AppendTimeStampInformationPatch : BytecodePatch(
|
||||
listOf(TotalTimeFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
TotalTimeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
var insertIndex = -1
|
||||
var setTextIndex = -1
|
||||
|
||||
for ((targetIndex, targetInstruction) in implementation!!.instructions.withIndex()) {
|
||||
if (targetInstruction.opcode != Opcode.INVOKE_VIRTUAL) continue
|
||||
for ((textViewIndex, textViewInstruction) in implementation!!.instructions.withIndex()) {
|
||||
if (textViewInstruction.opcode != Opcode.INVOKE_VIRTUAL) continue
|
||||
|
||||
if (getInstruction<ReferenceInstruction>(targetIndex).reference.toString() ==
|
||||
if (getInstruction<ReferenceInstruction>(textViewIndex).reference.toString() ==
|
||||
"Landroid/widget/TextView;->getText()Ljava/lang/CharSequence;"
|
||||
) {
|
||||
insertIndex = targetIndex + 2
|
||||
val insertRegister = getInstruction<Instruction35c>(insertIndex).registerC
|
||||
setTextIndex = textViewIndex + 2
|
||||
val setTextRegister = getInstruction<Instruction35c>(setTextIndex).registerC
|
||||
val textViewRegister = getInstruction<Instruction35c>(textViewIndex).registerC
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $SEEKBAR->enableTimeStampSpeed(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$insertRegister
|
||||
setTextIndex, """
|
||||
invoke-static {v$setTextRegister}, $SEEKBAR->appendTimeStampInformation(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$setTextRegister
|
||||
"""
|
||||
)
|
||||
addInstruction(
|
||||
textViewIndex,
|
||||
"invoke-static {v$textViewRegister}, $SEEKBAR->setContainerClickListener(Landroid/view/View;)V"
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
if (insertIndex == -1)
|
||||
if (setTextIndex == -1)
|
||||
throw PatchException("target Instruction not found!")
|
||||
}
|
||||
} ?: throw TotalTimeFingerprint.exception
|
||||
@ -68,11 +76,11 @@ class AppendSpeedPatch : BytecodePatch(
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: SEEKBAR_SETTINGS",
|
||||
"SETTINGS: ENABLE_TIME_STAMP_SPEED"
|
||||
"SETTINGS: APPEND_TIME_STAMP_INFORMATION"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-timestamps-speed")
|
||||
SettingsPatch.updatePatchStatus("append-timestamps-information")
|
||||
|
||||
}
|
||||
}
|
@ -6,6 +6,12 @@
|
||||
<string name="microg_settings_summary">Enable cloud messaging settings to receive notifications</string>
|
||||
<string name="microg_settings_title">Open MicroG</string>
|
||||
<string name="revanced_ads">Ads</string>
|
||||
<string name="revanced_append_time_stamp_information_summary_off">Append time stamp information is disabled</string>
|
||||
<string name="revanced_append_time_stamp_information_summary_on">Append time stamp information is enabled</string>
|
||||
<string name="revanced_append_time_stamp_information_title">Append time stamp information</string>
|
||||
<string name="revanced_append_time_stamp_information_type_summary_off">Append playback speed</string>
|
||||
<string name="revanced_append_time_stamp_information_type_summary_on">Append video quality</string>
|
||||
<string name="revanced_append_time_stamp_information_type_title">Append information type</string>
|
||||
<string name="revanced_backup_summary">Import ReVanced settings from file or export ReVanced settings to file</string>
|
||||
<string name="revanced_bottom_player">Bottom player</string>
|
||||
<string name="revanced_button_container_title">Button container</string>
|
||||
@ -137,9 +143,6 @@
|
||||
<string name="revanced_enable_tablet_navigation_bar_summary_off">Tablet navigation bar is disabled</string>
|
||||
<string name="revanced_enable_tablet_navigation_bar_summary_on">Tablet navigation bar is enabled</string>
|
||||
<string name="revanced_enable_tablet_navigation_bar_title">Enable tablet navigation bar</string>
|
||||
<string name="revanced_enable_time_stamp_speed_summary_off">Append time stamp speed is disabled</string>
|
||||
<string name="revanced_enable_time_stamp_speed_summary_on">Append time stamp speed is enabled</string>
|
||||
<string name="revanced_enable_time_stamp_speed_title">Enable time stamp speed</string>
|
||||
<string name="revanced_enable_vp9_codec_summary">Spoof device information to enable vp9 codec</string>
|
||||
<string name="revanced_enable_vp9_codec_title">Enable vp9 codec</string>
|
||||
<string name="revanced_enable_wide_search_bar_summary_off">Wide search bar is disabled</string>
|
||||
|
@ -368,10 +368,10 @@
|
||||
<Preference android:title="hide-suggested-actions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_seekbar" />
|
||||
<Preference android:title="append-timestamps-information" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="custom-seekbar-color" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-new-thumbnail-preview" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-seekbar-tapping" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="enable-timestamps-speed" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="hide-seekbar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="hide-time-stamp" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
@ -398,7 +398,6 @@
|
||||
<Preference android:title="labels" android:summary="@string/revanced_labels_default" android:selectable="false"/>
|
||||
<Preference android:title="language-switch" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="microg-support" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="optimize-resource" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="return-youtube-dislike" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="sponsorblock" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="themes" android:summary="@string/revanced_themes_default" android:selectable="false"/>
|
||||
@ -523,6 +522,10 @@
|
||||
<PreferenceScreen android:title="@string/revanced_seekbar" android:key="seekbar">
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_seekbar" />PREFERENCE: SEEKBAR_SETTINGS -->
|
||||
|
||||
<!-- SETTINGS: APPEND_TIME_STAMP_INFORMATION
|
||||
<SwitchPreference android:title="@string/revanced_append_time_stamp_information_title" android:key="revanced_append_time_stamp_information" android:defaultValue="true" android:summaryOn="@string/revanced_append_time_stamp_information_summary_on" android:summaryOff="@string/revanced_append_time_stamp_information_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_append_time_stamp_information_type_title" android:key="revanced_append_time_stamp_information_type" android:defaultValue="true" android:summaryOn="@string/revanced_append_time_stamp_information_type_summary_on" android:summaryOff="@string/revanced_append_time_stamp_information_type_summary_off" android:dependency="revanced_append_time_stamp_information" />SETTINGS: APPEND_TIME_STAMP_INFORMATION -->
|
||||
|
||||
<!-- SETTINGS: CUSTOM_SEEKBAR_COLOR
|
||||
<SwitchPreference android:title="@string/revanced_enable_custom_seekbar_color_title" android:key="revanced_enable_custom_seekbar_color" android:defaultValue="true" android:summaryOn="@string/revanced_enable_custom_seekbar_color_summary_on" android:summaryOff="@string/revanced_enable_custom_seekbar_color_summary_off" />
|
||||
<app.revanced.integrations.settingsmenu.ResettableEditTextPreference android:title="@string/revanced_custom_seekbar_color_value_title" android:key="revanced_custom_seekbar_color_value" android:summary="@string/revanced_custom_seekbar_color_value_summary" android:defaultValue="#ff0000" android:hint="#ff0000" android:inputType="text" />SETTINGS: CUSTOM_SEEKBAR_COLOR -->
|
||||
@ -533,9 +536,6 @@
|
||||
<!-- SETTINGS: ENABLE_SEEKBAR_TAPPING
|
||||
<SwitchPreference android:title="@string/revanced_enable_seekbar_tapping_title" android:key="revanced_enable_seekbar_tapping" android:defaultValue="true" android:summaryOn="@string/revanced_enable_seekbar_tapping_summary_on" android:summaryOff="@string/revanced_enable_seekbar_tapping_summary_off" />SETTINGS: ENABLE_SEEKBAR_TAPPING -->
|
||||
|
||||
<!-- SETTINGS: ENABLE_TIME_STAMP_SPEED
|
||||
<SwitchPreference android:title="@string/revanced_enable_time_stamp_speed_title" android:key="revanced_enable_time_stamp_speed" android:defaultValue="true" android:summaryOn="@string/revanced_enable_time_stamp_speed_summary_on" android:summaryOff="@string/revanced_enable_time_stamp_speed_summary_off" />SETTINGS: ENABLE_TIME_STAMP_SPEED -->
|
||||
|
||||
<!-- SETTINGS: HIDE_SEEKBAR
|
||||
<SwitchPreference android:title="@string/revanced_hide_seekbar_title" android:key="revanced_hide_seekbar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_seekbar_summary_on" android:summaryOff="@string/revanced_hide_seekbar_summary_off" />SETTINGS: HIDE_SEEKBAR -->
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user