Update Compose & Fix apkPaths null
This commit is contained in:
parent
0d1f937457
commit
f7c6af53ec
|
|
@ -16,7 +16,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r")
|
classpath("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r")
|
||||||
classpath(kotlin("gradle-plugin", version = "1.7.0"))
|
classpath(kotlin("gradle-plugin", version = "1.7.10"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
composeOptions {
|
composeOptions {
|
||||||
kotlinCompilerExtensionVersion = "1.2.0"
|
kotlinCompilerExtensionVersion = "1.3.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets["main"].assets.srcDirs(rootProject.projectDir.resolve("out/assets"))
|
sourceSets["main"].assets.srcDirs(rootProject.projectDir.resolve("out/assets"))
|
||||||
|
|
@ -81,29 +81,31 @@ dependencies {
|
||||||
implementation(projects.share.java)
|
implementation(projects.share.java)
|
||||||
|
|
||||||
val roomVersion = "2.4.3"
|
val roomVersion = "2.4.3"
|
||||||
val composeDestinationsVersion = "1.7.17-beta"
|
val accompanistVersion = "0.26.3-beta"
|
||||||
|
val composeDestinationsVersion = "1.7.21-beta"
|
||||||
annotationProcessor("androidx.room:room-compiler:$roomVersion")
|
annotationProcessor("androidx.room:room-compiler:$roomVersion")
|
||||||
compileOnly("dev.rikka.hidden:stub:2.3.1")
|
compileOnly("dev.rikka.hidden:stub:2.3.1")
|
||||||
implementation("androidx.core:core-ktx:1.8.0")
|
implementation("androidx.core:core-ktx:1.9.0")
|
||||||
implementation("androidx.activity:activity-compose:1.6.0-rc01")
|
implementation("androidx.activity:activity-compose:1.6.0")
|
||||||
implementation("androidx.compose.material:material-icons-extended:1.3.0-beta01")
|
implementation("androidx.compose.material:material-icons-extended:1.3.0-beta03")
|
||||||
implementation("androidx.compose.material3:material3:1.0.0-beta01")
|
implementation("androidx.compose.material3:material3:1.0.0-beta03")
|
||||||
implementation("androidx.compose.ui:ui:1.3.0-beta01")
|
implementation("androidx.compose.ui:ui:1.3.0-beta03")
|
||||||
implementation("androidx.compose.ui:ui-tooling:1.3.0-beta01")
|
implementation("androidx.compose.ui:ui-tooling:1.3.0-beta03")
|
||||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1")
|
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1")
|
||||||
implementation("androidx.navigation:navigation-compose:2.5.1")
|
implementation("androidx.navigation:navigation-compose:2.5.2")
|
||||||
implementation("androidx.preference:preference:1.2.0")
|
implementation("androidx.preference:preference:1.2.0")
|
||||||
implementation("androidx.room:room-ktx:$roomVersion")
|
implementation("androidx.room:room-ktx:$roomVersion")
|
||||||
implementation("androidx.room:room-runtime:$roomVersion")
|
implementation("androidx.room:room-runtime:$roomVersion")
|
||||||
implementation("com.google.accompanist:accompanist-drawablepainter:0.26.2-beta")
|
implementation("com.google.accompanist:accompanist-drawablepainter:$accompanistVersion")
|
||||||
implementation("com.google.accompanist:accompanist-navigation-animation:0.26.2-beta")
|
implementation("com.google.accompanist:accompanist-navigation-animation:$accompanistVersion")
|
||||||
implementation("com.google.accompanist:accompanist-pager:0.26.2-beta")
|
implementation("com.google.accompanist:accompanist-pager:$accompanistVersion")
|
||||||
implementation("com.google.accompanist:accompanist-swiperefresh:0.26.2-beta")
|
implementation("com.google.accompanist:accompanist-swiperefresh:$accompanistVersion")
|
||||||
implementation("com.google.android.material:material:1.6.1")
|
implementation("com.google.android.material:material:1.6.1")
|
||||||
implementation("com.google.code.gson:gson:2.9.1")
|
implementation("com.google.code.gson:gson:2.9.1")
|
||||||
implementation("dev.rikka.shizuku:api:12.1.0")
|
implementation("dev.rikka.shizuku:api:12.1.0")
|
||||||
implementation("dev.rikka.shizuku:provider:12.1.0")
|
implementation("dev.rikka.shizuku:provider:12.1.0")
|
||||||
implementation("io.github.raamcosta.compose-destinations:core:$composeDestinationsVersion")
|
implementation("io.github.raamcosta.compose-destinations:core:$composeDestinationsVersion")
|
||||||
|
implementation("me.zhanghai.android.appiconloader:appiconloader:1.5.0")
|
||||||
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
|
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
|
||||||
ksp("androidx.room:room-compiler:$roomVersion")
|
ksp("androidx.room:room-compiler:$roomVersion")
|
||||||
ksp("io.github.raamcosta.compose-destinations:ksp:$composeDestinationsVersion")
|
ksp("io.github.raamcosta.compose-destinations:ksp:$composeDestinationsVersion")
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,30 @@
|
||||||
package org.lsposed.lspatch.ui.component
|
package org.lsposed.lspatch.ui.component
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.graphics.drawable.GradientDrawable
|
import android.graphics.drawable.GradientDrawable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowForwardIos
|
import androidx.compose.material.icons.filled.ArrowForwardIos
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.Checkbox
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ImageBitmap
|
||||||
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.google.accompanist.drawablepainter.rememberDrawablePainter
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
import org.lsposed.lspatch.ui.theme.LSPTheme
|
import org.lsposed.lspatch.ui.theme.LSPTheme
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppItem(
|
fun AppItem(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
icon: Drawable,
|
icon: ImageBitmap,
|
||||||
label: String,
|
label: String,
|
||||||
packageName: String,
|
packageName: String,
|
||||||
checked: Boolean? = null,
|
checked: Boolean? = null,
|
||||||
|
|
@ -40,9 +43,8 @@ fun AppItem(
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = rememberDrawablePainter(icon),
|
bitmap = icon,
|
||||||
contentDescription = label,
|
contentDescription = label,
|
||||||
modifier = Modifier.size(32.dp),
|
|
||||||
tint = Color.Unspecified
|
tint = Color.Unspecified
|
||||||
)
|
)
|
||||||
Column(
|
Column(
|
||||||
|
|
@ -79,7 +81,7 @@ private fun AppItemPreview() {
|
||||||
shape.shape = GradientDrawable.RECTANGLE
|
shape.shape = GradientDrawable.RECTANGLE
|
||||||
shape.setColor(MaterialTheme.colorScheme.primary.toArgb())
|
shape.setColor(MaterialTheme.colorScheme.primary.toArgb())
|
||||||
AppItem(
|
AppItem(
|
||||||
icon = shape,
|
icon = shape.toBitmap().asImageBitmap(),
|
||||||
label = "Sample App",
|
label = "Sample App",
|
||||||
packageName = "org.lsposed.sample",
|
packageName = "org.lsposed.sample",
|
||||||
rightIcon = { Icon(Icons.Filled.ArrowForwardIos, null) }
|
rightIcon = { Icon(Icons.Filled.ArrowForwardIos, null) }
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ fun SearchAppBar(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallTopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Box {
|
Box {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ fun NewPatchScreen(
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun ConfiguringTopBar(onBackClick: () -> Unit) {
|
private fun ConfiguringTopBar(onBackClick: () -> Unit) {
|
||||||
SmallTopAppBar(
|
TopAppBar(
|
||||||
title = { Text(stringResource(R.string.screen_new_patch)) },
|
title = { Text(stringResource(R.string.screen_new_patch)) },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(
|
IconButton(
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,25 @@
|
||||||
package org.lsposed.lspatch.util
|
package org.lsposed.lspatch.util
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.ApplicationInfo
|
import android.content.pm.ApplicationInfo
|
||||||
import android.content.pm.PackageInstaller
|
import android.content.pm.PackageInstaller
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.graphics.ImageBitmap
|
||||||
|
import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
import hidden.HiddenApiBridge
|
import hidden.HiddenApiBridge
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
import me.zhanghai.android.appiconloader.AppIconLoader
|
||||||
import org.lsposed.lspatch.Constants.PATCH_FILE_SUFFIX
|
import org.lsposed.lspatch.Constants.PATCH_FILE_SUFFIX
|
||||||
import org.lsposed.lspatch.config.ConfigManager
|
import org.lsposed.lspatch.config.ConfigManager
|
||||||
import org.lsposed.lspatch.config.Configs
|
import org.lsposed.lspatch.config.Configs
|
||||||
|
|
@ -43,7 +46,9 @@ object LSPPackageManager {
|
||||||
var appList by mutableStateOf(listOf<AppInfo>())
|
var appList by mutableStateOf(listOf<AppInfo>())
|
||||||
private set
|
private set
|
||||||
|
|
||||||
private val appIcon = mutableMapOf<String, Drawable>()
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
private val iconLoader = AppIconLoader(lspApp.resources.getDimensionPixelSize(android.R.dimen.app_icon_size), false, lspApp)
|
||||||
|
private val appIcon = mutableMapOf<String, ImageBitmap>()
|
||||||
|
|
||||||
suspend fun fetchAppList() {
|
suspend fun fetchAppList() {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
|
|
@ -52,7 +57,7 @@ object LSPPackageManager {
|
||||||
pm.getInstalledApplications(PackageManager.GET_META_DATA).forEach {
|
pm.getInstalledApplications(PackageManager.GET_META_DATA).forEach {
|
||||||
val label = pm.getApplicationLabel(it)
|
val label = pm.getApplicationLabel(it)
|
||||||
collection.add(AppInfo(it, label.toString()))
|
collection.add(AppInfo(it, label.toString()))
|
||||||
appIcon[it.packageName] = pm.getApplicationIcon(it)
|
appIcon[it.packageName] = iconLoader.loadIcon(it).asImageBitmap()
|
||||||
}
|
}
|
||||||
collection.sortWith(compareBy(Collator.getInstance(Locale.getDefault()), AppInfo::label))
|
collection.sortWith(compareBy(Collator.getInstance(Locale.getDefault()), AppInfo::label))
|
||||||
val modules = buildMap {
|
val modules = buildMap {
|
||||||
|
|
@ -162,7 +167,10 @@ object LSPPackageManager {
|
||||||
}
|
}
|
||||||
if (primary == null) {
|
if (primary == null) {
|
||||||
primary = lspApp.packageManager.getPackageArchiveInfo(dst.absolutePath, 0)?.applicationInfo
|
primary = lspApp.packageManager.getPackageArchiveInfo(dst.absolutePath, 0)?.applicationInfo
|
||||||
if (primary != null) return@mapNotNull null
|
primary?.let {
|
||||||
|
it.sourceDir = dst.absolutePath
|
||||||
|
return@mapNotNull null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dst.absolutePath
|
dst.absolutePath
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ pluginManagement {
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.library") version agpVersion
|
id("com.android.library") version agpVersion
|
||||||
id("com.android.application") version agpVersion
|
id("com.android.application") version agpVersion
|
||||||
id("com.google.devtools.ksp") version "1.7.0-1.0.6"
|
id("com.google.devtools.ksp") version "1.7.10-1.0.6"
|
||||||
id("dev.rikka.tools.refine") version "3.1.1"
|
id("dev.rikka.tools.refine") version "3.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue