Fixes for breakages in the latest merge

This commit is contained in:
Blatzar 2023-01-22 22:28:51 +01:00
parent e945600940
commit 0dab9959e1
5 changed files with 42 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.syncproviders.providers
import androidx.fragment.app.FragmentActivity
import com.lagradost.cloudstream3.AcraApplication
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.syncproviders.AuthAPI
@ -37,7 +38,7 @@ class LocalList : SyncAPI {
return true
}
override fun authenticate() {
override fun authenticate(activity: FragmentActivity?) {
}
override val mainUrl = ""

View file

@ -3,17 +3,23 @@ package com.lagradost.cloudstream3.ui.library
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.syncproviders.SyncAPI
import com.lagradost.cloudstream3.ui.AutofitRecyclerView
import com.lagradost.cloudstream3.ui.search.SearchClickCallback
import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
import com.lagradost.cloudstream3.utils.AppUtils
import com.lagradost.cloudstream3.utils.UIHelper.toPx
import kotlinx.android.synthetic.main.search_result_grid_expanded.view.*
import kotlin.math.roundToInt
class PageAdapter(
override val items: MutableList<SyncAPI.LibraryItem>,
private val resView: AutofitRecyclerView,
val clickCallback: (SearchClickCallback) -> Unit
) :
AppUtils.DiffAdapter<SyncAPI.LibraryItem>(items) {
@ -34,6 +40,12 @@ class PageAdapter(
}
inner class LibraryItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val cardView: ImageView = itemView.imageView
private val compactView = false//itemView.context.getGridIsCompact()
private val coverHeight: Int =
if (compactView) 80.toPx else (resView.itemWidth / 0.68).roundToInt()
fun bind(item: SyncAPI.LibraryItem, position: Int) {
SearchResultBuilder.bind(
this@PageAdapter.clickCallback,
@ -42,6 +54,16 @@ class PageAdapter(
itemView,
)
// See searchAdaptor for this, it basically fixes the height
if (!compactView) {
cardView.apply {
layoutParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
coverHeight
)
}
}
// Set watch progress bar
// val showProgress = item.episodesCompleted != null && item.episodesTotal != null
// itemView.watchProgress.isVisible = showProgress

View file

@ -36,7 +36,11 @@ class ViewpagerAdapter(
RecyclerView.ViewHolder(itemViewTest) {
fun bind(page: SyncAPI.Page) {
if (itemViewTest.page_recyclerview?.adapter == null) {
itemViewTest.page_recyclerview?.adapter = PageAdapter(page.items.toMutableList(), clickCallback)
itemViewTest.page_recyclerview?.adapter = PageAdapter(
page.items.toMutableList(),
itemViewTest.page_recyclerview,
clickCallback
)
itemView.page_recyclerview?.spanCount =
this@PageViewHolder.itemView.context.getSpanCount() ?: 3
} else {

View file

@ -23,7 +23,6 @@
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/search_poster_img_des"
android:duplicateParentState="true"
@ -49,6 +48,12 @@
style="@style/SubButton"
android:layout_gravity="end" />
<TextView
android:id="@+id/text_rating"
style="@style/RatingButton"
tools:text="7.7"
android:layout_gravity="end" />
<TextView
android:id="@+id/text_flag"
style="@style/SearchBox"

View file

@ -90,11 +90,13 @@
<item name="android:fontFamily">@font/google_sans</item>
<item name="chipMinTouchTargetSize">0dp</item>
</style>
<style name="ChipFilledSemiTransparent" parent="@style/ChipFilled">
<item name="chipBackgroundColor">@color/transparent</item>
<item name="chipSurfaceColor">@color/semiWhite</item>
<item name="backgroundColor">@color/transparent</item>
</style>
<style name="ChipParent">
<item name="chipSpacingVertical">5dp</item>
<item name="chipSpacingHorizontal">5dp</item>
@ -123,6 +125,11 @@
<item name="android:textColor">@color/subColorText</item>
</style>
<style name="RatingButton" parent="@style/SearchBox">
<item name="android:background">@drawable/rating_bg_color</item>
<item name="drawableStartCompat">@drawable/ic_baseline_star_24</item>
</style>
<style name="TypeButton" parent="@style/SearchBox">
<item name="android:background">@drawable/type_bg_color</item>
<item name="android:text">@string/quality_hd</item>