feat: replace app icons (#25)
* wip: patch app icons * chore: update deps * wrong axml version zt loves * Update app/src/main/kotlin/com/aliucord/manager/ui/viewmodel/InstallViewModel.kt Co-authored-by: TymanWasTaken <tbeckman530@gmail.com> * guh hardcoding is just easier for now * guhhh stupit auto rename Co-authored-by: TymanWasTaken <tbeckman530@gmail.com>
This commit is contained in:
parent
e226e3cfe9
commit
15610c8809
9 changed files with 31 additions and 10 deletions
|
|
@ -72,7 +72,7 @@ dependencies {
|
|||
// AndroidX
|
||||
implementation("androidx.core:core-ktx:1.9.0")
|
||||
implementation("androidx.core:core-splashscreen:1.0.0")
|
||||
implementation("androidx.activity:activity-compose:1.6.0-rc02")
|
||||
implementation("androidx.activity:activity-compose:1.6.0")
|
||||
implementation("androidx.paging:paging-compose:1.0.0-alpha16")
|
||||
|
||||
// Compose
|
||||
|
|
@ -80,7 +80,7 @@ dependencies {
|
|||
implementation("androidx.compose.ui:ui:$composeVersion")
|
||||
implementation("androidx.compose.ui:ui-tooling:$composeVersion")
|
||||
implementation("androidx.compose.material:material-icons-extended:$composeVersion")
|
||||
implementation("androidx.compose.material3:material3:1.0.0-beta02")
|
||||
implementation("androidx.compose.material3:material3:1.0.0-beta03")
|
||||
|
||||
// accompanist dependencies
|
||||
val accompanistVersion = "0.26.3-beta"
|
||||
|
|
@ -105,8 +105,7 @@ dependencies {
|
|||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||
implementation("com.android:zipflinger:8.0.0-alpha01")
|
||||
// implementation("com.github.Aliucord:libzip:1.0.0")
|
||||
@Suppress("GradleDependency")
|
||||
implementation("de.upb.cs.swt:axml:2.1.1") // 2.1.3 is broken btw
|
||||
implementation("com.android.tools.build:apksig:7.4.0-alpha10")
|
||||
implementation("com.aliucord:axml:1.0.1")
|
||||
implementation("com.android.tools.build:apksig:7.4.0-beta01")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
BIN
app/src/main/assets/icons/ic_logo_round.png
Normal file
BIN
app/src/main/assets/icons/ic_logo_round.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/assets/icons/ic_logo_square.png
Normal file
BIN
app/src/main/assets/icons/ic_logo_square.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
|
|
@ -8,7 +8,7 @@ import com.aliucord.manager.ui.theme.Theme
|
|||
class PreferencesManager(preferences: SharedPreferences) : BasePreferenceManager(preferences) {
|
||||
var theme by enumPreference("theme", Theme.SYSTEM)
|
||||
var dynamicColor by booleanPreference("dynamic_color", true)
|
||||
var replaceBg by booleanPreference("replace_bg", true)
|
||||
var replaceIcon by booleanPreference("replace_icon", true)
|
||||
var devMode by booleanPreference("dev_mode", false)
|
||||
var debuggable by booleanPreference("debuggable", false)
|
||||
var useDexFromStorage by booleanPreference("use_dex_from_storage", false)
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ fun SettingsScreen(
|
|||
GroupHeader(stringResource(R.string.advanced))
|
||||
|
||||
SwitchSetting(
|
||||
checked = preferences.replaceBg,
|
||||
checked = preferences.replaceIcon,
|
||||
title = { Text(stringResource(R.string.replace_bg)) },
|
||||
onCheckedChange = { preferences.replaceBg = it },
|
||||
onCheckedChange = { preferences.replaceIcon = it },
|
||||
icon = { Icon(Icons.Default.AppShortcut, null) }
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import com.aliucord.manager.domain.repository.GithubRepository
|
|||
import com.aliucord.manager.installer.service.InstallService
|
||||
import com.aliucord.manager.installer.util.ManifestPatcher
|
||||
import com.aliucord.manager.installer.util.Signer
|
||||
import com.aliucord.manager.network.service.GithubService
|
||||
import com.aliucord.manager.ui.screen.InstallData
|
||||
import com.android.zipflinger.*
|
||||
import kotlinx.coroutines.*
|
||||
|
|
@ -195,6 +194,28 @@ class InstallViewModel(
|
|||
|
||||
val apks = arrayOf(baseApkFile, libsApkFile, localeApkFile, xxhdpiApkFile)
|
||||
|
||||
if (preferences.replaceIcon) {
|
||||
log += "Replacing App Icons... "
|
||||
|
||||
ZipArchive(baseApkFile.toPath()).use { baseApk ->
|
||||
val mipmaps = arrayOf("mipmap-xhdpi-v4", "mipmap-xxhdpi-v4", "mipmap-xxxhdpi-v4")
|
||||
val icons = arrayOf("ic_logo_foreground.png", "ic_logo_square.png", "ic_logo_foreground.png")
|
||||
|
||||
for (icon in icons) {
|
||||
val newIcon = application.assets.open("icons/$icon")
|
||||
.use { it.readBytes() }
|
||||
|
||||
for (mipmap in mipmaps) {
|
||||
val path = "res/$mipmap/$icon"
|
||||
baseApk.delete(path)
|
||||
baseApk.add(BytesSource(newIcon, path, Deflater.DEFAULT_COMPRESSION))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log += "Done\n"
|
||||
}
|
||||
|
||||
log += "Patching manifest... "
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ allprojects {
|
|||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
maven(url = "https://jitpack.io")
|
||||
maven("https://jitpack.io")
|
||||
maven("https://maven.aliucord.com/snapshots")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue