feat: 18+ media on infinite scroll too

This commit is contained in:
aayush262 2024-04-01 19:31:32 +05:30
parent 0d8a82568a
commit a815bac15d
4 changed files with 18 additions and 13 deletions

View file

@ -1,49 +0,0 @@
package ani.dantotsu.profile.activity
import android.content.Intent
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import ani.dantotsu.databinding.ItemFollowerBinding
import ani.dantotsu.loadImage
import ani.dantotsu.profile.ProfileActivity
import ani.dantotsu.profile.User
import ani.dantotsu.setAnimation
class UsersAdapter(private val user: ArrayList<User>) : RecyclerView.Adapter<UsersAdapter.UsersViewHolder>() {
inner class UsersViewHolder(val binding: ItemFollowerBinding) :
RecyclerView.ViewHolder(binding.root) {
init {
itemView.setOnClickListener {
ContextCompat.startActivity(
binding.root.context, Intent(binding.root.context, ProfileActivity::class.java)
.putExtra("userId", user[bindingAdapterPosition].id), null
)
}
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): UsersViewHolder {
return UsersViewHolder(
ItemFollowerBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
}
override fun onBindViewHolder(holder: UsersViewHolder, position: Int) {
val b = holder.binding
setAnimation(b.root.context, b.root)
val user = user[position]
b.profileUserAvatar.loadImage(user.pfp)
b.profileBannerImage.loadImage(user.banner)
b.profileUserName.text = user.name
}
override fun getItemCount(): Int = user.size
}