mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-26 14:10:23 +00:00
Leanback: add chaosflixEventAdapter
This commit is contained in:
parent
1822ed8bfe
commit
efc2a42b62
2 changed files with 32 additions and 9 deletions
|
@ -0,0 +1,21 @@
|
||||||
|
package de.nicidienase.chaosflix.leanback
|
||||||
|
|
||||||
|
import android.support.v17.leanback.widget.ArrayObjectAdapter
|
||||||
|
import android.support.v17.leanback.widget.Presenter
|
||||||
|
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.PersistentEvent
|
||||||
|
|
||||||
|
class ChaosflixEventAdapter(presenter: Presenter): ArrayObjectAdapter(presenter) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
setHasStableIds(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getId(position: Int): Long {
|
||||||
|
val item = get(position)
|
||||||
|
return if(item is PersistentEvent){
|
||||||
|
item.id
|
||||||
|
} else {
|
||||||
|
-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import de.nicidienase.chaosflix.BuildConfig;
|
import de.nicidienase.chaosflix.BuildConfig;
|
||||||
|
import de.nicidienase.chaosflix.leanback.ChaosflixEventAdapter;
|
||||||
import de.nicidienase.chaosflix.leanback.R;
|
import de.nicidienase.chaosflix.leanback.R;
|
||||||
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.ConferenceGroup;
|
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.ConferenceGroup;
|
||||||
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.PersistentConference;
|
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.PersistentConference;
|
||||||
|
@ -34,13 +35,14 @@ import de.nicidienase.chaosflix.leanback.ItemViewClickedListener;
|
||||||
|
|
||||||
public class ConferencesBrowseFragment extends BrowseSupportFragment {
|
public class ConferencesBrowseFragment extends BrowseSupportFragment {
|
||||||
|
|
||||||
public static final int FRAGMENT = R.id.browse_fragment;
|
public static final int FRAGMENT = R.id.browse_fragment;
|
||||||
private static final String TAG = ConferencesBrowseFragment.class.getSimpleName();
|
private static final String TAG = ConferencesBrowseFragment.class.getSimpleName();
|
||||||
private ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
|
private ArrayObjectAdapter rowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
|
||||||
private ArrayObjectAdapter watchListAdapter;
|
private ChaosflixEventAdapter watchListAdapter;
|
||||||
private ArrayObjectAdapter inProgressAdapter;
|
private ChaosflixEventAdapter inProgressAdapter;
|
||||||
private ListRow watchlistRow;
|
private ChaosflixEventAdapter promotedAdapter;
|
||||||
private ListRow inProgressRow;
|
private ListRow watchlistRow;
|
||||||
|
private ListRow inProgressRow;
|
||||||
|
|
||||||
private SectionRow streamingSection;
|
private SectionRow streamingSection;
|
||||||
private DividerRow streamsDivider;
|
private DividerRow streamsDivider;
|
||||||
|
@ -89,8 +91,8 @@ public class ConferencesBrowseFragment extends BrowseSupportFragment {
|
||||||
CardPresenter conferencePresenter = new CardPresenter(R.style.ConferenceCardStyle);
|
CardPresenter conferencePresenter = new CardPresenter(R.style.ConferenceCardStyle);
|
||||||
CardPresenter eventPresenter = new CardPresenter(R.style.EventCardStyle);
|
CardPresenter eventPresenter = new CardPresenter(R.style.EventCardStyle);
|
||||||
|
|
||||||
watchListAdapter = new ArrayObjectAdapter(eventPresenter);
|
watchListAdapter = new ChaosflixEventAdapter(eventPresenter);
|
||||||
inProgressAdapter = new ArrayObjectAdapter(eventPresenter);
|
inProgressAdapter = new ChaosflixEventAdapter(eventPresenter);
|
||||||
|
|
||||||
streamingSection = new SectionRow(new HeaderItem(getString(R.string.livestreams)));
|
streamingSection = new SectionRow(new HeaderItem(getString(R.string.livestreams)));
|
||||||
streamsDivider = new DividerRow();
|
streamsDivider = new DividerRow();
|
||||||
|
|
Loading…
Reference in a new issue