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

albums header scroll via nestedScrollView

parent 598c2505
......@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.albums
import android.os.Bundle
import android.view.View
import androidx.core.os.bundleOf
import androidx.core.widget.NestedScrollView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
......@@ -14,6 +15,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderAdapter
import com.biganto.visual.roompark.presentation.screen.favorites.util.AlbumListAdapter
import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import com.squareup.picasso.Picasso
import javax.inject.Inject
......@@ -41,9 +43,15 @@ class AlbumsScreenController :
lateinit var albumsRecyclerView: RecyclerView
@BindView(R.id.photo_albums_container)
lateinit var nestedScrollView: NestedScrollView
private fun bindRecycler() {
headersRecyclerView.isNestedScrollingEnabled = true
headersRecyclerView.isNestedScrollingEnabled = false
headersRecyclerView.layoutManager =
LinearLayoutManager(activity, RecyclerView.HORIZONTAL, false)
headersRecyclerView.adapter = AlbumsHeaderAdapter()
......@@ -55,7 +63,7 @@ class AlbumsScreenController :
, resources?.getDimensionPixelSize(R.dimen.ceil_grid_padding))
)
albumsRecyclerView.isNestedScrollingEnabled = true
albumsRecyclerView.isNestedScrollingEnabled = false
albumsRecyclerView.layoutManager =
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
albumsRecyclerView.adapter = AlbumListAdapter()
......@@ -118,6 +126,7 @@ class AlbumsScreenController :
(it.adapter as AlbumsHeaderAdapter).getItemPosition(viewState.selectedAlbumId)
)
}
}
private fun render(viewState: AlbumsScreenViewState.AlbumsSelected){
......
......@@ -35,7 +35,7 @@ class AlbumListAdapter : CommonRecyclerAdapter<AlbumViewHolder, AlbumSortedModel
override fun onViewBound(model: AlbumSortedModel) {
albumTitle.text = model.title
photosRecyclerView.isNestedScrollingEnabled = true
photosRecyclerView.isNestedScrollingEnabled = false
photosRecyclerView.layoutManager =
StaggeredGridLayoutManager(4, RecyclerView.VERTICAL)
val adapter = PhotosAdapter()
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
......@@ -8,18 +8,6 @@
android:background="@color/colorOpacityBackground"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/albums_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include12"
tools:itemCount="3"
tools:listitem="@layout/date_album_viewholder" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/headers_recycler_view"
android:layout_width="match_parent"
......@@ -32,39 +20,66 @@
tools:itemCount="1"
tools:listitem="@layout/estate_card_viewholder" />
<androidx.core.widget.NestedScrollView
android:id="@+id/photo_albums_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/header_album_title"
style="@style/Header_TextView.Inverted_Header"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="Дом №1"
android:textAlignment="viewStart"
app:layout_constraintEnd_toStartOf="@+id/include"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/headers_recycler_view" />
android:text="Дом №1" />
<include
android:id="@+id/include"
layout="@layout/bell_switch_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="@+id/header_album_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/headers_recycler_view" />
android:baselineAligned="false"
android:gravity="center_vertical|end" />
</LinearLayout>
<include
android:id="@+id/include12"
layout="@layout/horizontal_divider"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/header_album_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
android:backgroundTint="@color/colorOpacityBackgroundInv" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/albums_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
tools:itemCount="2"
tools:listitem="@layout/date_album_viewholder" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textview.MaterialTextView
style="@style/Common_Text.Inverted"
android:id="@+id/date_title_textview"
style="@style/Common_Text.Inverted"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="16dp"
android:text="TextView" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/photos_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:orientation="vertical" />
android:layout_marginEnd="12dp"
android:orientation="vertical"
tools:itemCount="1"
tools:listitem="@layout/photo_preview_viewholder" />
</LinearLayout>
\ 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