1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Remember the map so that we can look up the name later, as well, closes #275

This commit is contained in:
cpfeiffer 2016-04-14 23:55:40 +02:00
parent a460049a1b
commit e451e8155c

View File

@ -48,6 +48,7 @@ public class AppBlacklistActivity extends GBActivity {
};
private SharedPreferences sharedPrefs;
private IdentityHashMap<ApplicationInfo, String> 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<ApplicationInfo, String> 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));