mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 08:34:27 +02:00
feat(YouTube Music/Hide action bar component): add Hide Like and Dislike buttons
settings
This commit is contained in:
parent
dd2f636a4a
commit
9811ec74de
@ -10,12 +10,16 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.ActionBarComponentFingerprint
|
||||
import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerFingerprint
|
||||
import app.revanced.patches.music.utils.integrations.Constants.ACTIONBAR
|
||||
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.LikeDislikeContainer
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.music.video.information.VideoInformationPatch
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -30,13 +34,17 @@ import kotlin.math.min
|
||||
dependencies = [
|
||||
IntentHookPatch::class,
|
||||
SettingsPatch::class,
|
||||
SharedResourceIdPatch::class,
|
||||
VideoInformationPatch::class
|
||||
],
|
||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ActionBarComponentPatch : BytecodePatch(
|
||||
setOf(ActionBarComponentFingerprint)
|
||||
setOf(
|
||||
ActionBarComponentFingerprint,
|
||||
LikeDislikeContainerFingerprint
|
||||
)
|
||||
) {
|
||||
private var spannedReference = ""
|
||||
|
||||
@ -124,6 +132,18 @@ object ActionBarComponentPatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw ActionBarComponentFingerprint.exception
|
||||
|
||||
LikeDislikeContainerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralInstructionIndex(LikeDislikeContainer) + 2
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
insertIndex + 1,
|
||||
"invoke-static {v$insertRegister}, $ACTIONBAR->hideLikeDislikeButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw LikeDislikeContainerFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_button_add_to_playlist",
|
||||
@ -144,6 +164,11 @@ object ActionBarComponentPatch : BytecodePatch(
|
||||
"revanced_hide_action_button_label",
|
||||
"false"
|
||||
)
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_button_like_dislike",
|
||||
"false"
|
||||
)
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.ACTION_BAR,
|
||||
"revanced_hide_action_button_radio",
|
||||
|
@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.music.actionbar.component.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.LikeDislikeContainer
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
object LikeDislikeContainerFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
literalSupplier = { LikeDislikeContainer }
|
||||
)
|
@ -27,6 +27,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var InlineTimeBarAdBreakMarkerColor: Long = -1
|
||||
var InterstitialsContainer: Long = -1
|
||||
var IsTablet: Long = -1
|
||||
var LikeDislikeContainer: Long = -1
|
||||
var MenuEntry: Long = -1
|
||||
var MusicMenuLikeButtons: Long = -1
|
||||
var MusicNotifierShelf: Long = -1
|
||||
@ -58,6 +59,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
InlineTimeBarAdBreakMarkerColor = find(COLOR, "inline_time_bar_ad_break_marker_color")
|
||||
InterstitialsContainer = find(ID, "interstitials_container")
|
||||
IsTablet = find(BOOL, "is_tablet")
|
||||
LikeDislikeContainer = find(ID, "like_dislike_container")
|
||||
MenuEntry = find(LAYOUT, "menu_entry")
|
||||
MusicMenuLikeButtons = find(LAYOUT, "music_menu_like_buttons")
|
||||
MusicNotifierShelf = find(LAYOUT, "music_notifier_shelf")
|
||||
|
@ -101,6 +101,8 @@ WARNING: Do not enable "New player background" while this is enabled."</string>
|
||||
<string name="revanced_hide_action_button_download_title">Hide download button</string>
|
||||
<string name="revanced_hide_action_button_label_summary">Hides labels in action buttons.</string>
|
||||
<string name="revanced_hide_action_button_label_title">Hide action button labels</string>
|
||||
<string name="revanced_hide_action_button_like_dislike_summary">Hides the like and dislike buttons. It does not work in the old player layout.</string>
|
||||
<string name="revanced_hide_action_button_like_dislike_title">Hide like and dislike buttons</string>
|
||||
<string name="revanced_hide_action_button_radio_summary">Hides start radio button.</string>
|
||||
<string name="revanced_hide_action_button_radio_title">Hide radio button</string>
|
||||
<string name="revanced_hide_action_button_share_summary">Hides share button.</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user