mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-06-07 23:27:50 +00:00
Merge pull request #1490 from alexbakker/fix-pack-crash
Fix a crash that could occur when deleting a broken icon pack import
This commit is contained in:
commit
e63ec4d1e8
2 changed files with 5 additions and 11 deletions
|
@ -107,15 +107,7 @@ public class IconPacksManagerFragment extends Fragment implements IconPackAdapte
|
||||||
.setMessage(R.string.remove_icon_pack_description)
|
.setMessage(R.string.remove_icon_pack_description)
|
||||||
.setIconAttribute(android.R.attr.alertDialogIcon)
|
.setIconAttribute(android.R.attr.alertDialogIcon)
|
||||||
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
|
.setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
|
||||||
try {
|
removeIconPack(pack);
|
||||||
_iconPackManager.removeIconPack(pack);
|
|
||||||
} catch (IconPackException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Dialogs.showErrorDialog(requireContext(), R.string.icon_pack_delete_error, e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_adapter.removeIconPack(pack);
|
|
||||||
updateEmptyState();
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.no, null)
|
.setNegativeButton(android.R.string.no, null)
|
||||||
.create());
|
.create());
|
||||||
|
|
|
@ -35,8 +35,10 @@ public class IconPackAdapter extends RecyclerView.Adapter<IconPackHolder> {
|
||||||
|
|
||||||
public void removeIconPack(IconPack pack) {
|
public void removeIconPack(IconPack pack) {
|
||||||
int position = _iconPacks.indexOf(pack);
|
int position = _iconPacks.indexOf(pack);
|
||||||
_iconPacks.remove(position);
|
if (position >= 0) {
|
||||||
notifyItemRemoved(position);
|
_iconPacks.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue