mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 15:49:20 +01:00
Don't reset library adapter if it's not needed
This commit is contained in:
parent
8520a47286
commit
f0a3c9c2dc
@ -32,9 +32,11 @@ public class LibraryAdapter extends SmartFragmentStatePagerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCategories(List<Category> categories) {
|
public void setCategories(List<Category> categories) {
|
||||||
|
if (this.categories != categories) {
|
||||||
this.categories = categories;
|
this.categories = categories;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setSelectionMode(int mode) {
|
public void setSelectionMode(int mode) {
|
||||||
for (Fragment fragment : getRegisteredFragments()) {
|
for (Fragment fragment : getRegisteredFragments()) {
|
||||||
|
@ -34,6 +34,7 @@ public class LibraryCategoryFragment extends BaseFragment
|
|||||||
|
|
||||||
@State int position;
|
@State int position;
|
||||||
private LibraryCategoryAdapter adapter;
|
private LibraryCategoryAdapter adapter;
|
||||||
|
private List<Manga> mangas;
|
||||||
|
|
||||||
private Subscription numColumnsSubscription;
|
private Subscription numColumnsSubscription;
|
||||||
|
|
||||||
@ -112,11 +113,14 @@ public class LibraryCategoryFragment extends BaseFragment
|
|||||||
|
|
||||||
Category category = categories.get(position);
|
Category category = categories.get(position);
|
||||||
List<Manga> mangas = event.getMangasForCategory(category);
|
List<Manga> mangas = event.getMangasForCategory(category);
|
||||||
|
if (this.mangas != mangas) {
|
||||||
|
this.mangas = mangas;
|
||||||
if (mangas == null) {
|
if (mangas == null) {
|
||||||
mangas = new ArrayList<>();
|
mangas = new ArrayList<>();
|
||||||
}
|
}
|
||||||
setMangas(mangas);
|
setMangas(mangas);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void openManga(Manga manga) {
|
protected void openManga(Manga manga) {
|
||||||
getLibraryPresenter().onOpenManga(manga);
|
getLibraryPresenter().onOpenManga(manga);
|
||||||
|
Loading…
Reference in New Issue
Block a user