[android] Fixes after review.

This commit is contained in:
velichkomarija 2020-10-19 14:30:58 +03:00 committed by Alexey
parent 84bfd05dfb
commit fde771280f
2 changed files with 11 additions and 9 deletions

View file

@ -256,7 +256,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
return true;
}
private void updateAllVisibility(@BookmarkManager.CompilationType int compilationType)
private void updateItemsByType(@BookmarkManager.CompilationType int compilationType)
{
if (compilationType == BookmarkManager.COLLECTION)
mItemsCollection = BookmarkManager.INSTANCE.getChildrenCollections(mParentCategoryId);
@ -270,7 +270,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
public void onHideAll(@BookmarkManager.CompilationType int compilationType)
{
BookmarkManager.INSTANCE.setChildCategoriesVisibility(mParentCategoryId, compilationType, false);
updateAllVisibility(compilationType);
updateItemsByType(compilationType);
notifyDataSetChanged();
}
@ -278,7 +278,7 @@ public class BookmarkCollectionAdapter extends RecyclerView.Adapter<RecyclerView
public void onShowAll(@BookmarkManager.CompilationType int compilationType)
{
BookmarkManager.INSTANCE.setChildCategoriesVisibility(mParentCategoryId, compilationType, true);
updateAllVisibility(compilationType);
updateItemsByType(compilationType);
notifyDataSetChanged();
}
}

View file

@ -97,18 +97,21 @@ public class Holders
mButton.setText(showAll
? R.string.bookmarks_groups_show_all
: R.string.bookmarks_groups_hide_all);
mButton.setOnClickListener(new ToggleShowAllChildCategoryClickListener(action, showAll, compilationType));
mButton.setOnClickListener(new ToggleShowAllChildCategoryClickListener(
action, showAll, compilationType));
}
public interface HeaderAction
{
void onHideAll();
void onShowAll();
}
{
void onHideAll();
void onShowAll();
}
public interface HeaderActionChildCategories
{
void onHideAll(@BookmarkManager.CompilationType int compilationType);
void onShowAll(@BookmarkManager.CompilationType int compilationType);
}
@ -132,7 +135,6 @@ public class Holders
{
if (mShowAll)
mAction.onShowAll(mCompilationType);
else
mAction.onHideAll(mCompilationType);
}