use of com.simplecity.amp_library.utils.ContextualToolbarHelper.Callback in project Shuttle by timusus.
the class QueueFragment method setupContextualToolbar.
private void setupContextualToolbar() {
cabToolbar.getMenu().clear();
cabToolbar.inflateMenu(R.menu.context_menu_queue);
final SubMenu sub = cabToolbar.getMenu().findItem(R.id.queue_add_to_playlist).getSubMenu();
disposables.add(PlaylistUtils.createUpdatingPlaylistMenu(sub).subscribe());
cabToolbar.setOnMenuItemClickListener(MenuUtils.getQueueMenuClickListener(getContext(), Single.fromCallable(() -> cabHelper.getItems()), deleteDialog -> deleteDialog.show(getChildFragmentManager()), () -> {
queuePresenter.removeFromQueue(cabHelper.getItems());
cabHelper.finish();
}, () -> cabHelper.finish()));
cabHelper = new ContextualToolbarHelper<>(cabToolbar, new Callback() {
@Override
public void notifyItemChanged(int position, SelectableViewModel viewModel) {
adapter.notifyItemChanged(position, 0);
}
@Override
public void notifyDatasetChanged() {
adapter.notifyItemRangeChanged(0, adapter.items.size(), 0);
}
});
}
Aggregations