forked from recloudstream/cloudstream
No tv types on local plugins
This commit is contained in:
parent
733e7f67d3
commit
e45246f834
2 changed files with 43 additions and 42 deletions
|
@ -96,61 +96,61 @@ class PluginsFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
// No download button
|
// No download button and no categories on local
|
||||||
settings_toolbar?.menu?.findItem(R.id.download_all)?.isVisible = false
|
settings_toolbar?.menu?.findItem(R.id.download_all)?.isVisible = false
|
||||||
pluginViewModel.updatePluginListLocal()
|
pluginViewModel.updatePluginListLocal()
|
||||||
|
tv_types_scroll_view?.isVisible = false
|
||||||
} else {
|
} else {
|
||||||
pluginViewModel.updatePluginList(url)
|
pluginViewModel.updatePluginList(url)
|
||||||
}
|
tv_types_scroll_view?.isVisible = true
|
||||||
|
|
||||||
// 💀💀💀💀💀💀💀 Recyclerview when
|
// 💀💀💀💀💀💀💀 Recyclerview when
|
||||||
val pairList = getPairList(
|
val pairList = getPairList(
|
||||||
home_select_anime,
|
home_select_anime,
|
||||||
home_select_cartoons,
|
home_select_cartoons,
|
||||||
home_select_tv_series,
|
home_select_tv_series,
|
||||||
home_select_documentaries,
|
home_select_documentaries,
|
||||||
home_select_movies,
|
home_select_movies,
|
||||||
home_select_asian,
|
home_select_asian,
|
||||||
home_select_livestreams
|
home_select_livestreams
|
||||||
)
|
)
|
||||||
|
|
||||||
// Copy pasted code
|
// Copy pasted code
|
||||||
for ((button, validTypes) in pairList) {
|
for ((button, validTypes) in pairList) {
|
||||||
val validTypesMapped = validTypes.map { it.name }
|
val validTypesMapped = validTypes.map { it.name }
|
||||||
val isValid =
|
val isValid =
|
||||||
true //validAPIs.any { api -> validTypes.any { api.supportedTypes.contains(it) } }
|
true //validAPIs.any { api -> validTypes.any { api.supportedTypes.contains(it) } }
|
||||||
button?.isVisible = isValid
|
button?.isVisible = isValid
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
fun buttonContains(): Boolean {
|
fun buttonContains(): Boolean {
|
||||||
return pluginViewModel.tvTypes.any { validTypesMapped.contains(it) }
|
return pluginViewModel.tvTypes.any { validTypesMapped.contains(it) }
|
||||||
}
|
|
||||||
|
|
||||||
button?.isSelected = buttonContains()
|
|
||||||
button?.setOnClickListener {
|
|
||||||
pluginViewModel.tvTypes.clear()
|
|
||||||
pluginViewModel.tvTypes.addAll(validTypesMapped)
|
|
||||||
for ((otherButton, _) in pairList) {
|
|
||||||
otherButton?.isSelected = false
|
|
||||||
}
|
}
|
||||||
button.isSelected = true
|
|
||||||
pluginViewModel.updateFilteredPlugins()
|
|
||||||
}
|
|
||||||
|
|
||||||
button?.setOnLongClickListener {
|
button?.isSelected = buttonContains()
|
||||||
if (!buttonContains()) {
|
button?.setOnClickListener {
|
||||||
button.isSelected = true
|
pluginViewModel.tvTypes.clear()
|
||||||
pluginViewModel.tvTypes.addAll(validTypesMapped)
|
pluginViewModel.tvTypes.addAll(validTypesMapped)
|
||||||
} else {
|
for ((otherButton, _) in pairList) {
|
||||||
button.isSelected = false
|
otherButton?.isSelected = false
|
||||||
pluginViewModel.tvTypes.removeAll(validTypesMapped)
|
}
|
||||||
|
button.isSelected = true
|
||||||
|
pluginViewModel.updateFilteredPlugins()
|
||||||
|
}
|
||||||
|
|
||||||
|
button?.setOnLongClickListener {
|
||||||
|
if (!buttonContains()) {
|
||||||
|
button.isSelected = true
|
||||||
|
pluginViewModel.tvTypes.addAll(validTypesMapped)
|
||||||
|
} else {
|
||||||
|
button.isSelected = false
|
||||||
|
pluginViewModel.tvTypes.removeAll(validTypesMapped)
|
||||||
|
}
|
||||||
|
pluginViewModel.updateFilteredPlugins()
|
||||||
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
pluginViewModel.updateFilteredPlugins()
|
|
||||||
return@setOnLongClickListener true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
tools:title="Overlord" />
|
tools:title="Overlord" />
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
|
android:id="@+id/tv_types_scroll_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/primaryGrayBackground"
|
android:background="?attr/primaryGrayBackground"
|
||||||
|
|
Loading…
Reference in a new issue