mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-28 13:11:03 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cba04cf5a6 | ||
|
|
5e358c7319 | ||
|
|
ce69471684 | ||
|
|
a0981dda9d | ||
|
|
6073181ee1 | ||
|
|
522587321c | ||
|
|
b16748794e | ||
|
|
01e9a396d6 | ||
|
|
86fcd4d475 | ||
|
|
8bbc744114 | ||
|
|
d7a4ad76ea | ||
|
|
7e6ee73908 | ||
|
|
87954a1aaf | ||
|
|
e5a2ed0f70 | ||
|
|
2295aaebf4 | ||
|
|
a72bf150c2 | ||
|
|
0290cd3d36 | ||
|
|
e8d61e0c0e | ||
|
|
19769d80eb | ||
|
|
12c16d4644 | ||
|
|
75f4653c16 | ||
|
|
3286d26996 | ||
|
|
edbc36e90f | ||
|
|
7ad2be7f27 | ||
|
|
1702322671 |
1
.idea/.gitignore
generated
vendored
1
.idea/.gitignore
generated
vendored
@@ -6,3 +6,4 @@
|
|||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
# Editor-based HTTP Client requests
|
# Editor-based HTTP Client requests
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
|
/kotlinc.xml
|
||||||
|
|||||||
38
CHANGELOG.md
38
CHANGELOG.md
@@ -1,3 +1,41 @@
|
|||||||
|
## [2.51.2](https://github.com/revanced/revanced-patches/compare/v2.51.1...v2.51.2) (2022-09-08)
|
||||||
|
|
||||||
|
## [2.51.1](https://github.com/revanced/revanced-patches/compare/v2.51.0...v2.51.1) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* wrap theme option ([150c173](https://github.com/revanced/revanced-patches/commit/150c173adce31d9984d6feca694b472649233056))
|
||||||
|
|
||||||
|
# [2.51.0](https://github.com/revanced/revanced-patches/compare/v2.50.8...v2.51.0) (2022-09-08)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Theme Patch ([#440](https://github.com/revanced/revanced-patches/issues/440)) ([f3b92ca](https://github.com/revanced/revanced-patches/commit/f3b92cab5a057ce605b6d9e75e3b99161bf1422c))
|
||||||
|
|
||||||
|
## [2.50.8](https://github.com/revanced/revanced-patches/compare/v2.50.7...v2.50.8) (2022-09-08)
|
||||||
|
|
||||||
|
## [2.50.7](https://github.com/revanced/revanced-patches/compare/v2.50.6...v2.50.7) (2022-09-08)
|
||||||
|
|
||||||
|
## [2.50.6](https://github.com/revanced/revanced-patches/compare/v2.50.5...v2.50.6) (2022-09-07)
|
||||||
|
|
||||||
|
## [2.50.5](https://github.com/revanced/revanced-patches/compare/v2.50.4...v2.50.5) (2022-09-07)
|
||||||
|
|
||||||
|
## [2.50.4](https://github.com/revanced/revanced-patches/compare/v2.50.3...v2.50.4) (2022-09-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't respect primary color for the download button icon ([#424](https://github.com/revanced/revanced-patches/issues/424)) ([3fa70f4](https://github.com/revanced/revanced-patches/commit/3fa70f48a206c56f6ca8aed88baed722e76281e2))
|
||||||
|
|
||||||
|
## [2.50.3](https://github.com/revanced/revanced-patches/compare/v2.50.2...v2.50.3) (2022-09-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* partial ad blockage in `tiktok-ads` patch ([#420](https://github.com/revanced/revanced-patches/issues/420)) ([bc6d192](https://github.com/revanced/revanced-patches/commit/bc6d19205940e3b4b228a9b5de627a2260abd00e))
|
||||||
|
|
||||||
## [2.50.2](https://github.com/revanced/revanced-patches/compare/v2.50.1...v2.50.2) (2022-08-31)
|
## [2.50.2](https://github.com/revanced/revanced-patches/compare/v2.50.1...v2.50.2) (2022-08-31)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.33.42 |
|
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.33.42 |
|
||||||
| `old-quality-layout` | Enables the original quality flyout menu. | 17.33.42 |
|
| `old-quality-layout` | Enables the original quality flyout menu. | 17.33.42 |
|
||||||
|
| `theme` | Enables a custom theme. | all |
|
||||||
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.33.42 |
|
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.33.42 |
|
||||||
| `hide-watermark` | Hides creator's watermarks on videos. | 17.33.42 |
|
| `hide-watermark` | Hides creator's watermarks on videos. | 17.33.42 |
|
||||||
| `sponsorblock` | Integrate SponsorBlock. | 17.33.42 |
|
| `sponsorblock` | Integrate SponsorBlock. | 17.33.42 |
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin("stdlib"))
|
implementation("app.revanced:revanced-patcher:4.2.2")
|
||||||
|
|
||||||
implementation("app.revanced:revanced-patcher:3.4.0")
|
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
|
|
||||||
// Required for meta
|
// Required for meta
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.50.2
|
version = 2.51.2
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.tiktok.ad.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
|
||||||
|
|
||||||
|
@Name("convert-help-v2-feeditemlist-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lbeancopy/ConvertHelp;",
|
||||||
|
"com${'$'}ss${'$'}ugc${'$'}aweme${'$'}proto${'$'}aweme_v2_feed_response${'$'}${'$'}com${'$'}ss${'$'}android${'$'}ugc${'$'}aweme${'$'}feed${'$'}model${'$'}FeedItemList",
|
||||||
|
)
|
||||||
|
@TiktokAdsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ConvertHelpFeedItemListFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("/ConvertHelp;") &&
|
||||||
|
methodDef.name.endsWith("${'$'}FeedItemList")
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -11,6 +11,7 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
|
import app.revanced.patches.tiktok.ad.annotations.TiktokAdsCompatibility
|
||||||
|
import app.revanced.patches.tiktok.ad.fingerprints.ConvertHelpFeedItemListFingerprint
|
||||||
import app.revanced.patches.tiktok.ad.fingerprints.FeedItemListCloneFingerprint
|
import app.revanced.patches.tiktok.ad.fingerprints.FeedItemListCloneFingerprint
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
@@ -23,26 +24,34 @@ import org.jf.dexlib2.iface.reference.FieldReference
|
|||||||
@TiktokAdsCompatibility
|
@TiktokAdsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class TiktokAdsPatch : BytecodePatch(
|
class TiktokAdsPatch : BytecodePatch(
|
||||||
listOf(FeedItemListCloneFingerprint)
|
listOf(
|
||||||
|
FeedItemListCloneFingerprint,
|
||||||
|
ConvertHelpFeedItemListFingerprint
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val method = FeedItemListCloneFingerprint.result!!.mutableMethod
|
listOf(
|
||||||
// iterate all instructions in the clone method
|
FeedItemListCloneFingerprint,
|
||||||
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
ConvertHelpFeedItemListFingerprint
|
||||||
// conditions for the instruction we need
|
).forEach { fingerprint ->
|
||||||
if (instruction.opcode.ordinal != Opcode.IPUT_OBJECT.ordinal) continue
|
val method = fingerprint.result!!.mutableMethod
|
||||||
val clonePreloadAdsFieldInstruction = (instruction as? ReferenceInstruction)
|
// iterate all instructions in the clone method
|
||||||
if ((clonePreloadAdsFieldInstruction?.reference as? FieldReference)?.name != "preloadAds") continue
|
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
||||||
|
// conditions for the instruction we need
|
||||||
|
if (instruction.opcode.ordinal != Opcode.IPUT_OBJECT.ordinal) continue
|
||||||
|
val preloadAdsFieldInstruction = (instruction as? ReferenceInstruction)
|
||||||
|
if ((preloadAdsFieldInstruction?.reference as? FieldReference)?.name != "preloadAds") continue
|
||||||
|
|
||||||
// set null instead of the field "preloadAds"
|
// set null instead of the field "preloadAds"
|
||||||
val overrideRegister = (clonePreloadAdsFieldInstruction as TwoRegisterInstruction).registerA
|
val overrideRegister = (preloadAdsFieldInstruction as TwoRegisterInstruction).registerA
|
||||||
method.addInstruction(
|
method.addInstruction(
|
||||||
index,
|
index,
|
||||||
"const/4 v$overrideRegister, 0x0"
|
"const/4 v$overrideRegister, 0x0"
|
||||||
)
|
)
|
||||||
return PatchResultSuccess()
|
return@forEach
|
||||||
|
}
|
||||||
|
return PatchResultError("Can not find required instruction.")
|
||||||
}
|
}
|
||||||
|
return PatchResultSuccess()
|
||||||
return PatchResultError("Could not find required instruction.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,16 @@ package app.revanced.patches.youtube.layout.amoled.patch
|
|||||||
|
|
||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.PatchDeprecated
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
|
||||||
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.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
|
import app.revanced.patches.youtube.layout.amoled.annotations.AmoledCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.theme.patch.ThemePatch
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import org.w3c.dom.Element
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([FixLocaleConfigErrorPatch::class])
|
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||||
@@ -20,24 +19,10 @@ import java.io.File
|
|||||||
@Description("Enables pure black theme.")
|
@Description("Enables pure black theme.")
|
||||||
@AmoledCompatibility
|
@AmoledCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
|
@PatchDeprecated("Theme patch already includes the Amoled theme.", ThemePatch::class)
|
||||||
class AmoledPatch : ResourcePatch() {
|
class AmoledPatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
data.xmlEditor["res${File.separator}values${File.separator}colors.xml"].use { editor ->
|
ThemePatch.theme = ThemePatch.Themes.Amoled.name
|
||||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
return ThemePatch().execute(data)
|
||||||
|
|
||||||
for (i in 0 until resourcesNode.childNodes.length) {
|
|
||||||
val node = resourcesNode.childNodes.item(i)
|
|
||||||
if (node !is Element) continue
|
|
||||||
|
|
||||||
val element = resourcesNode.childNodes.item(i) as Element
|
|
||||||
element.textContent = when (element.getAttribute("name")) {
|
|
||||||
"yt_black1", "yt_black1_opacity95", "yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark" -> "@android:color/black"
|
|
||||||
"yt_selected_nav_label_dark" -> "#ffdf0000"
|
|
||||||
else -> continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import app.revanced.patcher.patch.annotations.Patch
|
|||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
@@ -42,27 +41,18 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
"hdpi" to 72,
|
"hdpi" to 72,
|
||||||
"mdpi" to 48
|
"mdpi" to 48
|
||||||
).forEach { (iconDirectory, size) ->
|
).forEach { (iconDirectory, size) ->
|
||||||
iconNames.forEach iconLoop@{ iconName ->
|
iconNames.forEach { iconName ->
|
||||||
val iconFile = getIconStream("branding/$size/$iconName.png")
|
val iconFile = getIconStream("branding/$size/$iconName.png")
|
||||||
?: return PatchResultError("The icon $iconName can not be found.")
|
?: return PatchResultError("The icon $iconName can not be found.")
|
||||||
|
|
||||||
val outputStream = ByteArrayOutputStream()
|
|
||||||
iconFile.use { input ->
|
|
||||||
outputStream.use { output ->
|
|
||||||
input.copyTo(output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.write(
|
Files.write(
|
||||||
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
|
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
|
||||||
outputStream.toByteArray()
|
iconFile.readBytes()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name branding
|
// Name branding
|
||||||
val appName: String by options[keyAppName]
|
|
||||||
|
|
||||||
val manifest = data["AndroidManifest.xml"]
|
val manifest = data["AndroidManifest.xml"]
|
||||||
manifest.writeText(
|
manifest.writeText(
|
||||||
manifest.readText()
|
manifest.readText()
|
||||||
@@ -75,24 +65,7 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val options = PatchOptions(
|
|
||||||
PatchOption.StringOption(
|
|
||||||
key = keyAppName,
|
|
||||||
default = "YouTube ReVanced",
|
|
||||||
title = "Application Name",
|
|
||||||
description = "The name of the application it will show on your home screen.",
|
|
||||||
required = true
|
|
||||||
),
|
|
||||||
PatchOption.StringOption(
|
|
||||||
key = keyAppIconPath,
|
|
||||||
default = null,
|
|
||||||
title = "Application Icon Path",
|
|
||||||
description = "A path to the icon of the application."
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun getIconStream(iconPath: String): InputStream? {
|
private fun getIconStream(iconPath: String): InputStream? {
|
||||||
val appIconPath: String? by options[keyAppIconPath]
|
|
||||||
if (appIconPath == null) {
|
if (appIconPath == null) {
|
||||||
return this.javaClass.classLoader.getResourceAsStream(iconPath)
|
return this.javaClass.classLoader.getResourceAsStream(iconPath)
|
||||||
}
|
}
|
||||||
@@ -101,8 +74,24 @@ class CustomBrandingPatch : ResourcePatch() {
|
|||||||
return FileInputStream(file)
|
return FileInputStream(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
companion object : OptionsContainer() {
|
||||||
private const val keyAppName = "appName"
|
private var appName: String? by option(
|
||||||
private const val keyAppIconPath = "appIconPath"
|
PatchOption.StringOption(
|
||||||
|
key = "appName",
|
||||||
|
default = "YouTube ReVanced",
|
||||||
|
title = "Application Name",
|
||||||
|
description = "The name of the application it will show on your home screen.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
private var appIconPath: String? by option(
|
||||||
|
PatchOption.StringOption(
|
||||||
|
key = "appIconPath",
|
||||||
|
default = null,
|
||||||
|
title = "Application Icon Path",
|
||||||
|
description = "A path to the icon of the application."
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.google.android.youtube")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class ThemeCompatibility
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.theme.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
|
import app.revanced.patcher.patch.*
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
|
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([FixLocaleConfigErrorPatch::class])
|
||||||
|
@Name("theme")
|
||||||
|
@Description("Enables a custom theme.")
|
||||||
|
@ThemeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ThemePatch : ResourcePatch() {
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
val theme = Themes.of(theme!!) ?: return PatchResultError("Theme '$theme' not found.")
|
||||||
|
|
||||||
|
data.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||||
|
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||||
|
|
||||||
|
for (i in 0 until resourcesNode.childNodes.length) {
|
||||||
|
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
|
||||||
|
node.textContent = theme.apply(node.getAttribute("name")) ?: continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object : OptionsContainer() {
|
||||||
|
var theme: String? by option(
|
||||||
|
PatchOption.StringListOption(
|
||||||
|
key = "theme",
|
||||||
|
default = null,
|
||||||
|
options = Themes.names,
|
||||||
|
title = "Theme",
|
||||||
|
description = "Select a theme.",
|
||||||
|
required = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class Themes(val apply: (String) -> String?) {
|
||||||
|
Amoled({ attr ->
|
||||||
|
when (attr) {
|
||||||
|
"yt_black1", "yt_black1_opacity95", "yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark" -> "@android:color/black"
|
||||||
|
"yt_selected_nav_label_dark" -> "#ffdf0000"
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val names = values().map { it.name }
|
||||||
|
|
||||||
|
fun of(name: String) = values().firstOrNull { it.name == name }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:tint="?attr/ytTextPrimary" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:tint="#FFFFFF" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||||
<path android:fillColor="#ff000000" android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
|
<path android:fillColor="#FFFFFF" android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
Reference in New Issue
Block a user