From e451e8155c2168294942d4c01ceebdcb6f1cb260 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Thu, 14 Apr 2016 23:55:40 +0200 Subject: [PATCH] Remember the map so that we can look up the name later, as well, closes #275 --- .../gadgetbridge/activities/AppBlacklistActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java index adf33ddc..bef49438 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java @@ -48,6 +48,7 @@ public class AppBlacklistActivity extends GBActivity { }; private SharedPreferences sharedPrefs; + private IdentityHashMap nameMap; @Override protected void onCreate(Bundle savedInstanceState) { @@ -61,7 +62,7 @@ public class AppBlacklistActivity extends GBActivity { ListView appListView = (ListView) findViewById(R.id.appListView); // sort the package list by label and blacklist status - final IdentityHashMap nameMap = new IdentityHashMap<>(packageList.size()); + nameMap = new IdentityHashMap<>(packageList.size()); for (ApplicationInfo ai : packageList) { CharSequence name = pm.getApplicationLabel(ai); if (name == null) { @@ -98,7 +99,7 @@ public class AppBlacklistActivity extends GBActivity { CheckBox checkbox = (CheckBox) view.findViewById(R.id.item_checkbox); deviceAppVersionAuthorLabel.setText(appInfo.packageName); - deviceAppNameLabel.setText(appInfo.loadLabel(pm)); + deviceAppNameLabel.setText(nameMap.get(appInfo)); deviceImageView.setImageDrawable(appInfo.loadIcon(pm)); checkbox.setChecked(GBApplication.blacklist.contains(appInfo.packageName));