private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); getLoaderManager().initLoader(ALL_VIDEOS_LOADER, null, this); // After 500ms, start the animation to transition the cards into view. new Handler().postDelayed(new Runnable() { public void run() { startEntranceTransition(); } }, 500); setOnSearchClickedListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), SearchActivity.class); startActivity(intent); } }); setOnItemViewClickedListener(new ItemViewClickedListener()); setOnItemViewSelectedListener(new ItemViewSelectedListener()); }
/** * Sets the grid presenter. */ public void setGridPresenter(VerticalGridPresenter gridPresenter) { if (gridPresenter == null) { throw new IllegalArgumentException("Grid presenter may not be null"); } mGridPresenter = gridPresenter; mGridPresenter.setOnItemViewSelectedListener(mViewSelectedListener); if (mOnItemViewClickedListener != null) { mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener); } // ARCHOS ADDED: update the number of columns in case the GridView is already created if (mGridViewHolder!=null) { mGridViewHolder.getGridView().setNumColumns(gridPresenter.getNumberOfColumns()); } }
private void setupRowAdapter() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(ZOOM_FACTOR); gridPresenter.setNumberOfColumns(COLUMNS); setGridPresenter(gridPresenter); PresenterSelector cardPresenterSelector = new CardPresenterSelector(getActivity()); mAdapter = new ArrayObjectAdapter(cardPresenterSelector); setAdapter(mAdapter); prepareEntranceTransition(); new Handler().postDelayed(new Runnable() { @Override public void run() { createRows(); startEntranceTransition(); } }, 1000); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ArrayObjectAdapter mRowAdapter = new ArrayObjectAdapter(new VideoCardViewPresenter(getContext())); setAdapter(mRowAdapter); setTitle(getString(R.string.assistant_playback_videos)); setBadgeDrawable( getActivity().getResources().getDrawable(R.drawable.assistant_tv_banner, null)); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); for (Movie movie : MockDatabase.getAllMovies()) { mRowAdapter.add(movie); } setOnItemViewClickedListener(new ItemViewClickedListener()); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(FocusHighlight.ZOOM_FACTOR_SMALL); gridPresenter.setNumberOfColumns(numColumns); //gridPresenter.setShadowEnabled(false); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new CardPresenter()); List<Contact> contacts = ContactProvider.getContactList(); mAdapter.addAll(0, contacts); setAdapter(mAdapter); setOnItemViewClickedListener(new ItemViewClickedListener()); setOnItemViewSelectedListener(new ItemViewSelectedListener()); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(FocusHighlight.ZOOM_FACTOR_NONE); gridPresenter.setNumberOfColumns(numColumns); //gridPresenter.setShadowEnabled(false); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new ContactPresenter()); List<Contact> contacts = ContactProvider.getContactList(); mAdapter.addAll(0, contacts); setAdapter(mAdapter); setOnItemViewClickedListener(new ItemViewClickedListener()); setOnItemViewSelectedListener(new ItemViewSelectedListener()); }
@Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "onCreate"); super.onCreate(savedInstanceState); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(FocusHighlight.ZOOM_FACTOR_MEDIUM); gridPresenter.setNumberOfColumns(4); setGridPresenter(gridPresenter); setOnItemViewClickedListener(this); setOnItemViewSelectedListener(this); backgroundManager = ((MainActivity) getActivity()).getBackgroundManager(); metrics = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); mainHandler = new Handler(getContext().getMainLooper()); }
private void setupRowAdapter() { VerticalGridPresenter videoGridPresenter = new VerticalGridPresenter(ZOOM_FACTOR); videoGridPresenter.setNumberOfColumns(COLUMNS); // note: The click listeners must be called before setGridPresenter for the event listeners // to be properly registered on the viewholders. setOnItemViewSelectedListener(this); setOnItemViewClickedListener(this); setGridPresenter(videoGridPresenter); PresenterSelector cardPresenterSelector = new CardPresenterSelector(getActivity()); // VideoCardViewPresenter videoCardViewPresenter = new VideoCardViewPresenter(getActivity()); mAdapter = new ArrayObjectAdapter(cardPresenterSelector); setAdapter(mAdapter); prepareEntranceTransition(); new Handler().postDelayed(new Runnable() { @Override public void run() { createRows(); } }, 1000); }
private void setupAdapter() { VerticalGridPresenter presenter = new VerticalGridPresenter(ZOOM_FACTOR); presenter.setNumberOfColumns(COLUMNS); setGridPresenter(presenter); CardPresenterSelector cardPresenter = new CardPresenterSelector(getActivity()); mAdapter = new ArrayObjectAdapter(cardPresenter); setAdapter(mAdapter); setOnItemViewClickedListener(new OnItemViewClickedListener() { @Override public void onItemClicked( Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { Card card = (Card)item; Toast.makeText(getActivity(), "Clicked on "+card.getTitle(), Toast.LENGTH_SHORT).show(); } }); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(isFilm ? FILM_COLUMNS : SHOW_COLUMNS); setGridPresenter(gridPresenter); setTitle(Utils.stripCategory(category)); List<EpisodeBaseModel> all = getContentManger().getAllShowsByCategory(category); ArrayObjectAdapter adapter; if (isFilm) { adapter = new ArrayObjectAdapter(new FilmPresenter(true)); } else { adapter = new ArrayObjectAdapter(new EpisodePresenter()); } adapter.addAll(0, all); setAdapter(adapter); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); mHandler = new Handler(); setOnSearchClickedListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(SearchActivity.getStartIntent(getActivity())); } }); setOnItemViewClickedListener(mOnItemViewClickedListener); setOnItemViewSelectedListener(mOnItemViewSelectedListener); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((LeanbackBaseActivity) getActivity()).getApiServiceObservable() .subscribe(mediaApiService -> { mediaApiService.getConferences() .observeOn(AndroidSchedulers.mainThread()) .subscribe(conferences -> { List<Conference> conferenceList = conferences.getConferences(); Collections.sort(conferenceList); Collections.reverse(conferenceList); mConferenceAdapter.addAll(0, conferenceList); setAdapter(mConferenceAdapter); }); }); setTitle("Chaosflix"); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); // After 500ms, start the animation to transition the cards into view. new Handler().postDelayed(new Runnable() { public void run() { startEntranceTransition(); } }, 500); setOnItemViewClickedListener(new ItemViewClickedListener(this)); }
private VerticalGridPresenter buildGridPresenter() { final int zoom; final boolean focusDimmer; final int numberOfColumns; final boolean shadowEnabled; switch (mDisplayMode) { case GRID: zoom = FocusHighlight.ZOOM_FACTOR_LARGE; focusDimmer = false; numberOfColumns = 6; shadowEnabled = true; break; case LIST: zoom = FocusHighlight.ZOOM_FACTOR_SMALL; focusDimmer = false; numberOfColumns = 1; shadowEnabled = true; break; default: throw new IllegalArgumentException("Invalid Display Mode! "+mDisplayMode); } VerticalGridPresenter vgp = new VerticalGridPresenter(zoom, focusDimmer); vgp.setNumberOfColumns(numberOfColumns); vgp.setShadowEnabled(shadowEnabled); return vgp; }
private void setupFragment() { //setup background updater mBackgroundUpdater = new BackgroundUpdater(); mBackgroundUpdater.initialise(getActivity(), R.color.black); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new MediaCardPresenter(getActivity())); setAdapter(mAdapter); setOnItemViewClickedListener(this); setOnItemViewSelectedListener(this); }
/** * Sets the grid presenter. */ public void setGridPresenter(VerticalGridPresenter gridPresenter) { if (gridPresenter == null) { throw new IllegalArgumentException("Grid presenter may not be null"); } mGridPresenter = gridPresenter; mGridPresenter.setOnItemViewSelectedListener(mViewSelectedListener); if (mOnItemViewClickedListener != null) { mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener); } }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new CardPresenter()); setAdapter(mAdapter); setOnItemViewClickedListener(new ItemViewClickedListener()); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new CardPresenter(getActivity())); setAdapter(mAdapter); setOnItemViewClickedListener(new ItemViewClickedListener()); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = getActivity(); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new CardPresenter(mContext)); mAdapter.clear(); setAdapter(mAdapter); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); BusProvider.getInstance().register(this); }
/** * Sets the grid presenter. */ public void setGridPresenter(VerticalGridPresenter gridPresenter) { if (gridPresenter == null) { throw new IllegalArgumentException("Grid presenter may not be null"); } mGridPresenter = gridPresenter; mGridPresenter.setOnItemViewSelectedListener(mRowSelectedListener); if (mOnItemViewClickedListener != null) { mGridPresenter.setOnItemViewClickedListener(mOnItemViewClickedListener); } if (mOnItemClickedListener != null) { mGridPresenter.setOnItemClickedListener(mOnItemClickedListener); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); VerticalGridPresenter presenter = new VerticalGridPresenter(); presenter.setNumberOfColumns(3); setGridPresenter(presenter); loadRows(); }
private void setupFragment() { VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(NUM_COLUMNS); setGridPresenter(gridPresenter); mAdapter = new ArrayObjectAdapter(new CardPresenter()); long seed = System.nanoTime(); HashMap<String, List<Movie>> movies = VideoProvider.getMovieList(); for (Map.Entry<String, List<Movie>> entry : movies.entrySet()) { List<Movie> list = entry.getValue(); Collections.shuffle(list, new Random(seed)); for (Movie movie : list) { mAdapter.add(movie); } } setAdapter(mAdapter); setOnSearchClickedListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), SearchActivity.class); startActivity(intent); } }); setOnItemViewClickedListener(new ItemViewClickedListener()); setOnItemViewSelectedListener(new ItemViewSelectedListener()); }
/** * Returns the grid presenter. */ public VerticalGridPresenter getGridPresenter() { return mGridPresenter; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSpinnerFragment = new SpinnerFragment(); // getFragmentManager().beginTransaction().add(R.id.vertical_grid_fragment, mSpinnerFragment).commit(); // mVideoCursorAdapter.setMapper(new VideoCursorMapper()); // setAdapter(mVideoCursorAdapter); mSelectedShow = (Video) getActivity().getIntent() .getParcelableExtra("show"); mSelectedSeason = (Video) getActivity().getIntent() .getParcelableExtra("season"); CardPresenter cp = new CardPresenter(getActivity()); VerticalGridPresenter gridPresenter = new VerticalGridPresenter(); gridPresenter.setNumberOfColumns(5); elem = (ListElem) getActivity().getIntent().getParcelableExtra("listElem"); if(mSelectedShow != null && mSelectedSeason != null) { cp.isEpisode = true; gridPresenter.setNumberOfColumns(4); setTitle(mSelectedShow.title + ": " + mSelectedSeason.title); elem = new ListElem(); elem.tvshow = mSelectedShow; elem.season = mSelectedSeason; } else { setTitle(elem.videoType.toUpperCase() + "S: " + elem.title); } mVideoAdapter = new ArrayObjectAdapter(cp); setAdapter(mVideoAdapter); setGridPresenter(gridPresenter); if (savedInstanceState == null) { prepareEntranceTransition(); } setupFragment(); }