mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-23 12:04:11 +01:00
the new and improved apk installer
This commit is contained in:
@@ -22,7 +22,7 @@ data class InstalledPackage(val root: File) {
|
||||
val icon = File(root, "icon.png")
|
||||
|
||||
val info: PackageInfo
|
||||
get() = ApkParsers.getMetaInfo(apk).toPackageInfo(root, apk).also {
|
||||
get() = ApkParsers.getMetaInfo(apk).toPackageInfo(apk).also {
|
||||
val parsed = ApkFile(apk)
|
||||
val dbFactory = DocumentBuilderFactory.newInstance()
|
||||
val dBuilder = dbFactory.newDocumentBuilder()
|
||||
@@ -82,12 +82,14 @@ data class InstalledPackage(val root: File) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun NodeList.toList(): List<Node> {
|
||||
val out = mutableListOf<Node>()
|
||||
companion object {
|
||||
fun NodeList.toList(): List<Node> {
|
||||
val out = mutableListOf<Node>()
|
||||
|
||||
for(i in 0 until length)
|
||||
out += item(i)
|
||||
for (i in 0 until length)
|
||||
out += item(i)
|
||||
|
||||
return out
|
||||
return out
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import android.content.pm.PackageInfo
|
||||
import net.dongliu.apk.parser.bean.ApkMeta
|
||||
import java.io.File
|
||||
|
||||
fun ApkMeta.toPackageInfo(root: File, apk: File): PackageInfo {
|
||||
fun ApkMeta.toPackageInfo(apk: File): PackageInfo {
|
||||
return PackageInfo().also {
|
||||
it.packageName = packageName
|
||||
it.versionCode = versionCode.toInt()
|
||||
|
||||
Reference in New Issue
Block a user