use of com.beloo.widget.chipslayoutmanager.SpacingItemDecoration 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);
}
use of com.beloo.widget.chipslayoutmanager.SpacingItemDecoration in project ChipsLayoutManager by BelooS.
the class TestActivity method initRv.
@UiThread
private void initRv() {
adapter = createAdapter();
RecyclerView.LayoutManager layoutManager = lmFactory.layoutManager(this);
if (layoutManager == null)
Log.e("initRv", "lm manager is null");
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<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, positions);
ArrayAdapter<String> spinnerAdapterMoveTo = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, android.R.id.text1, positions);
spinnerPosition.setAdapter(spinnerAdapter);
spinnerMoveTo.setAdapter(spinnerAdapterMoveTo);
rvTest.setLayoutManager(layoutManager);
// rvTest.setLayoutManager(new LinearLayoutManager(this));
rvTest.getRecycledViewPool().setMaxRecycledViews(0, 10);
rvTest.getRecycledViewPool().setMaxRecycledViews(1, 10);
rvTest.setAdapter(adapter);
}
use of com.beloo.widget.chipslayoutmanager.SpacingItemDecoration 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)));
}
Aggregations