Back button text changes based on space parent

This commit is contained in:
ericdecanini 2022-05-10 09:19:34 +02:00
parent 65d5473661
commit 4fe455c47b
1 changed files with 5 additions and 0 deletions

View File

@ -352,6 +352,7 @@ class HomeDetailFragment @Inject constructor(
private fun onSpaceChange(spaceSummary: RoomSummary?) {
hideModal()
views.backButtonText.text = getString(R.string.all_chats)
if (spaceSummary == null) {
views.backButtonLayout.isVisible = false
views.groupToolbarSpaceTitleView.isVisible = false
@ -365,6 +366,10 @@ class HomeDetailFragment @Inject constructor(
views.groupToolbarTitleView.text = spaceSummary.displayName
views.spaceAvatar.isVisible = true
avatarRenderer.render(spaceSummary.toMatrixItem(), views.spaceAvatar)
spaceSummary.spaceParents?.firstOrNull()?.let { directParent ->
views.backButtonText.text = directParent.roomSummary?.name ?: getString(R.string.all_chats)
}
}
}