From 541af557dd2f9924d994b5e6707f644df7cd98b0 Mon Sep 17 00:00:00 2001 From: HChen Date: Thu, 29 Feb 2024 22:31:12 +0800 Subject: [PATCH] Other --- .../data/adapter/AppDataAdapter.java | 33 ++++++++----------- .../ui/fragment/sub/AppPicker.java | 3 +- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java b/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java index a63729488f..400bab8bbc 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/data/adapter/AppDataAdapter.java @@ -1,21 +1,21 @@ /* - * This file is part of HyperCeiler. + * This file is part of HyperCeiler. - * HyperCeiler is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License. + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . - * Copyright (C) 2023-2024 HyperCeiler Contributions -*/ + * Copyright (C) 2023-2024 HyperCeiler Contributions + */ package com.sevtinge.hyperceiler.data.adapter; import android.content.Context; @@ -66,22 +66,15 @@ public AppDataAdapter(@NonNull Context context, int resource, List appI mMode = mode; } - public void setData(List appInfoList) { - AppDataAdapter.appInfoList = appInfoList; - notifyDataSetChanged(); - } - @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { AppData appInfo = getItem(position); getShared(); - // deleteAll(); View view = setNewView(convertView, parent, appInfo); assert appInfo != null; if (mMode == AppPicker.INPUT_MODE) { String edit = getEdit(appInfo.packageName); - // Log.e(TAG, "eddd: " + edit, null); if (!edit.equals("")) { appName.setText(edit); } else { diff --git a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/AppPicker.java b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/AppPicker.java index ebab29f830..1217b8eff4 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/AppPicker.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/ui/fragment/sub/AppPicker.java @@ -64,7 +64,7 @@ public class AppPicker extends Fragment { public Handler mHandler; private Set selectedApps; private List appDataList = new ArrayList<>(); - private HashMap hashMap = new HashMap<>(); + private final HashMap hashMap = new HashMap<>(); private IAppSelectCallback mAppSelectCallback; public static IEditCallback iEditCallback; @@ -203,6 +203,7 @@ public List getPackageCodeList(PackageManager pm) { intent.addCategory(Intent.CATEGORY_LAUNCHER); List resolveInfoList = new ArrayList<>(); List resolveInfos = pm.queryIntentActivities(intent, PackageManager.GET_ACTIVITIES); + hashMap.clear(); for (ResolveInfo resolveInfo : resolveInfos) { Integer added = hashMap.get(resolveInfo.activityInfo.applicationInfo.packageName); if (added == null || added != 1) {