Search in sources :

Example 16 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project android-UniversalMusicPlayer by googlesamples.

the class TvBrowseFragment method loadRows.

private void loadRows() {
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setAdapter(mRowsAdapter);
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter)

Example 17 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project android-UniversalMusicPlayer by googlesamples.

the class TvPlaybackFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LogHelper.i(TAG, "onCreate");
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mHandler = new Handler();
    mListRowAdapter = new ArrayObjectAdapter(new CardPresenter(getActivity()));
    mPresenterSelector = new ClassPresenterSelector();
    mRowsAdapter = new ArrayObjectAdapter(mPresenterSelector);
    setBackgroundType(BACKGROUND_TYPE);
    setFadingEnabled(false);
}
Also used : Handler(android.os.Handler) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector)

Example 18 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project vlc-android by videolan.

the class SearchFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setSearchResultProvider(this);
    setOnItemViewClickedListener(getDefaultItemClickedListener());
    mDelayedLoad = new SearchRunnable();
    mActivity = getActivity();
    final Intent recognitionIntent = getRecognizerIntent();
    if (Util.isCallable(recognitionIntent)) {
        final SpeechRecognitionCallback speechRecognitionCallback = new SpeechRecognitionCallback() {

            @Override
            public void recognizeSpeech() {
                startActivityForResult(recognitionIntent, REQUEST_SPEECH);
            }
        };
        setSpeechRecognitionCallback(speechRecognitionCallback);
    }
    final Intent intent = mActivity.getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction()) || "com.google.android.gms.actions.SEARCH_ACTION".equals(intent.getAction()))
        onQueryTextSubmit(intent.getStringExtra(SearchManager.QUERY));
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) Intent(android.content.Intent) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) SpeechRecognitionCallback(android.support.v17.leanback.widget.SpeechRecognitionCallback)

Example 19 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project ring-client-android by savoirfairelinux.

the class AboutDetailsFragment method setupUi.

private void setupUi() {
    Bundle extras = getActivity().getIntent().getExtras();
    Card.Type cardType = Card.Type.DEFAULT;
    if (extras != null && extras.containsKey("abouttype")) {
        int ordinal = extras.getInt("abouttype", 0);
        cardType = Card.Type.values()[ordinal];
    }
    IconCard card = IconCardHelper.getAboutCardByType(getActivity(), cardType);
    ClassPresenterSelector selector = new ClassPresenterSelector();
    FullWidthDetailsOverviewRowPresenter rowPresenter = new FullWidthDetailsOverviewRowPresenter(new AboutDetailsPresenter(getActivity())) {

        @Override
        protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent) {
            // Customize Actionbar and Content by using custom colors.
            RowPresenter.ViewHolder viewHolder = super.createRowViewHolder(parent);
            View actionsView = viewHolder.view.findViewById(R.id.details_overview_actions_background);
            actionsView.setBackgroundColor(getActivity().getResources().getColor(R.color.color_primary_dark));
            View detailsView = viewHolder.view.findViewById(R.id.details_frame);
            detailsView.setBackgroundColor(getResources().getColor(R.color.color_primary_dark));
            return viewHolder;
        }
    };
    selector.addClassPresenter(DetailsOverviewRow.class, rowPresenter);
    selector.addClassPresenter(ListRow.class, new ListRowPresenter());
    ArrayObjectAdapter mRowsAdapter = new ArrayObjectAdapter(selector);
    Resources res = getActivity().getResources();
    DetailsOverviewRow detailsOverview = new DetailsOverviewRow(card);
    // Add images and action buttons to the details view
    detailsOverview.setImageDrawable(res.getDrawable(R.drawable.ic_logo_ring_white));
    mRowsAdapter.add(detailsOverview);
    setAdapter(mRowsAdapter);
    initializeBackground();
}
Also used : FullWidthDetailsOverviewRowPresenter(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter) Bundle(android.os.Bundle) ViewGroup(android.view.ViewGroup) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector) View(android.view.View) DetailsOverviewRow(android.support.v17.leanback.widget.DetailsOverviewRow) IconCard(cx.ring.tv.cards.iconcards.IconCard) Card(cx.ring.tv.cards.Card) ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) Resources(android.content.res.Resources) RowPresenter(android.support.v17.leanback.widget.RowPresenter) FullWidthDetailsOverviewRowPresenter(android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter) ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) IconCard(cx.ring.tv.cards.iconcards.IconCard)

