mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
add hide-time-stamp
patch
This commit is contained in:
@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.timestamps.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
object TimeStampsContainerFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
it.opcode.ordinal == Opcode.CONST.ordinal &&
|
||||||
|
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.timeStampsContainerLabelId
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,66 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.seekbar.timestamps.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.seekbar.timestamps.fingerprints.TimeStampsContainerFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.SEEKBAR_LAYOUT
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-time-stamp")
|
||||||
|
@Description("Hides the time counter above the seekbar.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
SettingsPatch::class,
|
||||||
|
SharedResourcdIdPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideTimeStampPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
TimeStampsContainerFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
||||||
|
TimeStampsContainerFingerprint.result?.mutableMethod?.let {
|
||||||
|
it.addInstructions(
|
||||||
|
0, """
|
||||||
|
invoke-static {}, $SEEKBAR_LAYOUT->hideTimeStamp()Z
|
||||||
|
move-result v0
|
||||||
|
if-eqz v0, :show_time_stamp
|
||||||
|
return-void
|
||||||
|
""", listOf(ExternalLabel("show_time_stamp", it.instruction(0)))
|
||||||
|
)
|
||||||
|
} ?: return TimeStampsContainerFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"PREFERENCE: OTHER_LAYOUT_SETTINGS",
|
||||||
|
"PREFERENCE_HEADER: SEEKBAR",
|
||||||
|
"SETTINGS: HIDE_TIME_STAMP"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("hide-time-stamp")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -287,6 +287,8 @@
|
|||||||
<!-- SETTINGS: HIDE_SEEKBAR
|
<!-- 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 -->
|
<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 -->
|
||||||
|
|
||||||
|
<!-- SETTINGS: HIDE_TIME_STAMP
|
||||||
|
<SwitchPreference android:title="@string/revanced_hide_time_stamp_title" android:key="revanced_hide_time_stamp" android:defaultValue="false" android:summaryOn="@string/revanced_hide_time_stamp_summary_on" android:summaryOff="@string/revanced_hide_time_stamp_summary_off" />SETTINGS: HIDE_TIME_STAMP -->
|
||||||
|
|
||||||
<!-- PREFERENCE: OTHER_LAYOUT_SETTINGS
|
<!-- PREFERENCE: OTHER_LAYOUT_SETTINGS
|
||||||
</PreferenceScreen>PREFERENCE: OTHER_LAYOUT_SETTINGS -->
|
</PreferenceScreen>PREFERENCE: OTHER_LAYOUT_SETTINGS -->
|
||||||
@ -422,6 +424,7 @@
|
|||||||
<Preference android:title="custom-seekbar-color" 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-seekbar-tapping" 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="hide-seekbar" 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"/>
|
||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_overlay_button_title" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_overlay_button_title" />
|
||||||
<Preference android:title="overlay-buttons" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="overlay-buttons" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Reference in New Issue
Block a user