From 8b1f2e8aafd79b58d74b5d9d71cf5b2e2a32b706 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Thu, 27 Jun 2024 23:31:31 +0900 Subject: [PATCH] chore: lint code --- .../shared/voicesearch/VoiceSearchUtils.kt | 38 ------------------- .../PlayerButtonBackgroundPatch.kt | 2 +- .../youtube/settings/host/values/strings.xml | 2 +- 3 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/shared/voicesearch/VoiceSearchUtils.kt diff --git a/src/main/kotlin/app/revanced/patches/shared/voicesearch/VoiceSearchUtils.kt b/src/main/kotlin/app/revanced/patches/shared/voicesearch/VoiceSearchUtils.kt deleted file mode 100644 index 4f8a3557a..000000000 --- a/src/main/kotlin/app/revanced/patches/shared/voicesearch/VoiceSearchUtils.kt +++ /dev/null @@ -1,38 +0,0 @@ -package app.revanced.patches.shared.voicesearch - -import app.revanced.patcher.data.ResourceContext -import org.w3c.dom.Element - -@Suppress("DEPRECATION") -object VoiceSearchUtils { - private const val IMAGE_VIEW_TAG = "android.support.v7.widget.AppCompatImageView" - private const val VOICE_SEARCH_ID = "@id/voice_search" - - internal fun ResourceContext.patchXml( - paths: Array, - replacements: Array - ) { - val resDirectory = this["res"] - - paths.forEach { path -> - val targetXmlPath = resDirectory.resolve("layout").resolve(path) - - if (targetXmlPath.exists()) { - this.xmlEditor["res/layout/$path"].use { editor -> - val document = editor.file - val imageViewTags = document.getElementsByTagName(IMAGE_VIEW_TAG) - List(imageViewTags.length) { imageViewTags.item(it) as Element } - .filter { it.getAttribute("android:id").equals(VOICE_SEARCH_ID) } - .forEach { node -> - replacements.forEach replacement@{ replacement -> - node.getAttributeNode("android:layout_$replacement") - ?.let { attribute -> - attribute.textContent = "0.0dip" - } - } - } - } - } - } - } -} diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbg/PlayerButtonBackgroundPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbg/PlayerButtonBackgroundPatch.kt index fd709d91a..6732d8be8 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbg/PlayerButtonBackgroundPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/playerbuttonbg/PlayerButtonBackgroundPatch.kt @@ -8,7 +8,7 @@ import app.revanced.util.patch.BaseResourcePatch import org.w3c.dom.Element @Suppress("Deprecation", "unused") -object ForcePlayerButtonBackgroundPatch : BaseResourcePatch( +object PlayerButtonBackgroundPatch : BaseResourcePatch( name = "Force hide player buttons background", description = "Removes, at compile time, the dark background surrounding the video player controls.", dependencies = setOf(SettingsPatch::class), diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml index 8c654621d..94f6ece3e 100644 --- a/src/main/resources/youtube/settings/host/values/strings.xml +++ b/src/main/resources/youtube/settings/host/values/strings.xml @@ -833,7 +833,7 @@ Limitation: Video title disappears when clicked." Hide Fullscreen button Fullscreen button is hidden. Fullscreen button is shown. - Hide previous & next buttons + Hide Previous & Next buttons Buttons are hidden. Buttons are shown. Hide YouTube Music button