android.support.v17.leanback.widget.ArrayObjectAdapter Java Examples

The following examples show how to use android.support.v17.leanback.widget.ArrayObjectAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoGridExampleFragment.java    From leanback-showcase with Apache License 2.0 7 votes vote down vote up
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);
}
 
Example #2
Source File: PageAndListRowFragment.java    From leanback-showcase with Apache License 2.0 7 votes vote down vote up
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();
        }
    });
}
 
Example #3
Source File: MusicMediaPlayerGlue.java    From leanback-showcase with Apache License 2.0 6 votes vote down vote up
@Override
public void onCurrentItemChanged(MediaMetaData currentMediaItem) {
    if (mPlaybackService == null) {
        // onMetadataChanged updates both the metadata info on the player as well as the progress bar
        onMetadataChanged();
        return;
    }
    setMediaMetaData(currentMediaItem);
    if (mPlaybackService != null) {
        int repeatState = mPlaybackService.getRepeatState();
        int mappedActionIndex = mapServiceRepeatStateToActionIndex(repeatState);
        // if the activity's current repeat state differs from the service's, update it with the
        // repeatState of the service
        if (mRepeatAction.getIndex() != mappedActionIndex) {
            mRepeatAction.setIndex(mappedActionIndex);
            notifyItemChanged((ArrayObjectAdapter)
                    getControlsRow().getSecondaryActionsAdapter(), mRepeatAction);
        }
    }
}
 
Example #4
Source File: GridExampleFragment.java    From leanback-showcase with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: LeanbackBrowseFragment.java    From android-tv-leanback with Apache License 2.0 6 votes vote down vote up
public void init() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setAdapter(mRowsAdapter);

    setBrandColor(ContextCompat.getColor(getContext(), R.color.primary));
    setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi));

    for (int position = 0; position < HEADERS.length; position++) {
        ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter())));
        VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents);
        manager.startDataLoading();

        HeaderItem headerItem = new HeaderItem(position, HEADERS[position]);
        mRowsAdapter.add(new ListRow(headerItem, manager.getItemList()));
    }

    setOnItemViewClickedListener(getDefaultItemViewClickedListener());

}
 
Example #6
Source File: MovieDetailsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
private void setupMovieListRow() {
    String subcategories[] = {getString(R.string.related_movies)};
    HashMap<String, List<Movie>> movies = VideoProvider.getMovieList();

    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
    for (Map.Entry<String, List<Movie>> entry : movies.entrySet()) {
        if (mSelectedMovie.getCategory().indexOf(entry.getKey()) >= 0) {
            List<Movie> list = entry.getValue();
            for (int j = 0; j < list.size(); j++) {
                listRowAdapter.add(list.get(j));
            }
        }
    }
    HeaderItem header = new HeaderItem(0, subcategories[0]);
    mAdapter.add(new ListRow(header, listRowAdapter));
}
 
Example #7
Source File: BrowseFragment.java    From Amphitheatre with Apache License 2.0 6 votes vote down vote up
private void addRecentlyAddedTvShows(List<Video> tvShows, ListRow unMatchedRow) {
    if (!tvShows.isEmpty()) {
        ListRow row = findListRow(getString(R.string.recently_added_tv_episodes));
        if (row != null) {
            ((ArrayObjectAdapter) row.getAdapter()).clear();
            ((ArrayObjectAdapter) row.getAdapter()).addAll(0, tvShows);
        } else {
            ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(mTvShowsCardPresenter);
            listRowAdapter.addAll(0, tvShows);

            HeaderItem header = new HeaderItem(0, getString(R.string.recently_added_tv_episodes), null);
            int index = mAdapter.size() > 1 ? mAdapter.size() - 1 : 0;
            if (unMatchedRow != null) index -= 1;
            mAdapter.add(index, new ListRow(header, listRowAdapter));
        }
    }
}
 
Example #8
Source File: CustomRowsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
@Override
public void onLoadFinished(Loader<HashMap<String, List<Movie>>> arg0,
						   HashMap<String, List<Movie>> data) {

	rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
	CardPresenter cardPresenter = new CardPresenter();

	int i = 0;

	for (Map.Entry<String, List<Movie>> entry : data.entrySet()) {
		ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
		List<Movie> list = entry.getValue();

		for (int j = 0; j < list.size(); j++) {
			listRowAdapter.add(list.get(j));
		}
		HeaderItem header = new HeaderItem(i, entry.getKey());
		i++;
		rowsAdapter.add(new ListRow(header, listRowAdapter));
	}

	setAdapter(rowsAdapter);

	updateRecommendations();
}
 
