use of com.hannesdorfmann.mosby3.sample.mvi.view.ui.GridSpacingItemDecoration in project mosby by sockeqwe.
the class SearchFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_search, container, false);
unbinder = ButterKnife.bind(this, view);
adapter = new SearchAdapter(inflater, this);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), spanCount));
recyclerView.addItemDecoration(new GridSpacingItemDecoration(spanCount, getResources().getDimensionPixelSize(R.dimen.grid_spacing), true));
return view;
}
use of com.hannesdorfmann.mosby3.sample.mvi.view.ui.GridSpacingItemDecoration in project mosby by sockeqwe.
the class HomeFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
unbinder = ButterKnife.bind(this, view);
adapter = new HomeAdapter(inflater, this);
layoutManager = new GridLayoutManager(getActivity(), spanCount);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
int viewType = adapter.getItemViewType(position);
if (viewType == HomeAdapter.VIEW_TYPE_LOADING_MORE_NEXT_PAGE || viewType == HomeAdapter.VIEW_TYPE_SECTION_HEADER) {
return spanCount;
}
return 1;
}
});
recyclerView.addItemDecoration(new GridSpacingItemDecoration(spanCount, getResources().getDimensionPixelSize(R.dimen.grid_spacing), true));
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(layoutManager);
return view;
}
use of com.hannesdorfmann.mosby3.sample.mvi.view.ui.GridSpacingItemDecoration in project mosby by sockeqwe.
the class CategoryFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_category, container, false);
unbinder = ButterKnife.bind(this, view);
GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), spanCount);
adapter = new CategoryAdapter(inflater, this);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new GridSpacingItemDecoration(spanCount, getResources().getDimensionPixelSize(R.dimen.grid_spacing), true));
return view;
}
Aggregations