diff --git a/app/src/main/java/com/dar/nclientv2/MainActivity.java b/app/src/main/java/com/dar/nclientv2/MainActivity.java index a74ac489..01f4b48c 100644 --- a/app/src/main/java/com/dar/nclientv2/MainActivity.java +++ b/app/src/main/java/com/dar/nclientv2/MainActivity.java @@ -268,7 +268,7 @@ private void loadStringLogin() { private void hideError() { //errorText.setVisibility(View.GONE); - if (snackbar != null && snackbar.isShown()) snackbar.dismiss(); + if (snackbar != null && snackbar.isShown()) runOnUiThread(() -> snackbar.dismiss()); snackbar = null; } diff --git a/app/src/main/java/com/dar/nclientv2/adapters/ListAdapter.java b/app/src/main/java/com/dar/nclientv2/adapters/ListAdapter.java index 212a2b89..fcd68829 100644 --- a/app/src/main/java/com/dar/nclientv2/adapters/ListAdapter.java +++ b/app/src/main/java/com/dar/nclientv2/adapters/ListAdapter.java @@ -41,7 +41,16 @@ public class ListAdapter extends RecyclerView.Adapter public ListAdapter(BaseActivity cont) { this.context = cont; - this.mDataset = new ArrayList<>(); + this.mDataset = new ArrayList(){ + @Override + public SimpleGallery get(int index) { + try { + return super.get(index); + }catch (ArrayIndexOutOfBoundsException ignore){ + return null; + } + } + }; storagePermission = Global.hasStoragePermission(context); queryString = TagV2.getAvoidedTags(); } @@ -128,7 +137,8 @@ public void updateColor(int id) { int position = -1; statuses.put(id, Queries.StatusMangaTable.getStatus(id).color); for (int i = 0; i < mDataset.size(); i++) { - if (mDataset.get(i) != null && mDataset.get(i).getId() == id) { + SimpleGallery gallery= mDataset.get(i); + if (gallery != null && gallery.getId() == id) { position = id; break; }