Commit f387e3f6 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

photos addapter and viewholder

parent dcef423f
......@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.article.util.ArticleBottomPhotoAdapter
import com.biganto.visual.roompark.presentation.screen.article.util.HtmlPageAdapter
import com.biganto.visual.roompark.presentation.screen.article.util.HtmlTag
import com.biganto.visual.roompark.util.extensions.formatToSimple
......@@ -56,6 +57,9 @@ class ArticleScreenController :
@BindView(R.id.articleBodyRecyclerView)
lateinit var articleRecyclerView: RecyclerView
@BindView(R.id.article_photos_recylcerView)
lateinit var bottomPhotosRecyclerView: RecyclerView
private val blurPreview:ImageView by lazy {
headerBlock.findViewById<ImageView>(R.id.articlePreviewBlurred)
}
......@@ -79,6 +83,12 @@ class ArticleScreenController :
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
articleRecyclerView.adapter = HtmlPageAdapter()
articleRecyclerView.itemAnimator = null
bottomPhotosRecyclerView.layoutManager =
LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)
bottomPhotosRecyclerView.adapter = ArticleBottomPhotoAdapter()
bottomPhotosRecyclerView.itemAnimator = null
}
override fun onViewBound(v: View) {
......@@ -121,6 +131,10 @@ class ArticleScreenController :
articleDate.text = viewState.item.published.formatToSimple
viewState.item.bottomPhotoList?.let {
(bottomPhotosRecyclerView.adapter as ArticleBottomPhotoAdapter).setItems(it)
}
Glide.with(blurPreview)
.load(viewState.item.previewUrl)
.transform(BlurTransformation(40,4))
......
package com.biganto.visual.roompark.presentation.screen.article.util
import android.view.View
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.data.repository.db.requrey.TitledPhoto
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import kotlin.reflect.KClass
/**
* Created by Vladislav Bogdashkin on 29.01.2020.
*/
class ArticleBottomPhotoAdapter : CommonRecyclerAdapter<ArticleBottomPhotoViewHolder,TitledPhoto>() {
override val vhKlazz: KClass<ArticleBottomPhotoViewHolder>
get() = ArticleBottomPhotoViewHolder::class
override fun getVhLayout(): Int = R.layout.photo_article_slider_viewholder
}
class ArticleBottomPhotoViewHolder(itemView: View) : CommonViewHolder<TitledPhoto>(itemView){
override fun onViewBound(model: TitledPhoto) {
// articleTitle.text = model.title
Glide.with(itemView)
.load(model.url)
.centerCrop()
.fitCenter()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into((itemView as RoundedImageView))
}
}
......@@ -39,7 +39,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/article_photos_viewholder"
android:id="@+id/article_photos_recylcerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
......
<?xml version="1.0" encoding="utf-8"?>
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="256dp"
android:layout_height="228dp"
android:layout_margin="16dp"
android:scaleType="centerCrop"
app:image_corner_radius="4dp" />
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment