From 0dab9959e13c930214a919984dfed6aecdb31411 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sun, 22 Jan 2023 22:28:51 +0100 Subject: [PATCH] Fixes for breakages in the latest merge --- .../syncproviders/providers/LocalList.kt | 3 ++- .../cloudstream3/ui/library/PageAdapter.kt | 22 +++++++++++++++++++ .../ui/library/ViewpagerAdapter.kt | 6 ++++- .../layout/search_result_grid_expanded.xml | 7 +++++- app/src/main/res/values/styles.xml | 7 ++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt index 41ea30f7..8625e9eb 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt @@ -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 = "" diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt index 26872b10..79e59938 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/PageAdapter.kt @@ -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, + private val resView: AutofitRecyclerView, val clickCallback: (SearchClickCallback) -> Unit ) : AppUtils.DiffAdapter(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 diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt index 3a439ffa..f5583937 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/ViewpagerAdapter.kt @@ -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 { diff --git a/app/src/main/res/layout/search_result_grid_expanded.xml b/app/src/main/res/layout/search_result_grid_expanded.xml index f82751c0..7f2c8e43 100644 --- a/app/src/main/res/layout/search_result_grid_expanded.xml +++ b/app/src/main/res/layout/search_result_grid_expanded.xml @@ -23,7 +23,6 @@ + + @font/google_sans 0dp + + + +