Example #9
Source File: MoreSamplesFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
private void loadRows() {
    rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());

    HeaderItem gridHeader = new HeaderItem(1, getString(R.string.more_samples));
    GridItemPresenter gridPresenter = new GridItemPresenter(this);

    ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(gridPresenter);
    gridRowAdapter.add(getString(R.string.grid_view));
    gridRowAdapter.add(getString(R.string.guidedstep_first_title));
    gridRowAdapter.add(getString(R.string.error_fragment));
    gridRowAdapter.add(getString(R.string.personal_settings));

    rowsAdapter.add(new ListRow(gridHeader, gridRowAdapter));

    setAdapter(rowsAdapter);
}
 
Example #10
Source File: LeanbackBrowseFragment.java    From android-tv-leanback with Apache License 2.0 6 votes vote down vote up
public void init() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setAdapter(mRowsAdapter);

    setBrandColor(ContextCompat.getColor(getContext(), R.color.primary));
    setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi));

    for (int position = 0; position < HEADERS.length; position++) {
        ObjectAdapter rowContents = new CursorObjectAdapter((new SinglePresenterSelector(new CardPresenter())));
        VideoDataManager manager = new VideoDataManager(getActivity(), getLoaderManager(), VideoItemContract.VideoItem.buildDirUri(), rowContents);
        manager.startDataLoading();

        HeaderItem headerItem = new HeaderItem(position, HEADERS[position]);
        mRowsAdapter.add(new ListRow(headerItem, manager.getItemList()));
    }

    setOnItemViewClickedListener(getDefaultItemViewClickedListener());
    setOnItemViewSelectedListener(getDefaultItemSelectedListener());

    bgHelper = new BackgroundHelper(getActivity());
    bgHelper.prepareBackgroundManager();

}
 
Example #11
Source File: CustomHeadersFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
private void setHeaderAdapter() {
	adapter = new ArrayObjectAdapter();

	LinkedHashMap<Integer, Fragment> fragments = ((MainActivity) getActivity()).getFragments();

	int id = 0;
	for (int i = 0; i < fragments.size(); i++) {
		HeaderItem header = new HeaderItem(id, "Category " + i);
		ArrayObjectAdapter innerAdapter = new ArrayObjectAdapter();
		innerAdapter.add(fragments.get(i));
		adapter.add(id, new ListRow(header, innerAdapter));
		id++;
	}

	setAdapter(adapter);
}
 
Example #12
Source File: CustomHeadersFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
private void setHeaderAdapter() {
	adapter = new ArrayObjectAdapter();

	LinkedHashMap<Integer, CustomRowsFragment> fragments = ((TVDemoActivity) getActivity()).getFragments();

	int id = 0;
	for (int i = 0; i < fragments.size(); i++) {
		HeaderItem header = new HeaderItem(id, "Category " + i, null);
		ArrayObjectAdapter innerAdapter = new ArrayObjectAdapter();
		innerAdapter.add(fragments.get(i));
		adapter.add(id, new ListRow(header, innerAdapter));
		id++;
	}

	setAdapter(adapter);
}
 
Example #13
Source File: PageAndListRowFragment.java    From leanback-showcase with Apache License 2.0 6 votes vote down vote up
public SampleFragmentB() {
    mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());

    setAdapter(mRowsAdapter);
    setOnItemViewClickedListener(new OnItemViewClickedListener() {
        @Override
        public void onItemClicked(
                Presenter.ViewHolder itemViewHolder,
                Object item,
                RowPresenter.ViewHolder rowViewHolder,
                Row row) {
            Toast.makeText(getActivity(), "Implement click handler", Toast.LENGTH_SHORT)
                    .show();
        }
    });
}
 
Example #14
Source File: MainFragment.java    From TuentiTV with Apache License 2.0 6 votes vote down vote up
@Override public void showMainInformation(List<CardInfo> favorites, List<CardInfo> conversations,
    List<CardInfo> contacts, List<ImageInfo> mediaElements, List<IconInfo> preferences) {
  ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
  CardPresenter bigCardPresenter = new CardPresenter(CARD_WIDTH_IN_DP, CARD_HEIGHT_IN_DP);
  CardPresenter smallCarPresenter = new CardPresenter();

  addCardInfoElementsToRowsAdapter(R.string.favorites_item_title, favorites, rowsAdapter,
      smallCarPresenter, FAVORITES_ROW);
  addCardInfoElementsToRowsAdapter(R.string.recent_conversation_item_title, conversations,
      rowsAdapter, bigCardPresenter, CONVERSATIONS_ROW);
  addCardInfoElementsToRowsAdapter(R.string.contacts_item_title, contacts, rowsAdapter,
      smallCarPresenter, CONTACTS_ROW);
  addImageInfoElementsToRowAdapter(R.string.media_elements_item_title, mediaElements, rowsAdapter,
      new ImagePresenter(), MEDIA_ROW);
  addIconInfoElementsToRowAdapter(getResources().getString(R.string.preferences), preferences,
      rowsAdapter, new IconPresenter(), PREFERENCES_ROW);

  setAdapter(rowsAdapter);
}
 
Example #15
Source File: CustomRowsFragment.java    From BuildingForAndroidTV with MIT License 6 votes vote down vote up
private void loadRows() {
	rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
	cardPresenter = new CardPresenter();

	List<Movie> list = MovieList.setupMovies();

	int i;
	for (i = 0; i < NUM_ROWS; i++) {
		if (i != 0) {
			Collections.shuffle(list);
		}
		ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(cardPresenter);
		for (int j = 0; j < NUM_COLS; j++) {
			listRowAdapter.add(list.get(j % 5));
		}
		HeaderItem header = new HeaderItem(i, MovieList.MOVIE_CATEGORY[i], null);
		rowsAdapter.add(new ListRow(header, listRowAdapter));
	}

	setAdapter(rowsAdapter);
}
 
Example #16
Source File: MainFragment.java    From leanback-assistant with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #17
Source File: PageAndListRowFragment.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
private ListRow createCardRow(CardRow cardRow) {
    SettingsIconPresenter iconCardPresenter = new SettingsIconPresenter(getActivity());
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(iconCardPresenter);
    for(Card card : cardRow.getCards()) {
        adapter.add(card);
    }

    HeaderItem headerItem = new HeaderItem(cardRow.getTitle());
    return new CardListRow(headerItem, adapter, cardRow);
}
 
Example #18
Source File: PageAndListRowFragment.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
private Row createCardRow(CardRow cardRow) {
    PresenterSelector presenterSelector = new CardPresenterSelector(getActivity());
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
    for (Card card : cardRow.getCards()) {
        adapter.add(card);
    }

    HeaderItem headerItem = new HeaderItem(cardRow.getTitle());
    return new CardListRow(headerItem, adapter, cardRow);
}
 
Example #19
Source File: PlaybackOverlayFragment.java    From android-tv-leanback with Apache License 2.0 5 votes vote down vote up
private void notifyChanged(Action action) {
    ArrayObjectAdapter adapter = mPrimaryActionsAdapter;
    if (adapter.indexOf(action) >= 0) {
        adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
        return;
    }
    adapter = mSecondaryActionsAdapter;
    if (adapter.indexOf(action) >= 0) {
        adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1);
        return;
    }
}
 
Example #20
Source File: PlaybackOverlayFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
private void addOtherRows() {
    ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
    for (Movie movie : mItems) {
        listRowAdapter.add(movie);
    }
    HeaderItem header = new HeaderItem(0, getString(R.string.related_movies));
    mRowsAdapter.add(new ListRow(header, listRowAdapter));

}
 
Example #21
Source File: DetailViewExampleWithVideoBackgroundFragment.java    From leanback-showcase with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent returnIntent) {
    if (requestCode == DetailViewExampleWithVideoBackgroundActivity.BUY_MOVIE_REQUEST) {
        if (resultCode == Activity.RESULT_OK) {
            ArrayObjectAdapter actionAdapter = (ArrayObjectAdapter)
                    ((DetailsOverviewRow) getAdapter().get(0)).getActionsAdapter();

            actionAdapter.add(0, mActionPlay);
            actionAdapter.remove(mActionRent);
            setTitle(getTitle() + " (Owned)");

            boolean watchNow = returnIntent
                    .getBooleanExtra(WizardExampleActivity.WATCH_NOW,
                            false);

            if (watchNow) {
                // Leave a delay for playing the video in order to focus on the video fragment
                // after coming back from Wizard activity
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        playMainVideoOnBackground();
                    }
                }, 500);
            }
        }
    }
}
 
