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