diff --git a/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt index 5ebf770cad..c7a444523f 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeDetailFragment.kt @@ -60,6 +60,7 @@ import kotlinx.coroutines.launch import org.matrix.android.sdk.api.session.crypto.model.DeviceInfo import org.matrix.android.sdk.api.session.group.model.GroupSummary import org.matrix.android.sdk.api.session.room.model.RoomSummary +import org.matrix.android.sdk.api.util.toMatrixItem import javax.inject.Inject class HomeDetailFragment @Inject constructor( @@ -160,7 +161,11 @@ class HomeDetailFragment @Inject constructor( } views.dimView.setOnClickListener { - toggleModalVisibility() + hideModal() + } + + views.dimViewBottom.setOnClickListener { + hideModal() } viewModel.onEach(HomeDetailViewState::showDialPadTab) { showDialPadTab -> @@ -232,12 +237,14 @@ class HomeDetailFragment @Inject constructor( private fun showModal() { views.spaceModalFragment.isVisible = true views.dimView.isVisible = true + views.dimViewBottom.isVisible = true views.toolbarChevron.rotation = 90F } private fun hideModal() { views.spaceModalFragment.isVisible = false views.dimView.isVisible = false + views.dimViewBottom.isVisible = false views.toolbarChevron.rotation = 0F } @@ -331,10 +338,12 @@ class HomeDetailFragment @Inject constructor( private fun onGroupChange(groupSummary: GroupSummary?) { hideModal() if (groupSummary == null) { + views.backButtonLayout.isVisible = false views.groupToolbarSpaceTitleView.isVisible = false views.groupToolbarSpaceTitleView.text = getString(R.string.all_chats) views.groupToolbarTitleView.text = getString(R.string.all_chats) } else { + views.backButtonLayout.isVisible = true views.groupToolbarSpaceTitleView.isVisible = true views.groupToolbarSpaceTitleView.text = groupSummary.displayName views.groupToolbarTitleView.text = groupSummary.displayName @@ -344,13 +353,18 @@ class HomeDetailFragment @Inject constructor( private fun onSpaceChange(spaceSummary: RoomSummary?) { hideModal() if (spaceSummary == null) { + views.backButtonLayout.isVisible = false views.groupToolbarSpaceTitleView.isVisible = false views.groupToolbarSpaceTitleView.text = getString(R.string.all_chats) views.groupToolbarTitleView.text = getString(R.string.all_chats) + views.spaceAvatar.isVisible = false } else { + views.backButtonLayout.isVisible = true views.groupToolbarSpaceTitleView.isVisible = true views.groupToolbarSpaceTitleView.text = spaceSummary.displayName views.groupToolbarTitleView.text = spaceSummary.displayName + views.spaceAvatar.isVisible = true + avatarRenderer.render(spaceSummary.toMatrixItem(), views.spaceAvatar) } } 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 58aaa2d34c..910865ecf2 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 @@ -20,6 +20,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState @@ -77,6 +78,9 @@ class SpaceListModalFragment : VectorBaseFragment private fun observeSpaceChange() = sharedActionViewModel.space.observe(viewLifecycleOwner) { viewModel.setSpace(it) + binding.headerText.isVisible = it == null + + binding.bottomDivider.isVisible = !it?.spaceChildren.isNullOrEmpty() } override fun invalidate() { diff --git a/vector/src/main/res/layout/fragment_home_detail.xml b/vector/src/main/res/layout/fragment_home_detail.xml index ad761c59ba..6535375dbf 100644 --- a/vector/src/main/res/layout/fragment_home_detail.xml +++ b/vector/src/main/res/layout/fragment_home_detail.xml @@ -84,8 +84,8 @@ android:layout_height="40dp" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" - android:visibility="gone" android:contentDescription="@string/a11y_open_drawer" + android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -133,22 +133,22 @@ android:layout_width="20dp" android:layout_height="20dp" android:importantForAccessibility="no" - android:src="@drawable/ic_arrow_right" android:rotation="180" - app:layout_constraintTop_toTopOf="@id/back_button_text" + android:src="@drawable/ic_arrow_right" app:layout_constraintBottom_toBottomOf="@id/back_button_text" app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@id/back_button_text" app:tint="@color/palette_element_green" /> @@ -160,27 +160,39 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:paddingBottom="8dp" - app:layout_constraintTop_toBottomOf="@id/back_button_layout" - app:layout_constraintStart_toStartOf="parent"> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/back_button_layout"> + + + android:textSize="26sp" /> @@ -233,19 +245,30 @@ android:id="@+id/dim_view" android:layout_width="match_parent" android:layout_height="0dp" - android:background="#000" android:alpha="0.5" + android:background="#000" + android:elevation="0dp" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@id/bottomNavigationView" + app:layout_constraintTop_toBottomOf="@id/appBarLayout" /> + + + app:layout_constraintBottom_toBottomOf="@id/bottomNavigationView" + app:layout_constraintTop_toTopOf="@id/bottomNavigationView" /> 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 01d4d4beab..0877279c83 100644 --- a/vector/src/main/res/layout/fragment_space_list_modal.xml +++ b/vector/src/main/res/layout/fragment_space_list_modal.xml @@ -4,13 +4,13 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/bg_space_modal" - android:paddingTop="16dp"> + android:background="@drawable/bg_space_modal"> + + - -