testing tv UI, NOT FINISHED

This commit is contained in:
LagradOst 2023-07-23 03:07:24 +02:00
parent 5aa9019d6d
commit 35084389a1
5 changed files with 870 additions and 640 deletions

View file

@ -44,6 +44,7 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.navigate
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.utils.UIHelper.setImage
import com.lagradost.cloudstream3.utils.UIHelper.setImageBlur
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
class ResultFragmentTv : Fragment() { class ResultFragmentTv : Fragment() {
@ -192,7 +193,7 @@ class ResultFragmentTv : Fragment() {
binding?.apply { binding?.apply {
resultEpisodes.layoutManager = resultEpisodes.layoutManager =
LinearListLayout(resultEpisodes.context).apply { LinearListLayout(resultEpisodes.context).apply {
setHorizontal() setVertical()
} }
resultReloadConnectionerror.setOnClickListener { resultReloadConnectionerror.setOnClickListener {
@ -222,9 +223,9 @@ class ResultFragmentTv : Fragment() {
// Always escape focus // Always escape focus
if (hasFocus) binding?.resultBookmarkButton?.requestFocus() if (hasFocus) binding?.resultBookmarkButton?.requestFocus()
} }
resultBack.setOnClickListener { //resultBack.setOnClickListener {
activity?.popCurrentPage() // activity?.popCurrentPage()
} //}
resultRecommendationsList.spanCount = 8 resultRecommendationsList.spanCount = 8
resultRecommendationsList.adapter = resultRecommendationsList.adapter =
@ -581,6 +582,8 @@ class ResultFragmentTv : Fragment() {
} }
} }
backgroundPoster.setImage(d.posterBackgroundImage, radius = 10)
resultComingSoon.isVisible = d.comingSoon resultComingSoon.isVisible = d.comingSoon
resultDataHolder.isGone = d.comingSoon resultDataHolder.isGone = d.comingSoon
UIHelper.populateChips(resultTag, d.tags) UIHelper.populateChips(resultTag, d.tags)

View file

@ -260,6 +260,8 @@ object UIHelper {
@DrawableRes @DrawableRes
errorImageDrawable: Int? = null, errorImageDrawable: Int? = null,
fadeIn: Boolean = true, fadeIn: Boolean = true,
radius: Int = 0,
sample: Int = 3,
colorCallback: ((Palette) -> Unit)? = null colorCallback: ((Palette) -> Unit)? = null
): Boolean { ): Boolean {
if (url.isNullOrBlank()) return false if (url.isNullOrBlank()) return false
@ -267,6 +269,8 @@ object UIHelper {
UiImage.Image(url, headers, errorImageDrawable), UiImage.Image(url, headers, errorImageDrawable),
errorImageDrawable, errorImageDrawable,
fadeIn, fadeIn,
radius,
sample,
colorCallback colorCallback
) )
return true return true
@ -277,7 +281,9 @@ object UIHelper {
@DrawableRes @DrawableRes
errorImageDrawable: Int? = null, errorImageDrawable: Int? = null,
fadeIn: Boolean = true, fadeIn: Boolean = true,
colorCallback: ((Palette) -> Unit)? = null radius: Int = 0,
sample: Int = 3,
colorCallback: ((Palette) -> Unit)? = null,
): Boolean { ): Boolean {
if (this == null || uiImage == null) return false if (this == null || uiImage == null) return false
@ -289,7 +295,7 @@ object UIHelper {
} ?: return false } ?: return false
return try { return try {
val builder = GlideApp.with(this) var builder = GlideApp.with(this)
.load(glideImage) .load(glideImage)
.skipMemoryCache(true) .skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).let { req -> .diskCacheStrategy(DiskCacheStrategy.ALL).let { req ->
@ -298,8 +304,12 @@ object UIHelper {
else req else req
} }
if(radius > 0) {
builder = builder.apply(bitmapTransform(BlurTransformation(radius, sample)))
}
if (colorCallback != null) { if (colorCallback != null) {
builder.listener(object : RequestListener<Drawable> { builder = builder.listener(object : RequestListener<Drawable> {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
override fun onResourceReady( override fun onResourceReady(
resource: Drawable?, resource: Drawable?,

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--style="@style/SelectableButton"-->
<com.google.android.material.button.MaterialButton xmlns:android="http://schemas.android.com/apk/res/android" <com.google.android.material.button.MaterialButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="@style/SelectableButton" style="@style/RegularButtonTV"
android:layout_marginStart="0dp" android:layout_gravity="start"
android:layout_marginEnd="10dp" android:layout_marginStart="0dp"
tools:text="Season 1" /> android:layout_marginEnd="10dp"
tools:text="Season 1" />

View file

@ -723,6 +723,11 @@
<item name="strokeColor">@color/tag_stroke_color</item> <item name="strokeColor">@color/tag_stroke_color</item>
</style> </style>
<style name="ResultButtonTV" parent="@style/RegularButtonTV">
<item name="android:layout_width">250dp</item>
<item name="android:layout_marginBottom">5dp</item>
</style>
<style name="RegularButtonTV"> <style name="RegularButtonTV">
<item name="android:stateListAnimator">@null</item> <item name="android:stateListAnimator">@null</item>
<item name="strokeColor">@color/transparent</item> <item name="strokeColor">@color/transparent</item>
@ -734,15 +739,15 @@
<item name="iconTint">@color/player_on_button_tv</item> <item name="iconTint">@color/player_on_button_tv</item>
<item name="textColor">@color/player_on_button_tv</item> <item name="textColor">@color/player_on_button_tv</item>
<item name="android:textColor">@color/player_on_button_tv</item> <item name="android:textColor">@color/player_on_button_tv</item>
<item name="android:layout_width">200dp</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">30dp</item> <item name="android:layout_height">40dp</item>
<item name="iconSize">16dp</item> <item name="iconSize">16dp</item>
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:layout_gravity">center</item> <item name="android:layout_gravity">center</item>
<item name="android:baselineAligned">false</item> <item name="android:baselineAligned">false</item>
<item name="textAllCaps">false</item> <item name="textAllCaps">false</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:textSize">10sp</item> <item name="android:textSize">14sp</item>
<item name="android:layout_marginStart">4dp</item> <item name="android:layout_marginStart">4dp</item>
<item name="android:layout_marginEnd">4dp</item> <item name="android:layout_marginEnd">4dp</item>
<item name="android:insetBottom">0dp</item> <item name="android:insetBottom">0dp</item>