Search in sources :

Example 1 with ChipsLayoutManager

use of com.beloo.widget.chipslayoutmanager.ChipsLayoutManager in project ChipsLayoutManager by BelooS.

the class ItemsFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);
    adapter = createAdapter(savedInstanceState);
    ChipsLayoutManager spanLayoutManager = ChipsLayoutManager.newBuilder(getContext()).setOrientation(ChipsLayoutManager.HORIZONTAL).build();
    rvTest.addItemDecoration(new SpacingItemDecoration(getResources().getDimensionPixelOffset(R.dimen.item_space), getResources().getDimensionPixelOffset(R.dimen.item_space)));
    positions = new LinkedList<>();
    for (int i = 0; i < items.size(); i++) {
        positions.add(String.valueOf(i));
    }
    ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, android.R.id.text1, positions);
    ArrayAdapter<String> spinnerAdapterMoveTo = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, android.R.id.text1, positions);
    spinnerPosition.setAdapter(spinnerAdapter);
    spinnerMoveTo.setAdapter(spinnerAdapterMoveTo);
    rvTest.setLayoutManager(spanLayoutManager);
    rvTest.getRecycledViewPool().setMaxRecycledViews(0, 10);
    rvTest.getRecycledViewPool().setMaxRecycledViews(1, 10);
    rvTest.setAdapter(adapter);
}
Also used : SpacingItemDecoration(com.beloo.widget.chipslayoutmanager.SpacingItemDecoration) ChipsLayoutManager(com.beloo.widget.chipslayoutmanager.ChipsLayoutManager) ArrayAdapter(android.widget.ArrayAdapter)

Example 2 with ChipsLayoutManager

use of com.beloo.widget.chipslayoutmanager.ChipsLayoutManager in project ChipsLayoutManager by BelooS.

the class BottomSheetDialogFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    //        LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    ChipsLayoutManager layoutManager = ChipsLayoutManager.newBuilder(getContext()).build();
    rvBottomSheet.setLayoutManager(layoutManager);
    rvBottomSheet.setAdapter(createAdapter());
    rvBottomSheet.addItemDecoration(new SpacingItemDecoration(getResources().getDimensionPixelOffset(R.dimen.item_space), getResources().getDimensionPixelOffset(R.dimen.item_space)));
}
Also used : SpacingItemDecoration(com.beloo.widget.chipslayoutmanager.SpacingItemDecoration) ChipsLayoutManager(com.beloo.widget.chipslayoutmanager.ChipsLayoutManager)

Aggregations

ChipsLayoutManager (com.beloo.widget.chipslayoutmanager.ChipsLayoutManager)2 SpacingItemDecoration (com.beloo.widget.chipslayoutmanager.SpacingItemDecoration)2 ArrayAdapter (android.widget.ArrayAdapter)1