mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-22 20:33:05 +00:00
Leanback: add promoted Events
This commit is contained in:
parent
efc2a42b62
commit
a5ef33e75f
2 changed files with 14 additions and 2 deletions
|
@ -69,6 +69,8 @@ class BrowseViewModel(
|
|||
.getAllSync()
|
||||
.map { it.eventGuid } }
|
||||
|
||||
fun getPromotedEvents(): LiveData<List<PersistentEvent>> = database.eventDao().findPromotedEvents()
|
||||
|
||||
private fun updateAndGetEventsForGuids(guidProvider: ()->List<String>):LiveData<List<PersistentEvent>>{
|
||||
val result = MutableLiveData<List<PersistentEvent>>()
|
||||
handler.runOnBackgroundThread {
|
||||
|
|
|
@ -93,6 +93,7 @@ public class ConferencesBrowseFragment extends BrowseSupportFragment {
|
|||
|
||||
watchListAdapter = new ChaosflixEventAdapter(eventPresenter);
|
||||
inProgressAdapter = new ChaosflixEventAdapter(eventPresenter);
|
||||
promotedAdapter = new ChaosflixEventAdapter(eventPresenter);
|
||||
|
||||
streamingSection = new SectionRow(new HeaderItem(getString(R.string.livestreams)));
|
||||
streamsDivider = new DividerRow();
|
||||
|
@ -105,10 +106,13 @@ public class ConferencesBrowseFragment extends BrowseSupportFragment {
|
|||
rowsAdapter.add(streamsDivider);
|
||||
|
||||
// Recomendations
|
||||
rowsAdapter.add(recomendationsSectionsRow);
|
||||
Row promotedRow = new ListRow(new HeaderItem("Promoted"), promotedAdapter);
|
||||
watchlistRow = new ListRow(new HeaderItem(getString(R.string.watchlist)), watchListAdapter);
|
||||
rowsAdapter.add(watchlistRow);
|
||||
inProgressRow = new ListRow(new HeaderItem("Continue Watching"), inProgressAdapter);
|
||||
|
||||
rowsAdapter.add(recomendationsSectionsRow);
|
||||
rowsAdapter.add(promotedRow);
|
||||
rowsAdapter.add(watchlistRow);
|
||||
rowsAdapter.add(inProgressRow);
|
||||
rowsAdapter.add(recomendationsDivider);
|
||||
|
||||
|
@ -170,6 +174,12 @@ public class ConferencesBrowseFragment extends BrowseSupportFragment {
|
|||
}
|
||||
});
|
||||
|
||||
viewModel.getPromotedEvents().observe(this, (promoted) -> {
|
||||
if(promoted != null){
|
||||
promotedAdapter.setItems(promoted, eventDiffCallback);
|
||||
}
|
||||
});
|
||||
|
||||
viewModel.getLivestreams().observe(this, liveConferences -> {
|
||||
if (liveConferences != null) {
|
||||
// if (BuildConfig.DEBUG) {
|
||||
|
|
Loading…
Reference in a new issue