forked from organicmaps/organicmaps
[android] Fixed update collection and categories when hide all/show all button was pressed.
This commit is contained in:
parent
6e481ec3c6
commit
c6b3fa0567
1 changed files with 11 additions and 7 deletions
|
@ -66,9 +66,15 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
BookmarkManager.INSTANCE.toggleCompilationVisibility(category, type);
|
||||
|
||||
if (type == BookmarkManager.COLLECTION)
|
||||
{
|
||||
notifyItemChanged(0);
|
||||
mItemsCollection = BookmarkManager.INSTANCE.getChildrenCollections(mBookmarkCategory.getId());
|
||||
}
|
||||
else if (mItemsCollection.size() > 0)
|
||||
{
|
||||
notifyItemChanged(mItemsCollection.size() + 1);
|
||||
mItemsCategory = BookmarkManager.INSTANCE.getChildrenCategories(mBookmarkCategory.getId());
|
||||
}
|
||||
else
|
||||
notifyItemChanged(0);
|
||||
}
|
||||
|
@ -262,12 +268,10 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
return itemCount;
|
||||
}
|
||||
|
||||
private void updateItemsByType(@BookmarkManager.CompilationType int compilationType)
|
||||
private void updateAllItems()
|
||||
{
|
||||
if (compilationType == BookmarkManager.COLLECTION)
|
||||
mItemsCollection = BookmarkManager.INSTANCE.getChildrenCollections(mBookmarkCategory.getId());
|
||||
else
|
||||
mItemsCategory = BookmarkManager.INSTANCE.getChildrenCategories(mBookmarkCategory.getId());
|
||||
mItemsCollection = BookmarkManager.INSTANCE.getChildrenCollections(mBookmarkCategory.getId());
|
||||
mItemsCategory = BookmarkManager.INSTANCE.getChildrenCategories(mBookmarkCategory.getId());
|
||||
}
|
||||
|
||||
void show(boolean visible)
|
||||
|
@ -283,7 +287,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
{
|
||||
BookmarkManager.INSTANCE.setChildCategoriesVisibility(mBookmarkCategory.getId(),
|
||||
compilationType, false);
|
||||
updateItemsByType(compilationType);
|
||||
updateAllItems();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
@ -292,7 +296,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
|
|||
{
|
||||
BookmarkManager.INSTANCE.setChildCategoriesVisibility(mBookmarkCategory.getId(),
|
||||
compilationType, true);
|
||||
updateItemsByType(compilationType);
|
||||
updateAllItems();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue