private void setupUIElements() { setBadgeDrawable( getActivity().getResources().getDrawable(R.drawable.nejcz, null)); setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); // Set fastLane (or headers) background color setBrandColor(ContextCompat.getColor(getActivity(), R.color.fastlane_background)); // Set search icon color. setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new IconHeaderItemPresenter(); } }); }
private void setupUIElements() { setBadgeDrawable( getActivity().getResources().getDrawable(R.drawable.app_icon_chilly_transparent, null)); setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title setHeadersState(HEADERS_DISABLED); setHeadersTransitionOnBackEnabled(true); // Set fastLane (or headers) background color setBrandColor(ContextCompat.getColor(getActivity(), R.color.fastlane_background)); // Set search icon color. setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new IconHeaderItemPresenter(); } }); }
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); }
public CardAdapter(Context context) { mLoadingPresenter = new LoadingPresenter(); mIconItemPresenter = new IconItemPresenter(); mTagItemPresenter = new TagItemPresenter(); mLiveCardPresenter = new LiveCardPresenter(context); setPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object item) { if (item instanceof LoadingCardView) { return mLoadingPresenter; } else if (item instanceof IconCardView) { return mIconItemPresenter; } else if (item instanceof TagCardView) { return mTagItemPresenter; } else if (item instanceof Post) { return mLiveCardPresenter; } return null; } }); }
private void setupSecondaryRowPlaybackControl(@NonNull PresenterSelector presenterSelector) { mSecondaryActionsAdapter = new ArrayObjectAdapter(presenterSelector); mPlaybackControlsRow.setSecondaryActionsAdapter(mSecondaryActionsAdapter); Activity activity = getActivity(); mScaleVideoAction = new ScaleVideoAction(activity); mClosedCaptioningAction = new ClosedCaptioningAction(activity); mClosedCaptioningAction.setIcon(getResources().getDrawable(R.drawable.ic_av_subs, null)); if (mStreamInfo!= null && mStreamInfo.getSubtitleLanguage() != null && !mStreamInfo.getSubtitleLanguage().equals(SubsProvider.SUBTITLE_LANGUAGE_NONE)) { mClosedCaptioningAction.setIndex(ClosedCaptioningAction.ON); } else { mClosedCaptioningAction.setIndex(ClosedCaptioningAction.OFF); } // Add rest of controls to secondary adapter. mSecondaryActionsAdapter.add(mScaleVideoAction); if(mSubsButtonEnabled) mSecondaryActionsAdapter.add(mClosedCaptioningAction); }
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 Row createCardRow(final CardRow cardRow) { switch (cardRow.getType()) { case CardRow.TYPE_SECTION_HEADER: return new SectionRow(new HeaderItem(cardRow.getTitle())); case CardRow.TYPE_DIVIDER: return new DividerRow(); case CardRow.TYPE_DEFAULT: default: // Build main row using the ImageCardViewPresenter. PresenterSelector presenterSelector = new CardPresenterSelector(getActivity()); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector); for (Card card : cardRow.getCards()) { listRowAdapter.add(card); } return new CardListRow(new HeaderItem(cardRow.getTitle()), listRowAdapter, cardRow); } }
@Provides @PerFragment public FullWidthDetailsOverviewSharedElementHelper provideHelper(Activity activity, PresenterSelector mPs, DetailsOverviewRow row, OnActionClickedListener listener) { FullWidthDetailsOverviewSharedElementHelper mHelper = new FullWidthDetailsOverviewSharedElementHelper(); mHelper.setSharedElementEnterTransition(activity, LiveDataDetailActivity.SHARED_ELEMENT_NAME); ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row)) .setListener(mHelper); ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row)) .setParticipatingEntranceTransition(false); ((FullWidthDetailsOverviewRowPresenter) mPs.getPresenter(row)) .setOnActionClickedListener(listener); return mHelper; }
@PerFragment @Provides PresenterSelector providePresenterSelector(final Map<Class<?>, Presenter> map) { return new PresenterSelector() { @Override public Presenter getPresenter(Object item) { Class<?> cls = item.getClass(); return map.get(cls); } @Override public Presenter[] getPresenters() { return map.values().toArray(new Presenter[map.size()]); } }; }
private void setupUIElements() { setBadgeDrawable( getActivity().getResources().getDrawable(R.drawable.videos_by_google_banner, null)); setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); // Set fastLane (or headers) background color setBrandColor(ContextCompat.getColor(getActivity(), R.color.fastlane_background)); // Set search icon color. setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.search_opaque)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new IconHeaderItemPresenter(); } }); }
private void setupUIElements() { setBadgeDrawable(getActivity().getResources().getDrawable(R.drawable.videos_by_google_banner)); setTitle(getString(R.string.browse_title)); // Badge, when set, takes precedent over title setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); // set fastLane (or headers) background color setBrandColor(getResources().getColor(R.color.fastlane_background)); // set search icon color setSearchAffordanceColor(getResources().getColor(R.color.search_opaque)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new IconHeaderItemPresenter(); } }); }
@Override protected PresenterSelector onCreatePresenterSelector( DetailsOverviewRowPresenter rowPresenter) { ClassPresenterSelector presenterSelector = new ClassPresenterSelector(); presenterSelector.addClassPresenter(DetailsOverviewRow.class, rowPresenter); presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter()); return presenterSelector; }
/** * Creates and returns presenter selector will be used by rows adaptor. */ protected PresenterSelector onCreatePresenterSelector( DetailsOverviewRowPresenter rowPresenter) { ClassPresenterSelector presenterSelector = new ClassPresenterSelector(); presenterSelector.addClassPresenter(DetailsOverviewRow.class, rowPresenter); return presenterSelector; }
private void setupUIElements() { setTitle(getString(R.string.app_name)); setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); setBrandColor(ContextCompat.getColor(getActivity(), R.color.primary)); setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.accent)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new HeaderItemPresenter(); } }); }
public OptionsAdapter(Context context) { mOptionsItemPresenter = new IconItemPresenter(); setPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object item) { return mOptionsItemPresenter; } }); }
public PostAdapter(Context context) { mOptionsItemPresenter = new LiveCardPresenter(context); setPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object item) { return mOptionsItemPresenter; } }); }
@Override public void configureItemHeader(int numberOfCategories) { if(numberOfCategories > 5) { setBrandColor(getResources().getColor(R.color.primary_brand)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object item) { return new HeaderItemPresenter(); } }); } else { setHeadersState(HEADERS_DISABLED); } }
private ListRow createCardRow(CardRow cardRow) { PresenterSelector presenterSelector = new CardPresenterSelector(getActivity()); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector); for (Card card : cardRow.getCards()) { listRowAdapter.add(card); } return new ListRow(listRowAdapter); }
@DetailFragmentArrayObjectAdapterForRowsQualifier @PerFragment @Provides ArrayObjectAdapter provideRowsArrayObjectAdapter(DetailsOverviewRow detailsOverviewRow, ListRow relatedRow, PresenterSelector mps) { ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(mps); rowsAdapter.add(detailsOverviewRow); rowsAdapter.add(relatedRow); return rowsAdapter; }
@SearchFragmentArrayObjectAdapterForRowsQualifier @PerFragment @Provides ArrayObjectAdapter provideRowsArrayObjectAdapterInSearchFragment( ListRow relatedRow, PresenterSelector mps) { ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(mps.getPresenter(relatedRow)); rowsAdapter.add(relatedRow); return rowsAdapter; }
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); }
private void setupUIElements() { setBadgeDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.banner_shadow)); setHeadersState(HEADERS_ENABLED); setHeadersTransitionOnBackEnabled(true); setBrandColor(ContextCompat.getColor(getActivity(), R.color.primary)); setSearchAffordanceColor(ContextCompat.getColor(getActivity(), R.color.accent)); setHeaderPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object o) { return new IconHeaderItemPresenter(); } }); boolean shouldAutoLoop = mPreferencesHelper.getShouldAutoLoop(); String optionValue = shouldAutoLoop ? getString(R.string.text_auto_loop_enabled) : getString(R.string.text_auto_loop_disabled); mAutoLoopOption = new Option( getString(R.string.text_auto_loop_title), optionValue, R.drawable.lopp); HeaderItem gridHeader = new HeaderItem(mRowsAdapter.size(), getString(R.string.header_text_options)); mOptionsAdapter = new OptionsAdapter(getActivity()); mOptionsAdapter.addOption(mAutoLoopOption); mRowsAdapter.add(new ListRow(gridHeader, mOptionsAdapter)); }
public void setPresenterSelector() { setPresenterSelector(new PresenterSelector() { @Override public Presenter getPresenter(Object item) { if (item instanceof LoadingCardView) { return mLoadingPresenter; } else if (item instanceof Option) { return mIconItemPresenter; } return mPresenter; } }); }
private Row createRow(String titleSection, List<Card> cards, boolean shadow) { CardRow row = new CardRow( CardRow.TYPE_DEFAULT, shadow, titleSection, cards); PresenterSelector presenterSelector = new CardPresenterSelector(getActivity()); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(presenterSelector); for (Card card : cards) { listRowAdapter.add(card); } return new CardListRow(new HeaderItem(HEADER_MISC, titleSection), listRowAdapter, row); }
/** * Sets the {@link PresenterSelector} used to render the row headers. * * @param headerPresenterSelector The PresenterSelector that will determine * the Presenter for each row header. */ public void setHeaderPresenterSelector(PresenterSelector headerPresenterSelector) { mHeaderPresenterSelector = headerPresenterSelector; if (mHeadersFragment != null) { mHeadersFragment.setPresenterSelector(mHeaderPresenterSelector); } }
/** * Sets the {@link PresenterSelector} used to render the row headers. * * @param headerPresenterSelector The PresenterSelector that will determine * the Presenter for each row header. */ public void setHeaderPresenterSelector(PresenterSelector headerPresenterSelector) { mHeaderPresenterSelector = headerPresenterSelector; if (mHeadersSupportFragment != null) { mHeadersSupportFragment.setPresenterSelector(mHeaderPresenterSelector); } }
SeasonRowAdapter(PresenterSelector selector, Comparator<RecordedProgram> comparator, String seasonNumber) { super(selector, comparator); mSeasonNumber = seasonNumber; }
SortedArrayAdapter(PresenterSelector presenterSelector, Comparator<T> comparator) { this(presenterSelector, comparator, Integer.MAX_VALUE); }
SortedArrayAdapter(PresenterSelector presenterSelector, Comparator<T> comparator, int maxItemCount) { super(presenterSelector); mComparator = comparator; mMaxItemCount = maxItemCount; }
protected ArrayObjectAdapter createAdapter(PresenterSelector selector) { return new ArrayObjectAdapter(selector); }
@Override protected ArrayObjectAdapter createAdapter(PresenterSelector selector) { return new ArrayObjectAdapter(selector); }
@ListAdapterForRelatedRowQualifier @PerFragment @Provides ListAdapter<VideoEntity> provideRelatedAdapter(PresenterSelector mps) { return new ListAdapter<>(mps.getPresenter(new VideoEntity())); }
/** * Constructs an adapter with the given {@link PresenterSelector}. */ public ListAdapter(PresenterSelector presenterSelector) { super(presenterSelector); }
public BaseArrayAdapter(PresenterSelector selector) { super(selector); }
public SortedObjectAdapter(Comparator comparator, PresenterSelector presenterSelector) { super(presenterSelector); mSortedItems = new TreeSet<Object>(comparator); }