mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-29 13:20:19 +02:00
refactor(wide-searchbar): add some left margin
This commit is contained in:
parent
18e1eedd34
commit
5ffed2d934
@ -16,6 +16,7 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints.*
|
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints.*
|
||||||
|
import app.revanced.patches.youtube.layout.general.widesearchbar.resource.patch.WideSearchbarResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.util.integrations.Constants.GENERAL
|
import app.revanced.util.integrations.Constants.GENERAL
|
||||||
|
|
||||||
@ -24,7 +25,8 @@ import app.revanced.util.integrations.Constants.GENERAL
|
|||||||
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
|
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
SettingsPatch::class
|
SettingsPatch::class,
|
||||||
|
WideSearchbarResourcePatch::class
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.general.widesearchbar.resource.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
|
||||||
|
@Name("enable-wide-searchbar-resource-patch")
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class WideSearchbarResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
context.xmlEditor["res/layout/action_bar_ringo_background.xml"].use { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
with(document.getElementsByTagName("RelativeLayout").item(0)) {
|
||||||
|
if (attributes.getNamedItem(FLAG) != null) return@with
|
||||||
|
|
||||||
|
document.createAttribute(FLAG)
|
||||||
|
.apply { value = "8.0dip" }
|
||||||
|
.let(attributes::setNamedItem)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val FLAG = "android:paddingStart"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user