use of com.kickstarter.ui.adapters.DiscoveryAdapter in project android-oss by kickstarter.
the class DiscoveryFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull final LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
recyclerView = (RecyclerView) inflater.inflate(R.layout.discovery_recycler_view, container, false);
final DiscoveryAdapter adapter = new DiscoveryAdapter(viewModel.inputs);
recyclerView.setAdapter(adapter);
final LinearLayoutManager layoutManager = new LinearLayoutManager(recyclerView.getContext());
recyclerView.setLayoutManager(layoutManager);
recyclerViewPaginator = new RecyclerViewPaginator(recyclerView, viewModel.inputs::nextPage);
viewModel.outputs.activity().compose(bindToLifecycle()).compose(observeForUI()).subscribe(adapter::takeActivity);
viewModel.outputs.projects().compose(bindToLifecycle()).compose(observeForUI()).subscribe(adapter::takeProjects);
viewModel.outputs.shouldShowOnboardingView().compose(bindToLifecycle()).compose(observeForUI()).subscribe(adapter::setShouldShowOnboardingView);
viewModel.outputs.showActivityFeed().compose(bindToLifecycle()).compose(observeForUI()).subscribe(__ -> startActivityFeedActivity());
viewModel.outputs.showActivityUpdate().compose(bindToLifecycle()).compose(observeForUI()).subscribe(this::startActivityUpdateActivity);
viewModel.outputs.showProject().compose(bindToLifecycle()).compose(observeForUI()).subscribe(projectAndRefTag -> this.startProjectActivity(projectAndRefTag.first, projectAndRefTag.second));
viewModel.outputs.showLoginTout().compose(bindToLifecycle()).compose(observeForUI()).subscribe(__ -> this.startLoginToutActivity());
return recyclerView;
}
Aggregations