mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-24 19:21:03 +00:00
Compare commits
2 Commits
v2.188.0-d
...
v2.188.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69092def55 | ||
|
|
004aae8258 |
@@ -1,3 +1,10 @@
|
|||||||
|
# [2.188.0-dev.25](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.24...v2.188.0-dev.25) (2023-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **YouTube:** Add `Custom player overlay opacity` patch ([#2721](https://github.com/ReVanced/revanced-patches/issues/2721)) ([2622b00](https://github.com/ReVanced/revanced-patches/commit/2622b008ab78b15aa3c28a13b38e63041f29c9ea))
|
||||||
|
|
||||||
# [2.188.0-dev.24](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.23...v2.188.0-dev.24) (2023-08-25)
|
# [2.188.0-dev.24](https://github.com/ReVanced/revanced-patches/compare/v2.188.0-dev.23...v2.188.0-dev.24) (2023-08-25)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.188.0-dev.24
|
version = 2.188.0-dev.25
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.annotations
|
package app.revanced.patches.youtube.layout.player.overlay.annotations
|
||||||
|
|
||||||
import app.revanced.patcher.annotation.Compatibility
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
import app.revanced.patcher.annotation.Package
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
@Compatibility([Package("com.google.android.youtube")])
|
@Compatibility([Package("com.google.android.youtube")])
|
||||||
@Target(AnnotationTarget.CLASS)
|
@Target(AnnotationTarget.CLASS)
|
||||||
internal annotation class HidePlayerOverlayPatchCompatibility
|
internal annotation class PlayerOverlayPatchCompatibility
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints
|
package app.revanced.patches.youtube.layout.player.overlay.bytecode.fingerprints
|
||||||
|
|
||||||
import app.revanced.extensions.containsConstantInstructionValue
|
import app.revanced.extensions.containsConstantInstructionValue
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
import app.revanced.patches.youtube.layout.player.overlay.resource.patch.CustomPlayerOverlayOpacityResourcePatch
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
@@ -17,6 +17,6 @@ object CreatePlayerOverviewFingerprint : MethodFingerprint(
|
|||||||
Opcode.CHECK_CAST
|
Opcode.CHECK_CAST
|
||||||
),
|
),
|
||||||
customFingerprint = { methodDef, _ ->
|
customFingerprint = { methodDef, _ ->
|
||||||
methodDef.containsConstantInstructionValue(HidePlayerOverlayResourcePatch.scrimOverlayId)
|
methodDef.containsConstantInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.patch
|
package app.revanced.patches.youtube.layout.player.overlay.bytecode.patch
|
||||||
|
|
||||||
import app.revanced.extensions.indexOfFirstConstantInstructionValue
|
import app.revanced.extensions.indexOfFirstConstantInstructionValue
|
||||||
import app.revanced.extensions.exception
|
import app.revanced.extensions.exception
|
||||||
@@ -10,35 +10,36 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
import app.revanced.patches.youtube.layout.player.overlay.annotations.PlayerOverlayPatchCompatibility
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.bytecode.fingerprints.CreatePlayerOverviewFingerprint
|
import app.revanced.patches.youtube.layout.player.overlay.bytecode.fingerprints.CreatePlayerOverviewFingerprint
|
||||||
import app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch.HidePlayerOverlayResourcePatch
|
import app.revanced.patches.youtube.layout.player.overlay.resource.patch.CustomPlayerOverlayOpacityResourcePatch
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("Hide player overlay")
|
@Name("Custom player overlay opacity")
|
||||||
@Description("Hides the dark background overlay from the player when player controls are visible.")
|
@Description("Change the opacity of the player background, when player controls are visible.")
|
||||||
@DependsOn([HidePlayerOverlayResourcePatch::class])
|
@DependsOn([CustomPlayerOverlayOpacityResourcePatch::class])
|
||||||
@HidePlayerOverlayPatchCompatibility
|
@PlayerOverlayPatchCompatibility
|
||||||
class HidePlayerOverlayPatch : BytecodePatch(listOf(CreatePlayerOverviewFingerprint)) {
|
class CustomPlayerOverlayOpacityPatch : BytecodePatch(listOf(CreatePlayerOverviewFingerprint)) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
CreatePlayerOverviewFingerprint.result?.let { result ->
|
CreatePlayerOverviewFingerprint.result?.let { result ->
|
||||||
result.mutableMethod.apply {
|
result.mutableMethod.apply {
|
||||||
val viewRegisterIndex =
|
val viewRegisterIndex =
|
||||||
indexOfFirstConstantInstructionValue(HidePlayerOverlayResourcePatch.scrimOverlayId) + 3
|
indexOfFirstConstantInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId) + 3
|
||||||
val viewRegister = getInstruction<OneRegisterInstruction>(viewRegisterIndex).registerA
|
val viewRegister =
|
||||||
|
getInstruction<OneRegisterInstruction>(viewRegisterIndex).registerA
|
||||||
|
|
||||||
val insertIndex = viewRegisterIndex + 1
|
val insertIndex = viewRegisterIndex + 1
|
||||||
addInstruction(
|
addInstruction(
|
||||||
insertIndex,
|
insertIndex,
|
||||||
"invoke-static { v$viewRegister }, " +
|
"invoke-static { v$viewRegister }, " +
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hidePlayerOverlay(Landroid/widget/ImageView;)V"
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->changeOpacity(Landroid/widget/ImageView;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} ?: throw CreatePlayerOverviewFingerprint.exception
|
} ?: throw CreatePlayerOverviewFingerprint.exception
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/HidePlayerOverlayPatch;"
|
const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/CustomPlayerOverlayOpacityPatch;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,29 @@
|
|||||||
package app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch
|
package app.revanced.patches.youtube.layout.player.overlay.resource.patch
|
||||||
|
|
||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotations.DependsOn
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.InputType
|
||||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
import app.revanced.patches.shared.settings.preference.impl.TextPreference
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
class HidePlayerOverlayResourcePatch : ResourcePatch {
|
class CustomPlayerOverlayOpacityResourcePatch : ResourcePatch {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
SwitchPreference(
|
TextPreference(
|
||||||
"revanced_hide_player_overlay",
|
"revanced_player_overlay_opacity",
|
||||||
StringResource("revanced_hide_player_overlay_title", "Hide background overlay in player"),
|
StringResource(
|
||||||
StringResource("revanced_hide_player_overlay_summary_on", "Background overlay is hidden"),
|
"revanced_player_overlay_opacity_title",
|
||||||
StringResource("revanced_hide_player_overlay_summary_off", "Background overlay is shown")
|
"Player overlay opacity"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_player_overlay_opacity_summary",
|
||||||
|
"Opacity value between 0-100, where 0 is transparent"
|
||||||
|
),
|
||||||
|
InputType.NUMBER
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,6 +33,6 @@ class HidePlayerOverlayResourcePatch : ResourcePatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal companion object {
|
internal companion object {
|
||||||
var scrimOverlayId: Long = -1
|
var scrimOverlayId = -1L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user