@@ -106,7 +106,7 @@ object CustomBrandingIconPatch : ResourcePatch() {
106
106
values = availableIcon,
107
107
title = " App icon" ,
108
108
description = """
109
- The path to a folder must contain one or more of the following folders matching the DPI of your device :
109
+ The path to a folder containing the following folders:
110
110
111
111
${mipmapDirectories.joinToString(" \n " ) { " - $it " }}
112
112
@@ -121,7 +121,7 @@ object CustomBrandingIconPatch : ResourcePatch() {
121
121
122
122
override fun execute (context : ResourceContext ) {
123
123
AppIcon ?.let { appIcon ->
124
- val appIconValue = appIcon.lowercase().replace(" " ," _" )
124
+ val appIconValue = appIcon.lowercase().replace(" " , " _" )
125
125
if (! availableIcon.containsValue(appIconValue)) {
126
126
mipmapDirectories.map { directory ->
127
127
ResourceGroup (
@@ -163,13 +163,31 @@ object CustomBrandingIconPatch : ResourcePatch() {
163
163
}
164
164
165
165
// change splash icon.
166
- drawableDirectories.map { directory ->
167
- ResourceGroup (
168
- directory, * drawableIconResourceFileNames
169
- )
170
- }.let { resourceGroups ->
171
- resourceGroups.forEach {
172
- context.copyResources(" $resourcePath /splash" , it)
166
+ val drawableAnimResourceFileNames = Array (5 ) { index -> " \$ avd_anim__$index .xml" }
167
+
168
+ if (appIconValue == " mmt" ) {
169
+ (arrayOf(
170
+ ResourceGroup (" values-v31" , " style.xml" ),
171
+ ResourceGroup (" drawable" , " avd_anim.xml" , * drawableAnimResourceFileNames)
172
+ ) + drawableDirectories.map { ResourceGroup (it, * drawableIconResourceFileNames) })
173
+ .forEach { context.copyResources(" $resourcePath /splash" , it) }
174
+ } else {
175
+ drawableDirectories.map { directory ->
176
+ ResourceGroup (
177
+ directory, * drawableIconResourceFileNames
178
+ )
179
+ }.let { resourceGroups ->
180
+ resourceGroups.forEach {
181
+ context.copyResources(" $resourcePath /splash" , it)
182
+ }
183
+ }
184
+
185
+ // disable splash animation.
186
+ context.xmlEditor[" res/values-v31/styles.xml" ].use { editor ->
187
+ val tags = editor.file.getElementsByTagName(" item" )
188
+ List (tags.length) { tags.item(it) as Element }
189
+ .filter { it.getAttribute(" name" ).contains(" android:windowSplashScreenAnimatedIcon" ) }
190
+ .forEach { it.parentNode.removeChild(it) }
173
191
}
174
192
}
175
193
@@ -183,14 +201,6 @@ object CustomBrandingIconPatch : ResourcePatch() {
183
201
context.copyResources(" $resourcePath /monochrome" , resourceGroup)
184
202
}
185
203
186
- // disable splash animation.
187
- context.xmlEditor[" res/values-v31/styles.xml" ].use { editor ->
188
- val tags = editor.file.getElementsByTagName(" item" )
189
- List (tags.length) { tags.item(it) as Element }
190
- .filter { it.getAttribute(" name" ).contains(" android:windowSplashScreenAnimatedIcon" ) }
191
- .forEach { it.parentNode.removeChild(it) }
192
- }
193
-
194
204
context.updatePatchStatusIcon(appIconValue)
195
205
}
196
206
} ? : throw PatchException (" Invalid app icon path." )
0 commit comments