mirror of
https://github.com/imcarlost/Friendlists.git
synced 2026-04-10 02:46:54 -04:00
implemente picasso and implement images
This commit is contained in:
@@ -32,7 +32,7 @@ class PhotolistFragment : Fragment() {
|
||||
setRecycler()
|
||||
setObservers()
|
||||
// TODO: Get album by bundle
|
||||
viewModel.fetchPhotos(2)
|
||||
viewModel.fetchPhotos(1)
|
||||
}
|
||||
|
||||
private fun setObservers() {
|
||||
|
||||
@@ -7,7 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.hako.base.extensions.autoNotify
|
||||
import com.hako.photolist.R
|
||||
import com.hako.photolist.model.PhotoViewable
|
||||
import com.squareup.picasso.Picasso
|
||||
import kotlinx.android.synthetic.main.item_photo_card.view.*
|
||||
import org.koin.core.KoinComponent
|
||||
import org.koin.core.inject
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class PhotolistAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
@@ -40,11 +43,19 @@ class PhotolistAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
}
|
||||
|
||||
class PhotoViewHolder(private val view: View) :
|
||||
RecyclerView.ViewHolder(view) {
|
||||
RecyclerView.ViewHolder(view), KoinComponent {
|
||||
|
||||
private val picasso: Picasso by inject()
|
||||
|
||||
init {
|
||||
picasso.setIndicatorsEnabled(true)
|
||||
}
|
||||
|
||||
fun bind(photo: PhotoViewable) = with(view) {
|
||||
picasso.load(photo.photoUrl)
|
||||
.placeholder(R.drawable.img_photo_placeholder)
|
||||
.fit()
|
||||
.into(item_photo_card_photo)
|
||||
item_photo_card_title.text = photo.title
|
||||
|
||||
// TODO load image
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/img_photo_placeholder"
|
||||
android:contentDescription="Album photo" />
|
||||
android:contentDescription="@string/album_photo" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/item_photo_card_footer_container"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">photolist</string>
|
||||
<string name="album_photo">Album photo</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user