Example #22
Source File: LeanbackBrowseFragment.java    From android-tv-leanback with Apache License 2.0 5 votes vote down vote up
public void init() {
    mRowsAdapter = new ArrayObjectAdapter();
    setAdapter(mRowsAdapter);

    setBrandColor(ContextCompat.getColor(getContext(), R.color.primary));
    setBadgeDrawable(ContextCompat.getDrawable(getContext(), R.drawable.filmi));
}
 
Example #23
Source File: MainFragment.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
private void setupPreferences( ArrayObjectAdapter adapter ) {

        HeaderItem gridHeader = new HeaderItem( adapter.size(), "Preferences", null );
        PreferenceCardPresenter mGridPresenter = new PreferenceCardPresenter();
        ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter( mGridPresenter );
        gridRowAdapter.add( getResources().getString( R.string.sloth ) );
        adapter.add( new ListRow( gridHeader, gridRowAdapter ) );

    }
 
Example #24
Source File: GridFragment.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #25
Source File: TVSearchFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
@Override
public void run() {
	// you should fetch your data here and update the adapter
	// accordingly
	mRowsAdapter.clear();
	ArrayObjectAdapter adapter = new ArrayObjectAdapter(new CardPresenter());
	adapter.addAll(0, MovieList.list);
	HeaderItem header = new HeaderItem(0, getResources().getString(R.string.search_results), null);
	mRowsAdapter.add(new ListRow(header, adapter));
}
 
Example #26
Source File: DetailFragment.java    From TuentiTV with Apache License 2.0 5 votes vote down vote up
@Override public void showCardInfo(final CardInfo cardInfo) {
  new AsyncTask<Void, Void, Bitmap>() {

    @Override protected Bitmap doInBackground(Void... params) {
      Bitmap detailImage = null;
      try {
        detailImage = Picasso.with(getActivity())
            .load(cardInfo.getCardImageUrl())
            .placeholder(R.drawable.icn_wink)
            .error(R.drawable.icn_wink)
            .resize(Util.convertDpToPixel(getActivity(), DETAIL_THUMB_WIDTH),
                Util.convertDpToPixel(getActivity(), DETAIL_THUMB_HEIGHT))
            .centerCrop()
            .get();
      } catch (IOException e) {
        //Empty
      }
      return detailImage;
    }

    @Override protected void onPostExecute(Bitmap bitmap) {
      DetailsOverviewRow detailRow = configureDetailsOverviewRow(cardInfo, bitmap);
      ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
      DetailsOverviewRowPresenter dorPresenter =
          new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
      dorPresenter.setBackgroundColor(getResources().getColor(R.color.primary_color));
      dorPresenter.setStyleLarge(false);
      presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
      presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
      adapter = new ArrayObjectAdapter(presenterSelector);
      adapter.add(detailRow);
      setAdapter(adapter);
    }
  }.execute();
}
 
Example #27
Source File: MainFragment.java    From TuentiTV with Apache License 2.0 5 votes vote down vote up
private void addCardInfoElementsToRowsAdapter(int title, List<CardInfo> elements,
    ArrayObjectAdapter rowsAdapter, Presenter presenter, int id) {
  ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenter);
  for (Object element : elements) {
    listRowAdapter.add(element);
  }
  HeaderItem header = new HeaderItem(id, getString(title), null);
  rowsAdapter.add(new ListRow(header, listRowAdapter));
}
 
Example #28
Source File: MainFragment.java    From TuentiTV with Apache License 2.0 5 votes vote down vote up
private void addImageInfoElementsToRowAdapter(int title, List<ImageInfo> elements,
    ArrayObjectAdapter rowsAdapter, Presenter presenter, int id) {
  ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenter);
  for (Object element : elements) {
    listRowAdapter.add(element);
  }
  HeaderItem header = new HeaderItem(id, getString(title), null);
  rowsAdapter.add(new ListRow(header, listRowAdapter));
}
 
Example #29
Source File: SearchFragment.java    From TuentiTV with Apache License 2.0 5 votes vote down vote up
@Override public void showAllContacts(List<Contact> contacts) {
  ArrayObjectAdapter arrayObjectAdapter = new ArrayObjectAdapter(new CardPresenter());
  for (Contact contact : contacts) {
    arrayObjectAdapter.add(contact);
  }
  HeaderItem headerItem = new HeaderItem(getString(R.string.contacts_item_title), "");
  rowsAdapter.add(new ListRow(headerItem, arrayObjectAdapter));
}
 
Example #30
Source File: VerticalGridFragment.java    From BuildingForAndroidTV with MIT License 5 votes vote down vote up
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());
}