You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Code cleanup
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.topjohnwu.magisk.ui.superuser
|
||||
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Resources
|
||||
import androidx.databinding.ObservableArrayList
|
||||
import androidx.lifecycle.viewModelScope
|
||||
@@ -27,7 +26,6 @@ import me.tatarka.bindingcollectionadapter2.collections.MergeObservableList
|
||||
|
||||
class SuperuserViewModel(
|
||||
private val db: PolicyDao,
|
||||
private val packageManager: PackageManager,
|
||||
private val resources: Resources
|
||||
) : BaseViewModel(), TappableHeadlineItem.Listener {
|
||||
|
||||
@@ -51,7 +49,7 @@ class SuperuserViewModel(
|
||||
state = State.LOADING
|
||||
val (policies, diff) = withContext(Dispatchers.Default) {
|
||||
val policies = db.fetchAll {
|
||||
PolicyRvItem(it, it.applicationInfo.loadIcon(packageManager), this@SuperuserViewModel)
|
||||
PolicyRvItem(it, it.icon, this@SuperuserViewModel)
|
||||
}.sortedWith(compareBy(
|
||||
{ it.item.appName.toLowerCase(currentLocale) },
|
||||
{ it.item.packageName }
|
||||
|
||||
@@ -29,7 +29,7 @@ import me.tatarka.bindingcollectionadapter2.ItemBinding
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
|
||||
class SuRequestViewModel(
|
||||
private val pm: PackageManager,
|
||||
pm: PackageManager,
|
||||
policyDB: PolicyDao,
|
||||
private val timeoutPrefs: SharedPreferences,
|
||||
private val res: Resources
|
||||
@@ -94,7 +94,7 @@ class SuRequestViewModel(
|
||||
}
|
||||
|
||||
private fun showDialog(policy: SuPolicy) {
|
||||
icon = policy.applicationInfo.loadIcon(pm)
|
||||
icon = policy.icon
|
||||
title = policy.appName
|
||||
packageName = policy.packageName
|
||||
selectedItemPosition = timeoutPrefs.getInt(policy.packageName, 0)
|
||||
|
||||
Reference in New Issue
Block a user