use of com.bluestacks.bugzy.ui.common.ItemOffsetDecoration in project bugzy by cpunq.
the class MyCasesFragment method setupSortingView.
public void setupSortingView() {
mAppliedSortingsAdapter = new AppliedSortAdapter(3);
mAppliedSortingsAdapter.setItemClickListener((position, view) -> {
PopupMenu popupMenu = new PopupMenu(getActivity(), view);
popupMenu.setOnMenuItemClickListener(item -> {
if (item.getTitle().equals("Remove")) {
mViewModel.removeSortClicked(position);
} else {
showSortOrderSelectionMenu(view, position);
}
return true;
});
popupMenu.getMenu().add("Replace");
popupMenu.getMenu().add("Remove");
popupMenu.show();
});
FlowLayoutManager manager = new FlowLayoutManager();
manager.setAutoMeasureEnabled(true);
mSortingRecyclerView.setLayoutManager(manager);
mSortingRecyclerView.addItemDecoration(new ItemOffsetDecoration((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, getResources().getDisplayMetrics())));
mSortingRecyclerView.setAdapter(mAppliedSortingsAdapter);
mAppliedSortingsAdapter.setOnAddClickListener(v -> {
showSortOrderSelectionMenu(v, -1);
});
}
Aggregations