Search in sources :

Example 1 with FlowLayoutManager

use of com.xiaofeng.flowlayoutmanager.FlowLayoutManager 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);
    });
}
Also used : AppliedSortAdapter(com.bluestacks.bugzy.ui.common.AppliedSortAdapter) FlowLayoutManager(com.xiaofeng.flowlayoutmanager.FlowLayoutManager) ItemOffsetDecoration(com.bluestacks.bugzy.ui.common.ItemOffsetDecoration) PopupMenu(android.widget.PopupMenu)

Aggregations

PopupMenu (android.widget.PopupMenu)1 AppliedSortAdapter (com.bluestacks.bugzy.ui.common.AppliedSortAdapter)1 ItemOffsetDecoration (com.bluestacks.bugzy.ui.common.ItemOffsetDecoration)1 FlowLayoutManager (com.xiaofeng.flowlayoutmanager.FlowLayoutManager)1