From 1bca6f83ee99ea2fc69a7de47039a526bdf5fa1a Mon Sep 17 00:00:00 2001 From: ericdecanini Date: Tue, 10 May 2022 13:00:18 +0200 Subject: [PATCH] Adds shadows and max list size to modal --- .../features/home/SpaceListModalFragment.kt | 7 +- .../res/drawable/bg_modal_ripple_grey.xml | 12 ++ vector/src/main/res/drawable/top_shadow.xml | 7 + .../main/res/layout/fragment_home_detail.xml | 10 +- .../res/layout/fragment_space_list_modal.xml | 135 ++++++++++-------- 5 files changed, 105 insertions(+), 66 deletions(-) create mode 100644 vector/src/main/res/drawable/bg_modal_ripple_grey.xml create mode 100644 vector/src/main/res/drawable/top_shadow.xml diff --git a/vector/src/main/java/im/vector/app/features/home/SpaceListModalFragment.kt b/vector/src/main/java/im/vector/app/features/home/SpaceListModalFragment.kt index 9fd85dcfb2..f5e556aa90 100644 --- a/vector/src/main/java/im/vector/app/features/home/SpaceListModalFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/SpaceListModalFragment.kt @@ -69,7 +69,7 @@ class SpaceListModalFragment : VectorBaseFragment } 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 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) } } } diff --git a/vector/src/main/res/drawable/bg_modal_ripple_grey.xml b/vector/src/main/res/drawable/bg_modal_ripple_grey.xml new file mode 100644 index 0000000000..951317b695 --- /dev/null +++ b/vector/src/main/res/drawable/bg_modal_ripple_grey.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/vector/src/main/res/drawable/top_shadow.xml b/vector/src/main/res/drawable/top_shadow.xml new file mode 100644 index 0000000000..d033b67b34 --- /dev/null +++ b/vector/src/main/res/drawable/top_shadow.xml @@ -0,0 +1,7 @@ + + + + diff --git a/vector/src/main/res/layout/fragment_home_detail.xml b/vector/src/main/res/layout/fragment_home_detail.xml index 6535375dbf..2da7a28c6f 100644 --- a/vector/src/main/res/layout/fragment_home_detail.xml +++ b/vector/src/main/res/layout/fragment_home_detail.xml @@ -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" /> + + diff --git a/vector/src/main/res/layout/fragment_space_list_modal.xml b/vector/src/main/res/layout/fragment_space_list_modal.xml index 0877279c83..7d8f24619f 100644 --- a/vector/src/main/res/layout/fragment_space_list_modal.xml +++ b/vector/src/main/res/layout/fragment_space_list_modal.xml @@ -3,82 +3,95 @@ 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"> - + android:background="@color/modal_background_color" + android:elevation="4dp" + android:paddingBottom="8dp"> + + + + - - + android:layout_height="4dp" + android:background="@drawable/top_shadow" + app:layout_constraintBottom_toTopOf="@id/add_space_layout" /> - - - - - + android:background="@drawable/bg_modal_ripple_grey" + android:elevation="3dp" + app:layout_constraintBottom_toBottomOf="parent"> - + + + + + + + + +