Adds shadows and max list size to modal

This commit is contained in:
ericdecanini 2022-05-10 13:00:18 +02:00
parent 4fe455c47b
commit 1bca6f83ee
5 changed files with 105 additions and 66 deletions

View File

@ -69,7 +69,7 @@ class SpaceListModalFragment : VectorBaseFragment<FragmentSpaceListModalBinding>
}
private fun setupAddSpace() {
binding.addSpaceClickbox.setOnClickListener {
binding.addSpaceLayout.setOnClickListener {
val currentSpace = sharedActionViewModel.space.value
if (currentSpace != null) {
startActivity(SpaceManageActivity.newIntent(requireActivity(), currentSpace.roomId, ManageType.AddRoomsOnlySpaces))
@ -82,14 +82,13 @@ class SpaceListModalFragment : VectorBaseFragment<FragmentSpaceListModalBinding>
private fun observeSpaceChange() = sharedActionViewModel.space.observe(viewLifecycleOwner) {
viewModel.setSpace(it)
binding.headerText.isVisible = it == null
binding.bottomDivider.isVisible = !it?.spaceChildren.isNullOrEmpty()
binding.headerTextLayout.isVisible = it == null
}
override fun invalidate() {
withState(viewModel) { state ->
state.rootSpacesOrdered?.let {
(binding.roomList.adapter as SpaceListAdapter).replaceList(it)
(binding.roomList.adapter as SpaceListAdapter).replaceList(it + it)
}
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/vctr_content_secondary">
<item android:drawable="@color/modal_background_color"/>
<!--this creates the mask with the ripple effect-->
<item
android:id="@+id/mask"
android:drawable="@android:color/white" />
</ripple>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#10000000"
android:endColor="@android:color/transparent"
android:angle="90" />
</shape>

View File

@ -267,9 +267,17 @@
android:id="@+id/space_modal_fragment"
android:name="im.vector.app.features.home.SpaceListModalFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/bottom_guideline"
android:elevation="0dp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/bottom_guideline"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.75" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -3,9 +3,18 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/bg_space_modal">
<FrameLayout
android:id="@+id/header_text_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/modal_background_color"
android:elevation="4dp"
android:paddingBottom="8dp">
<TextView
android:id="@+id/header_text"
android:layout_width="wrap_content"
@ -19,39 +28,41 @@
android:text="@string/choose_a_space"
android:textAllCaps="true" />
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/room_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/header_text"
android:layout_height="0dp"
android:background="@color/modal_background_color"
app:layout_constraintTop_toBottomOf="@id/header_text_layout"
app:layout_constraintBottom_toTopOf="@id/add_space_layout"
tools:itemCount="3"
tools:listitem="@layout/item_modal_space" />
<com.google.android.material.divider.MaterialDivider
android:id="@+id/bottom_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/room_list" />
<View
android:id="@+id/add_space_clickbox"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/ripple_grey"
app:layout_constraintTop_toBottomOf="@id/bottom_divider"
app:layout_constraintBottom_toBottomOf="parent" />
android:layout_height="4dp"
android:background="@drawable/top_shadow"
app:layout_constraintBottom_toTopOf="@id/add_space_layout" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/add_space_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_modal_ripple_grey"
android:elevation="3dp"
app:layout_constraintBottom_toBottomOf="parent">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/add_space_icon_background"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="#4D8D97A5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottom_divider"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:shapeAppearanceOverlay="@style/SpaceListModalImageShapeOverlay" />
<ImageView
@ -82,3 +93,5 @@
app:layout_constraintTop_toBottomOf="@id/add_space_icon_background" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>