Kotlin optimization

This commit is contained in:
Benoit Marty 2020-10-28 11:21:36 +01:00 committed by Benoit Marty
parent 5c62f29c6f
commit 042c8abac1
1 changed files with 7 additions and 5 deletions

View File

@ -244,8 +244,10 @@ class RoomProfileFragment @Inject constructor(
}
private fun onAvatarClicked(view: View, matrixItem: MatrixItem.RoomItem) = withState(roomProfileViewModel) {
if (matrixItem.avatarUrl?.isNotEmpty() == true) {
val intent = BigImageViewerActivity.newIntent(requireContext(), matrixItem.getBestName(), matrixItem.avatarUrl!!)
matrixItem.avatarUrl
?.takeIf { it.isNotEmpty() }
?.let { avatarUrl ->
val intent = BigImageViewerActivity.newIntent(requireContext(), matrixItem.getBestName(), avatarUrl)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view, ViewCompat.getTransitionName(view) ?: "")
startActivity(intent, options.toBundle())
}