mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-06 00:00:10 +00:00
Moved Autoplay button to top and load recommendations now appropriately uses 'StatePlatform.instance.getContentRecommendations(v.url)' for local videos.
This commit is contained in:
parent
d8e1edb60b
commit
4a80c2aab1
3 changed files with 30 additions and 43 deletions
|
@ -2360,20 +2360,11 @@ class VideoDetailView : ConstraintLayout {
|
||||||
_layoutRecommended.visibility = View.VISIBLE
|
_layoutRecommended.visibility = View.VISIBLE
|
||||||
_commentsList.clear()
|
_commentsList.clear()
|
||||||
|
|
||||||
val url = _url
|
_layoutRecommended.addView(LoaderView(context).apply {
|
||||||
if (url != null) {
|
layoutParams = LinearLayout.LayoutParams(60.dp(resources), 60.dp(resources))
|
||||||
_layoutRecommended.addView(LoaderView(context).apply {
|
start()
|
||||||
layoutParams = LinearLayout.LayoutParams(60.dp(resources), 60.dp(resources))
|
})
|
||||||
start()
|
_taskLoadRecommendations.run(null)
|
||||||
})
|
|
||||||
_taskLoadRecommendations.run(url)
|
|
||||||
} else {
|
|
||||||
_layoutRecommended.addView(TextView(context).apply {
|
|
||||||
layoutParams = LinearLayout.LayoutParams(60.dp(resources), 60.dp(resources))
|
|
||||||
textSize = 12.0f
|
|
||||||
text = "No recommendations found"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2767,7 +2758,15 @@ class VideoDetailView : ConstraintLayout {
|
||||||
}
|
}
|
||||||
} else TaskHandler(IPlatformVideoDetails::class.java, {fragment.lifecycleScope});
|
} else TaskHandler(IPlatformVideoDetails::class.java, {fragment.lifecycleScope});
|
||||||
|
|
||||||
private val _taskLoadRecommendations = TaskHandler<String, IPager<IPlatformContent>?>(StateApp.instance.scopeGetter, { video?.getContentRecommendations(StatePlatform.instance.getContentClient(it)) })
|
private val _taskLoadRecommendations = TaskHandler<String?, IPager<IPlatformContent>?>(StateApp.instance.scopeGetter, {
|
||||||
|
video?.let { v ->
|
||||||
|
if (v is VideoLocal) {
|
||||||
|
StatePlatform.instance.getContentRecommendations(v.url)
|
||||||
|
} else {
|
||||||
|
video?.getContentRecommendations(StatePlatform.instance.getContentClient(v.url))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.success { setRecommendations(it?.getResults()?.filter { it is IPlatformVideo }?.map { it as IPlatformVideo }, "No recommendations found") }
|
.success { setRecommendations(it?.getResults()?.filter { it is IPlatformVideo }?.map { it as IPlatformVideo }, "No recommendations found") }
|
||||||
.exception<Throwable> {
|
.exception<Throwable> {
|
||||||
setRecommendations(null, it.message)
|
setRecommendations(null, it.message)
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent">
|
app:layout_constraintRight_toRightOf="parent">
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/button_autoplay"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:clickable="true"
|
||||||
|
android:padding="12dp"
|
||||||
|
app:srcCompat="@drawable/autoplay_24px" />
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/button_cast"
|
android:id="@+id/button_cast"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
|
@ -133,20 +141,6 @@
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:layout_marginBottom="18dp" />
|
android:layout_marginBottom="18dp" />
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/button_autoplay"
|
|
||||||
android:layout_width="55dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:clickable="true"
|
|
||||||
app:srcCompat="@drawable/autoplay_24px"
|
|
||||||
app:layout_constraintRight_toLeftOf="@id/button_fullscreen"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/button_fullscreen"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/button_fullscreen"
|
|
||||||
android:paddingStart="5dp"
|
|
||||||
android:paddingTop="15dp"
|
|
||||||
android:paddingEnd="5dp"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_position"
|
android:id="@+id/text_position"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -57,6 +57,14 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent">
|
app:layout_constraintRight_toRightOf="parent">
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/button_autoplay"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:clickable="true"
|
||||||
|
android:padding="12dp"
|
||||||
|
app:srcCompat="@drawable/autoplay_24px" />
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/button_cast"
|
android:id="@+id/button_cast"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
|
@ -147,20 +155,6 @@
|
||||||
app:layout_constraintLeft_toRightOf="@id/layout_play_pause"
|
app:layout_constraintLeft_toRightOf="@id/layout_play_pause"
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/button_autoplay"
|
|
||||||
android:layout_width="55dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:clickable="true"
|
|
||||||
app:srcCompat="@drawable/autoplay_24px"
|
|
||||||
app:layout_constraintRight_toLeftOf="@id/button_fullscreen"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/button_fullscreen"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/button_fullscreen"
|
|
||||||
android:paddingStart="5dp"
|
|
||||||
android:paddingTop="15dp"
|
|
||||||
android:paddingEnd="5dp"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/button_fullscreen"
|
android:id="@+id/button_fullscreen"
|
||||||
android:layout_width="55dp"
|
android:layout_width="55dp"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue