mirror of
https://github.com/YTVanced/VancedManager
synced 2025-01-06 23:41:00 +00:00
crash fixes
This commit is contained in:
parent
1d205bb4bb
commit
1c123e55d8
3 changed files with 11 additions and 6 deletions
|
@ -76,13 +76,13 @@ class AppListAdapter(
|
|||
|
||||
override fun onBindViewHolder(holder: ListViewHolder, position: Int) {
|
||||
holder.bind(position)
|
||||
|
||||
val dataModel = if (isRoot) rootDataModels[position] else dataModels[position]
|
||||
holder.appCard.setOnClickListener {
|
||||
tooltip.close()
|
||||
AppInfoDialog.newInstance(
|
||||
appName = apps[position],
|
||||
appIcon = dataModels[position]?.appIcon,
|
||||
changelog = dataModels[position]?.changelog?.value
|
||||
appIcon = dataModel?.appIcon,
|
||||
changelog = dataModel?.changelog?.value
|
||||
).show(context.supportFragmentManager, "info")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,13 @@ package com.vanced.manager.model
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import com.beust.klaxon.JsonObject
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.utils.PackageHelper
|
||||
|
||||
open class RootDataModel(
|
||||
class RootDataModel(
|
||||
jsonObject: LiveData<JsonObject?>,
|
||||
private val context: Context,
|
||||
override val appPkg: String,
|
||||
|
@ -18,6 +19,10 @@ open class RootDataModel(
|
|||
jsonObject, context, appPkg, appName, appIcon
|
||||
) {
|
||||
|
||||
init {
|
||||
Log.d("test", appPkg)
|
||||
}
|
||||
|
||||
override fun getPkgVersionName(pkg: String): String {
|
||||
return if (PackageHelper.scriptExists(scriptName)) {
|
||||
super.getPkgVersionName(pkg)
|
||||
|
|
|
@ -68,9 +68,9 @@ object PackageHelper {
|
|||
else -> ""
|
||||
}
|
||||
}
|
||||
fun isPackageInstalled(packageName: String, packageManager: PackageManager): Boolean {
|
||||
fun isPackageInstalled(packageName: String?, packageManager: PackageManager): Boolean {
|
||||
return try {
|
||||
packageManager.getPackageInfo(packageName, 0)
|
||||
packageManager.getPackageInfo(packageName ?: "", 0)
|
||||
true
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
false
|
||||
|
|
Loading…
Reference in a new issue