Commit 5aee3fcb authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix albums layout

parent 17cfe07f
......@@ -19,6 +19,7 @@ import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderA
import com.biganto.visual.roompark.presentation.screen.favorites.util.AlbumListAdapter
import com.biganto.visual.roompark.util.extensions.scaleCenterCrop
import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import com.google.android.material.textview.MaterialTextView
import com.squareup.picasso.Picasso
import jp.wasabeef.picasso.transformations.BlurTransformation
import jp.wasabeef.picasso.transformations.ColorFilterTransformation
......@@ -49,19 +50,18 @@ class AlbumsScreenController :
@BindView(R.id.albums_recycler_view)
lateinit var albumsRecyclerView: RecyclerView
@BindView(R.id.photo_albums_container)
lateinit var nestedScrollView: NestedScrollView
@BindView(R.id.header_album_title)
lateinit var currentAlbomTitle: MaterialTextView
val photosBackgroundTarget = object : com.squareup.picasso.Target {
private val photosBackgroundTarget = object : com.squareup.picasso.Target {
override fun onPrepareLoad(placeHolderDrawable: Drawable?) {
Timber.d("View measures: 1 - " +
"${nestedScrollView.width} " +
"/ ${nestedScrollView.height} " +
"/ ${nestedScrollView.measuredWidth} " +
"/${nestedScrollView.measuredHeight}")
nestedScrollView.background = placeHolderDrawable
}
......@@ -70,19 +70,10 @@ class AlbumsScreenController :
}
override fun onBitmapLoaded(bitmap: Bitmap?, from: Picasso.LoadedFrom?) {
Timber.d("View measures: 2 - " +
"${nestedScrollView.width} " +
"/ ${nestedScrollView.height} " +
"/ ${nestedScrollView.measuredWidth} " +
"/${nestedScrollView.measuredHeight}"
)
val croppedBtimpa = bitmap?.scaleCenterCrop(nestedScrollView)
nestedScrollView.background =
BitmapDrawable(activity?.resources
, croppedBtimpa)
bitmap?.scaleCenterCrop(nestedScrollView)?.let {
nestedScrollView.background = BitmapDrawable(activity?.resources, it)
}
}
}
......@@ -168,9 +159,10 @@ class AlbumsScreenController :
)
}
viewState.list.first { it.albumId == viewState.selectedAlbumId }.previewUrl.let {
viewState.list.first { it.albumId == viewState.selectedAlbumId }.let {
currentAlbomTitle.text = it.title
picassoAsync
.load(it)
.load(it.previewUrl)
.transform(BlurTransformation(activity, 13, 2))
.transform(ColorFilterTransformation(0xCC000000.toInt()))
.into(photosBackgroundTarget)
......
......@@ -10,20 +10,21 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/headers_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="121dp"
android:background="@color/colorPrimary"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:itemCount="1"
tools:listitem="@layout/estate_card_viewholder" />
tools:listitem="@layout/album_header_preview_viewholder" />
<androidx.core.widget.NestedScrollView
android:id="@+id/photo_albums_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_weight="1"
android:background="@color/colorOpacityBackground">
<LinearLayout
android:layout_width="match_parent"
......@@ -34,13 +35,14 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:orientation="horizontal">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/header_album_title"
style="@style/Header_TextView.Inverted_Header"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
......
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