Don't reset library adapter if it's not needed
Cette révision appartient à :
Parent
8520a47286
révision
f0a3c9c2dc
2 fichiers modifiés avec 11 ajouts et 5 suppressions
|
@ -32,8 +32,10 @@ public class LibraryAdapter extends SmartFragmentStatePagerAdapter {
|
|||
}
|
||||
|
||||
public void setCategories(List<Category> categories) {
|
||||
this.categories = categories;
|
||||
notifyDataSetChanged();
|
||||
if (this.categories != categories) {
|
||||
this.categories = categories;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectionMode(int mode) {
|
||||
|
|
|
@ -34,6 +34,7 @@ public class LibraryCategoryFragment extends BaseFragment
|
|||
|
||||
@State int position;
|
||||
private LibraryCategoryAdapter adapter;
|
||||
private List<Manga> mangas;
|
||||
|
||||
private Subscription numColumnsSubscription;
|
||||
|
||||
|
@ -112,10 +113,13 @@ public class LibraryCategoryFragment extends BaseFragment
|
|||
|
||||
Category category = categories.get(position);
|
||||
List<Manga> mangas = event.getMangasForCategory(category);
|
||||
if (mangas == null) {
|
||||
mangas = new ArrayList<>();
|
||||
if (this.mangas != mangas) {
|
||||
this.mangas = mangas;
|
||||
if (mangas == null) {
|
||||
mangas = new ArrayList<>();
|
||||
}
|
||||
setMangas(mangas);
|
||||
}
|
||||
setMangas(mangas);
|
||||
}
|
||||
|
||||
protected void openManga(Manga manga) {
|
||||
|
|
Référencer dans un nouveau ticket