chore: lint code

This commit is contained in:
inotia00 2024-06-27 23:31:31 +09:00
parent 32ceb7fd8a
commit 8b1f2e8aaf
3 changed files with 2 additions and 40 deletions

View File

@ -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<String>,
replacements: Array<String>
) {
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"
}
}
}
}
}
}
}
}

View File

@ -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),

View File

@ -833,7 +833,7 @@ Limitation: Video title disappears when clicked."</string>
<string name="revanced_hide_player_fullscreen_button_title">Hide Fullscreen button</string>
<string name="revanced_hide_player_fullscreen_button_summary_on">Fullscreen button is hidden.</string>
<string name="revanced_hide_player_fullscreen_button_summary_off">Fullscreen button is shown.</string>
<string name="revanced_hide_player_previous_next_button_title">Hide previous &amp; next buttons</string>
<string name="revanced_hide_player_previous_next_button_title">Hide Previous &amp; Next buttons</string>
<string name="revanced_hide_player_previous_next_button_summary_on">Buttons are hidden.</string>
<string name="revanced_hide_player_previous_next_button_summary_off">Buttons are shown.</string>
<string name="revanced_hide_player_youtube_music_button_title">Hide YouTube Music button</string>