diff --git a/common/src/main/res/drawable/ic_settings.xml b/common/src/main/res/drawable/ic_settings.xml index 1397d370..b1e89240 100644 --- a/common/src/main/res/drawable/ic_settings.xml +++ b/common/src/main/res/drawable/ic_settings.xml @@ -1,5 +1,5 @@ - + android:width="96dp" xmlns:android="http://schemas.android.com/apk/res/android"> diff --git a/leanback/src/main/java/de/nicidienase/chaosflix/leanback/ItemViewClickedListener.kt b/leanback/src/main/java/de/nicidienase/chaosflix/leanback/ItemViewClickedListener.kt index 0a0cb925..d9643893 100644 --- a/leanback/src/main/java/de/nicidienase/chaosflix/leanback/ItemViewClickedListener.kt +++ b/leanback/src/main/java/de/nicidienase/chaosflix/leanback/ItemViewClickedListener.kt @@ -18,7 +18,7 @@ import de.nicidienase.chaosflix.leanback.events.EventsActivity import de.nicidienase.chaosflix.leanback.events.EventsActivity.Companion.start import de.nicidienase.chaosflix.leanback.settings.ChaosflixSettingsActivity -class ItemViewClickedListener(private val fragment: Fragment) : OnItemViewClickedListener { +class ItemViewClickedListener(private val fragment: Fragment, private val streamUpdater: (()->Unit)? = null) : OnItemViewClickedListener { override fun onItemClicked(itemViewHolder: Presenter.ViewHolder, item: Any, rowViewHolder: RowPresenter.ViewHolder?, row: Row?) { Log.d(TAG, "onItemClicked") val activity = fragment.requireActivity() @@ -54,6 +54,9 @@ class ItemViewClickedListener(private val fragment: Fragment) : OnItemViewClicke LeakCanaryLauncher.launch(fragment.requireContext()) } } + SelectableContentItem.UpdateStreams -> { + streamUpdater?.invoke() + } } } } diff --git a/leanback/src/main/java/de/nicidienase/chaosflix/leanback/SelectableContentItem.kt b/leanback/src/main/java/de/nicidienase/chaosflix/leanback/SelectableContentItem.kt index e73b401b..27c01a4a 100644 --- a/leanback/src/main/java/de/nicidienase/chaosflix/leanback/SelectableContentItem.kt +++ b/leanback/src/main/java/de/nicidienase/chaosflix/leanback/SelectableContentItem.kt @@ -5,5 +5,6 @@ import androidx.annotation.DrawableRes enum class SelectableContentItem(val title: String, @DrawableRes val icon: Int, val data: Any? = null) { Settings("Settings", R.drawable.ic_settings), About("About", R.drawable.ic_info), - LeakCanary("Leak Canary", R.drawable.ic_warning) + LeakCanary("Leak Canary", R.drawable.ic_warning), + UpdateStreams("Update Streams", R.drawable.ic_refresh) } diff --git a/leanback/src/main/java/de/nicidienase/chaosflix/leanback/conferences/ConferencesBrowseFragment.kt b/leanback/src/main/java/de/nicidienase/chaosflix/leanback/conferences/ConferencesBrowseFragment.kt index a2bd71eb..eac5e43e 100644 --- a/leanback/src/main/java/de/nicidienase/chaosflix/leanback/conferences/ConferencesBrowseFragment.kt +++ b/leanback/src/main/java/de/nicidienase/chaosflix/leanback/conferences/ConferencesBrowseFragment.kt @@ -84,10 +84,13 @@ class ConferencesBrowseFragment : BrowseSupportFragment() { rowsAdapter.add(conferencesSection) - onItemViewClickedListener = ItemViewClickedListener(this) + onItemViewClickedListener = ItemViewClickedListener(this){ + viewModel.updateLiveStreams() + } adapter = rowsAdapter val listRowAdapter = ArrayObjectAdapter(settingsPresenter) + listRowAdapter.add(SelectableContentItem.UpdateStreams) listRowAdapter.add(SelectableContentItem.Settings) // listRowAdapter.add(SelectableContentItem.About) if (BuildConfig.DEBUG) { diff --git a/leanback/src/main/res/drawable/ic_warning.xml b/leanback/src/main/res/drawable/ic_warning.xml index 29d8a440..b82efe1f 100644 --- a/leanback/src/main/res/drawable/ic_warning.xml +++ b/leanback/src/main/res/drawable/ic_warning.xml @@ -1,5 +1,5 @@ - + android:width="96dp" xmlns:android="http://schemas.android.com/apk/res/android">