Search in sources :

Example 1 with CardListRow

use of cx.ring.tv.cards.CardListRow in project ring-client-android by savoirfairelinux.

the class MainFragment method showContactRequestsRow.

@Override
public void showContactRequestsRow(boolean display) {
    CardListRow row = (CardListRow) mRowsAdapter.get(TRUST_REQUEST_ROW_POSITION);
    boolean isContactRequestRowDisplayed = row.getCardRow().getTitle().equals(getString(R.string.menu_item_contact_request));
    if (display && !isContactRequestRowDisplayed) {
        mRowsAdapter.add(TRUST_REQUEST_ROW_POSITION, createContactRequestRow());
    } else if (!display && isContactRequestRowDisplayed) {
        mRowsAdapter.removeItems(TRUST_REQUEST_ROW_POSITION, 1);
    }
}
Also used : CardListRow(cx.ring.tv.cards.CardListRow)

Example 2 with CardListRow

use of cx.ring.tv.cards.CardListRow in project ring-client-android by savoirfairelinux.

the class MainFragment method createRow.

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);
}
Also used : CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ShadowRowPresenterSelector(cx.ring.tv.cards.ShadowRowPresenterSelector) PresenterSelector(android.support.v17.leanback.widget.PresenterSelector) CardListRow(cx.ring.tv.cards.CardListRow) CardRow(cx.ring.tv.cards.CardRow) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) 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)

Example 3 with CardListRow

use of cx.ring.tv.cards.CardListRow 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)

Example 4 with CardListRow

use of cx.ring.tv.cards.CardListRow in project ring-client-android by savoirfairelinux.

the class MainFragment method createContactRequestRow.

private Row createContactRequestRow() {
    List<Card> cards = new ArrayList<>();
    CardRow contactRequestRow = new CardRow(CardRow.TYPE_DEFAULT, true, getString(R.string.menu_item_contact_request), cards);
    contactRequestRowAdapter = new ArrayObjectAdapter(new CardPresenterSelector(getActivity()));
    return new CardListRow(new HeaderItem(HEADER_MISC, getString(R.string.menu_item_contact_request)), contactRequestRowAdapter, contactRequestRow);
}
Also used : CardListRow(cx.ring.tv.cards.CardListRow) CardRow(cx.ring.tv.cards.CardRow) ArrayList(java.util.ArrayList) CardPresenterSelector(cx.ring.tv.cards.CardPresenterSelector) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) HeaderItem(android.support.v17.leanback.widget.HeaderItem) 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

CardListRow (cx.ring.tv.cards.CardListRow)4 ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)3 HeaderItem (android.support.v17.leanback.widget.HeaderItem)3 Card (cx.ring.tv.cards.Card)3 CardPresenterSelector (cx.ring.tv.cards.CardPresenterSelector)3 CardRow (cx.ring.tv.cards.CardRow)3 ContactRequestCard (cx.ring.tv.cards.contactrequests.ContactRequestCard)3 ContactCard (cx.ring.tv.cards.contacts.ContactCard)3 IconCard (cx.ring.tv.cards.iconcards.IconCard)3 VCard (ezvcard.VCard)3 ShadowRowPresenterSelector (cx.ring.tv.cards.ShadowRowPresenterSelector)2 ArrayList (java.util.ArrayList)2 Intent (android.content.Intent)1 OnItemViewClickedListener (android.support.v17.leanback.widget.OnItemViewClickedListener)1 PresenterSelector (android.support.v17.leanback.widget.PresenterSelector)1 DisplayMetrics (android.util.DisplayMetrics)1