private void setupFilterList() { LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); filterListView.setLayoutManager(layoutManager); Bitmap image = (BitmapFactory.decodeResource(getResources(), R.drawable.test_image)); adapter = new FiltersAdapter(getActivity().getApplicationContext(), getFilters(), image); adapter.setOnFilterChosenListener(onFilterSelectedListener); filterListView.setAdapter(adapter); int space = (int) getResources().getDimension(R.dimen.content_space) / 2; HorizontalSpaceItemDecoration itemDecoration = new HorizontalSpaceItemDecoration(space, adapter.getItemCount()); filterListView.addItemDecoration(itemDecoration); }
@Override public void onPhotoSelected(Bitmap image) { adapter.setImage(image); }