Skip to content

Commit

Permalink
feat: support multiuser
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-TSNG committed Oct 8, 2021
1 parent d76827a commit 98c3af2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tsng.hidemyapplist.app.helpers

import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import com.tsng.hidemyapplist.app.MyApplication

Expand All @@ -18,7 +19,7 @@ object AppInfoHelper {
if (AppInfoHelper::mAppInfoList.isInitialized) return mAppInfoList.toMutableList()
mAppInfoList = mutableListOf()
val pm = MyApplication.appContext.packageManager
for (appInfo in pm.getInstalledApplications(0)) {
for (appInfo in pm.getInstalledApplications(PackageManager.MATCH_UNINSTALLED_PACKAGES)) {
MyAppInfo(
appInfo.loadLabel(pm).toString(),
appInfo.packageName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tsng.hidemyapplist.app.ui.fragments

import android.content.DialogInterface
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
Expand Down Expand Up @@ -63,7 +64,10 @@ class AppSettingsFragment : PreferenceFragmentCompat() {
setPreferencesFromResource(R.xml.app_preferences, rootKey)

preferenceScreen.findPreference<Preference>("appInfo")?.let {
val appInfo = appContext.packageManager.getApplicationInfo(packageName, 0)
val appInfo = appContext.packageManager.getApplicationInfo(
packageName,
PackageManager.MATCH_UNINSTALLED_PACKAGES or PackageManager.MATCH_DISABLED_COMPONENTS
)
it.icon = appInfo.loadIcon(appContext.packageManager)
it.title = appInfo.loadLabel(appContext.packageManager)
it.summary = packageName
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ val targetSdkVer by extra(31)
val buildToolsVer by extra("31.0.0")
val ndkVer by extra("23.0.7599858")

val appVerName by extra("2.2")
val appVerCode by extra(66)
val appVerName by extra("2.2.1")
val appVerCode by extra(67)
val serviceVer by extra(66)
val minRiruVer by extra(28)
val minBackupVer by extra(65)
Expand Down

0 comments on commit 98c3af2

Please sign in to comment.