Example 20 with ArrayObjectAdapter

use of android.support.v17.leanback.widget.ArrayObjectAdapter in project ring-client-android by savoirfairelinux.

the class MainFragment method setupUIElements.

private void setupUIElements() {
    mBackgroundManager = BackgroundManager.getInstance(getActivity());
    mBackgroundManager.attach(getActivity().getWindow());
    mMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
    // over title
    setHeadersState(HEADERS_ENABLED);
    setHeadersTransitionOnBackEnabled(true);
    // set fastLane (or headers) background color
    setBrandColor(getResources().getColor(R.color.color_primary_dark));
    // set search icon color
    setSearchAffordanceColor(getResources().getColor(R.color.color_primary_light));
    mRowsAdapter = new ArrayObjectAdapter(new ShadowRowPresenterSelector());
    /* Contact Presenter */
    List<Card> cards = new ArrayList<>();
    CardRow contactRow = new CardRow(CardRow.TYPE_DEFAULT, true, getString(R.string.tv_contact_row_header), cards);
    HeaderItem cardPresenterHeader = new HeaderItem(HEADER_CONTACTS, getString(R.string.tv_contact_row_header));
    cardRowAdapter = new ArrayObjectAdapter(new CardPresenterSelector(getActivity()));
    CardListRow contactListRow = new CardListRow(cardPresenterHeader, cardRowAdapter, contactRow);
    /* CardPresenter */
    mRowsAdapter.add(contactListRow);
    mRowsAdapter.add(createMyAccountRow());
    mRowsAdapter.add(createAboutCardRow());
    setAdapter(mRowsAdapter);
    // listeners
    setOnSearchClickedListener(view -> {
        Intent intent = new Intent(getActivity(), SearchActivity.class);
        startActivity(intent);
    });
    setOnItemViewClickedListener(new ItemViewClickedListener());
}
Also used : CardListRow(cx.ring.tv.cards.CardListRow) CardRow(cx.ring.tv.cards.CardRow) OnItemViewClickedListener(android.support.v17.leanback.widget.OnItemViewClickedListener) ArrayList(java.util.ArrayList) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) Intent(android.content.Intent) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ShadowRowPresenterSelector(cx.ring.tv.cards.ShadowRowPresenterSelector) DisplayMetrics(android.util.DisplayMetrics) VCard(ezvcard.VCard) IconCard(cx.ring.tv.cards.iconcards.IconCard) ContactRequestCard(cx.ring.tv.cards.contactrequests.ContactRequestCard) ContactCard(cx.ring.tv.cards.contacts.ContactCard) Card(cx.ring.tv.cards.Card)

Aggregations

ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)33 HeaderItem (android.support.v17.leanback.widget.HeaderItem)16 ListRow (android.support.v17.leanback.widget.ListRow)13 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)13 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)8 Intent (android.content.Intent)5 DetailsOverviewRow (android.support.v17.leanback.widget.DetailsOverviewRow)4 FullWidthDetailsOverviewRowPresenter (android.support.v17.leanback.widget.FullWidthDetailsOverviewRowPresenter)4 Card (cx.ring.tv.cards.Card)4 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)4 ContactCard (cx.ring.tv.cards.contacts.ContactCard)4 IconCard (cx.ring.tv.cards.iconcards.IconCard)4 Activity (android.app.Activity)3 Bundle (android.os.Bundle)3 OnItemViewClickedListener (android.support.v17.leanback.widget.OnItemViewClickedListener)3 VerticalGridPresenter (android.support.v17.leanback.widget.VerticalGridPresenter)3 MediaCardPresenter (butter.droid.tv.presenters.MediaCardPresenter)3 CardListRow (cx.ring.tv.cards.CardListRow)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3