[app] Fix check scope app

This commit is contained in:
tehcneko 2021-02-20 20:04:22 +08:00
parent f9adf20eeb
commit 83ec9396a5
1 changed files with 6 additions and 2 deletions

View File

@ -134,6 +134,7 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
checkedList.addAll(ConfigManager.getModuleScope(modulePackageName));
ArrayList<Application> installedList = new ArrayList<>();
List<String> scopeList = ModuleUtil.getInstance().getModule(modulePackageName).getScopeList();
boolean emptyCheckedList = checkedList.isEmpty();
for (PackageInfo info : appList) {
int uid = info.applicationInfo.uid;
Application application = new Application();
@ -144,6 +145,9 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
if (scopeList != null && scopeList.contains(info.packageName)) {
recommendedList.add(application);
if (emptyCheckedList) {
checkedList.add(application);
}
}
if (shouldHideApp(info, application)) {
@ -159,8 +163,8 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
searchList.add(appInfo);
}
checkedList.retainAll(installedList);
if (checkedList.isEmpty() && !recommendedList.isEmpty()) {
checkRecommended();
if (emptyCheckedList) {
ConfigManager.setModuleScope(modulePackageName, checkedList);
}
showList = sortApps(searchList);
activity.onDataReady();