mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Move click listener setup
This commit is contained in:
parent
f76b4c06c5
commit
18408377e4
1 changed files with 13 additions and 12 deletions
|
@ -52,7 +52,6 @@ import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedA
|
||||||
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel
|
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.matrix.android.sdk.api.session.room.notification.RoomNotificationState
|
import org.matrix.android.sdk.api.session.room.notification.RoomNotificationState
|
||||||
import org.matrix.android.sdk.api.util.MatrixItem
|
|
||||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -127,7 +126,7 @@ class RoomProfileFragment @Inject constructor(
|
||||||
|
|
||||||
private fun setupClicks() {
|
private fun setupClicks() {
|
||||||
// Shortcut to room settings
|
// Shortcut to room settings
|
||||||
listOf(
|
setOf(
|
||||||
headerViews.roomProfileNameView,
|
headerViews.roomProfileNameView,
|
||||||
views.matrixProfileToolbarTitleView,
|
views.matrixProfileToolbarTitleView,
|
||||||
).forEach {
|
).forEach {
|
||||||
|
@ -139,6 +138,13 @@ class RoomProfileFragment @Inject constructor(
|
||||||
headerViews.roomProfileAliasView.setOnClickListener {
|
headerViews.roomProfileAliasView.setOnClickListener {
|
||||||
roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomAliasesSettings)
|
roomProfileSharedActionViewModel.post(RoomProfileSharedAction.OpenRoomAliasesSettings)
|
||||||
}
|
}
|
||||||
|
// Open Avatar
|
||||||
|
setOf(
|
||||||
|
headerViews.roomProfileAvatarView,
|
||||||
|
views.matrixProfileToolbarAvatarImageView
|
||||||
|
).forEach { view ->
|
||||||
|
view.setOnClickListener { onAvatarClicked(view) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupLongClicks() {
|
private fun setupLongClicks() {
|
||||||
|
@ -187,7 +193,7 @@ class RoomProfileFragment @Inject constructor(
|
||||||
override fun invalidate() = withState(roomProfileViewModel) { state ->
|
override fun invalidate() = withState(roomProfileViewModel) { state ->
|
||||||
views.waitingView.root.isVisible = state.isLoading
|
views.waitingView.root.isVisible = state.isLoading
|
||||||
|
|
||||||
state.roomSummary()?.also {
|
state.roomSummary()?.let {
|
||||||
if (it.membership.isLeft()) {
|
if (it.membership.isLeft()) {
|
||||||
Timber.w("The room has been left")
|
Timber.w("The room has been left")
|
||||||
activity?.finish()
|
activity?.finish()
|
||||||
|
@ -201,13 +207,6 @@ class RoomProfileFragment @Inject constructor(
|
||||||
headerViews.roomProfileDecorationImageView.isVisible = it.roomEncryptionTrustLevel != null
|
headerViews.roomProfileDecorationImageView.isVisible = it.roomEncryptionTrustLevel != null
|
||||||
headerViews.roomProfileDecorationImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
|
headerViews.roomProfileDecorationImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
|
||||||
views.matrixProfileDecorationToolbarAvatarImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
|
views.matrixProfileDecorationToolbarAvatarImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
|
||||||
|
|
||||||
headerViews.roomProfileAvatarView.setOnClickListener { view ->
|
|
||||||
onAvatarClicked(view, matrixItem)
|
|
||||||
}
|
|
||||||
views.matrixProfileToolbarAvatarImageView.setOnClickListener { view ->
|
|
||||||
onAvatarClicked(view, matrixItem)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
roomProfileController.setData(state)
|
roomProfileController.setData(state)
|
||||||
|
@ -311,7 +310,9 @@ class RoomProfileFragment @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onAvatarClicked(view: View, matrixItem: MatrixItem.RoomItem) {
|
private fun onAvatarClicked(view: View) = withState(roomProfileViewModel) { state ->
|
||||||
navigator.openBigImageViewer(requireActivity(), view, matrixItem)
|
state.roomSummary()?.toMatrixItem()?.let { matrixItem ->
|
||||||
|
navigator.openBigImageViewer(requireActivity(), view, matrixItem)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue