Adds space avatar to toolbar
This commit is contained in:
parent
947cd8fceb
commit
e533b9f33d
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<FragmentSpaceListModalBinding>
|
||||
|
||||
private fun observeSpaceChange() = sharedActionViewModel.space.observe(viewLifecycleOwner) {
|
||||
viewModel.setSpace(it)
|
||||
binding.headerText.isVisible = it == null
|
||||
|
||||
binding.bottomDivider.isVisible = !it?.spaceChildren.isNullOrEmpty()
|
||||
}
|
||||
|
||||
override fun invalidate() {
|
||||
|
@ -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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/back_button_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chats"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="17sp"
|
||||
android:text="@string/chats"
|
||||
android:textColor="@color/palette_element_green"
|
||||
android:textSize="17sp"
|
||||
app:layout_constraintStart_toEndOf="@id/back_button_chevron"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@ -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">
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/space_avatar"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:visibility="gone"
|
||||
app:shapeAppearanceOverlay="@style/SpaceListModalImageShapeOverlay"
|
||||
tools:background="#42A5F5"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/groupToolbarTitleView"
|
||||
style="@style/Widget.Vector.TextView.Title.Bold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/all_chats"
|
||||
android:textSize="26sp"
|
||||
android:layout_marginStart="4dp" />
|
||||
android:textSize="26sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbar_chevron"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
android:importantForAccessibility="no"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
app:tint="@color/palette_element_green" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
@ -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" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dim_view_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:alpha="0.5"
|
||||
android:background="#000"
|
||||
android:elevation="10dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/appBarLayout"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/bottomNavigationView"
|
||||
app:layout_constraintTop_toTopOf="@id/bottomNavigationView" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
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:elevation="15dp"
|
||||
android:elevation="0dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />
|
||||
|
||||
|
@ -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">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:textSize="13sp"
|
||||
android:textColor="?attr/vctr_content_tertiary"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -35,6 +35,14 @@
|
||||
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" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/add_space_icon_background"
|
||||
android:layout_width="42dp"
|
||||
@ -46,14 +54,6 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/bottom_divider"
|
||||
app:shapeAppearanceOverlay="@style/SpaceListModalImageShapeOverlay" />
|
||||
|
||||
<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" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
|
Loading…
Reference in New Issue
Block a user