same as previous build. Minor typos
This commit is contained in:
@@ -2,13 +2,10 @@ package com.woka.webseries.adapters
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.woka.R
|
||||
import com.woka.databinding.ShowViewHolderBinding
|
||||
import com.woka.utils.isNetworkConnected
|
||||
@@ -16,12 +13,12 @@ import com.woka.utils.show
|
||||
import com.woka.utils.toast
|
||||
import com.woka.webseries.WebSeriesRepository
|
||||
import com.woka.webseries.models.ShowData
|
||||
import com.woka.webseries.views.SeasonActivity
|
||||
import com.woka.webseries.views.SeasonActivity.Companion.EXTRA_SHOW_CATEGORY_DATA
|
||||
import com.woka.webseries.views.SeasonActivity.Companion.EXTRA_SHOW_ID
|
||||
import kotlin.math.max
|
||||
|
||||
class WebSeriesShowAdapter(private val context: Context): RecyclerView.Adapter<WebSeriesShowAdapter.ShowViewHolder>() {
|
||||
class WebSeriesShowAdapter(
|
||||
private val context: Context,
|
||||
var onShowClicked: (ShowData, Int, String) -> Unit
|
||||
): RecyclerView.Adapter<WebSeriesShowAdapter.ShowViewHolder>() {
|
||||
|
||||
inner class ShowViewHolder(val binding: ShowViewHolderBinding): ViewHolder(binding.root)
|
||||
|
||||
@@ -53,11 +50,7 @@ class WebSeriesShowAdapter(private val context: Context): RecyclerView.Adapter<W
|
||||
|
||||
holder.binding.apply {
|
||||
showData.thumbnail_path?.let {
|
||||
Glide.with(context.applicationContext)
|
||||
.load(it)
|
||||
.error(android.R.color.darker_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(image)
|
||||
image.loadImage(it)
|
||||
}
|
||||
|
||||
title.text = showData.title
|
||||
@@ -84,14 +77,14 @@ class WebSeriesShowAdapter(private val context: Context): RecyclerView.Adapter<W
|
||||
if (like.isSelected){
|
||||
WebSeriesRepository.likeUnLikeShow("${showData.id}", false, it)
|
||||
|
||||
showData.likes_count?.let {
|
||||
likeCount.text = "${max(it - 1, 0)}"
|
||||
showData.likes_count?.let {likeCountInt ->
|
||||
likeCount.text = "${max(likeCountInt - 1, 0)}"
|
||||
}
|
||||
}else{
|
||||
WebSeriesRepository.likeUnLikeShow("${showData.id}", true, it)
|
||||
|
||||
showData.likes_count?.let {
|
||||
val value = it + 1
|
||||
showData.likes_count?.let {likeCountInt ->
|
||||
val value = likeCountInt + 1
|
||||
likeCount.text = "$value"
|
||||
}
|
||||
}
|
||||
@@ -120,10 +113,9 @@ class WebSeriesShowAdapter(private val context: Context): RecyclerView.Adapter<W
|
||||
}
|
||||
|
||||
root.setOnClickListener {
|
||||
context.startActivity(Intent(context, SeasonActivity::class.java).apply {
|
||||
putExtra(EXTRA_SHOW_ID, showData.id)
|
||||
putExtra(EXTRA_SHOW_CATEGORY_DATA, categoryId)
|
||||
})
|
||||
categoryId?.let { categoryId ->
|
||||
onShowClicked(showData, holder.absoluteAdapterPosition, categoryId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/shimmer"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
android:background="@color/color_primary_dark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -309,9 +309,9 @@
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_web_series"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1000dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/show_view_holder"
|
||||
android:layout_marginTop="5dp"
|
||||
|
||||
Reference in New Issue
Block a user