@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pagination); recyclerView = findViewById(R.id.recyclerView); progressBar = findViewById(R.id.progressBar); layoutManager = new LinearLayoutManager(this); layoutManager.setOrientation(RecyclerView.VERTICAL); recyclerView.setLayoutManager(layoutManager); paginationAdapter = new PaginationAdapter(); recyclerView.setAdapter(paginationAdapter); setUpLoadMoreListener(); subscribeForData(); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mRecyclerView = (RecyclerView) getView().findViewById(R.id.list); mEmptyView = getView().findViewById(R.id.empty_view); mLoadingView = getView().findViewById(R.id.progress_indicator); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(layoutManager); mAdapter = new VideoListAdapter(this, getContext()); mRecyclerView.setAdapter(mAdapter); getLoaderManager().initLoader(0, null, this); }
private void loadVideos() { mainActivityBinding.listVideos.setNestedScrollingEnabled(false); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); mainActivityBinding.listVideos.setLayoutManager(linearLayoutManager); mainActivityBinding.listVideos.smoothScrollToPosition(1); VideoListAdapter videoListAdapter = new VideoListAdapter(getApplicationContext(), BaseUtils.getMovieVideos(getApplicationContext())); mainActivityBinding.listVideos.setAdapter(videoListAdapter); }
private void loadCrewDetails() { mainActivityBinding.includedLayout.castList.setNestedScrollingEnabled(false); LinearLayoutManager linearLayoutManager1 = new LinearLayoutManager(this); linearLayoutManager1.setOrientation(LinearLayoutManager.HORIZONTAL); mainActivityBinding.includedLayout.castList.setLayoutManager(linearLayoutManager1); mainActivityBinding.includedLayout.castList.smoothScrollToPosition(1); mainActivityBinding.includedLayout.crewList.setNestedScrollingEnabled(false); LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(this); linearLayoutManager2.setOrientation(LinearLayoutManager.HORIZONTAL); mainActivityBinding.includedLayout.crewList.setLayoutManager(linearLayoutManager2); mainActivityBinding.includedLayout.crewList.smoothScrollToPosition(1); Pair<List<Cast>, List<Crew>> creditPair = BaseUtils.getMovieCast(getApplicationContext()); CastCrewListAdapter creditAdapter = new CastCrewListAdapter(getApplicationContext(), "cast", creditPair.first, null); mainActivityBinding.includedLayout.castList.setAdapter(creditAdapter); CastCrewListAdapter crewAdapter = new CastCrewListAdapter(getApplicationContext(), "crew", null, creditPair.second); mainActivityBinding.includedLayout.crewList.setAdapter(crewAdapter); }
private void loadSimilarMovies() { mainActivityBinding.includedSimilarLayout.moviesList.setNestedScrollingEnabled(false); LinearLayoutManager similarMoviesLayout = new LinearLayoutManager(getApplicationContext()); similarMoviesLayout.setOrientation(LinearLayoutManager.HORIZONTAL); mainActivityBinding.includedSimilarLayout.moviesList.setLayoutManager(similarMoviesLayout); mainActivityBinding.includedSimilarLayout.moviesList.smoothScrollToPosition(1); SimilarMoviesListAdapter movieAdapter = new SimilarMoviesListAdapter(getApplicationContext(), BaseUtils.getMovieList(getApplicationContext())); mainActivityBinding.includedSimilarLayout.moviesList.setAdapter(movieAdapter); }
layoutManager.setOrientation(RecyclerView.VERTICAL); mCardsView.setLayoutManager(layoutManager); mCardsView.setHasFixedSize(true);
instantRecyclerView = findViewById(R.id.instantRecyclerView); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); instantRecyclerView.setLayoutManager(linearLayoutManager); initaliseadapter = new InstantImageAdapter(this);