-
-
Save illuzor/d7084ab179ad6c6f09484ab0fad75f75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.illuzor.lesson.wallpapers.adapters | |
import android.view.View | |
import android.widget.ImageView | |
import android.widget.TextView | |
import androidx.recyclerview.widget.RecyclerView | |
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions | |
import com.illuzor.lesson.wallpapers.GlideApp | |
import com.illuzor.lesson.wallpapers.R | |
class CategoryViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |
private val ivPreview: ImageView = view.findViewById(R.id.iv_preview) | |
private val tvTitle: TextView = view.findViewById(R.id.tv_title) | |
fun setTitle(title: String) { | |
tvTitle.text = title | |
} | |
fun loadImage(url: String) = | |
GlideApp.with(itemView) | |
.load(url) | |
.placeholder(R.drawable.placeholder) | |
.transition(DrawableTransitionOptions.withCrossFade()) | |
.into(ivPreview) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment