From f6ad67f1c8140e6e5fa52a574c5f9a761dcf290c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Sun, 7 Feb 2021 14:29:27 +0100 Subject: [PATCH] Use the navigator facility --- .../app/features/navigation/DefaultNavigator.kt | 3 +-- .../features/roomprofile/RoomProfileFragment.kt | 17 ++++------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt index fded8602c4..c32b5626be 100644 --- a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt +++ b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt @@ -262,8 +262,7 @@ class DefaultNavigator @Inject constructor( ?.let { avatarUrl -> val intent = BigImageViewerActivity.newIntent(activity, matrixItem.getBestName(), avatarUrl) val options = sharedElement?.let { - ActivityOptionsCompat.makeSceneTransitionAnimation(activity, it, ViewCompat.getTransitionName(it) - ?: "") + ActivityOptionsCompat.makeSceneTransitionAnimation(activity, it, ViewCompat.getTransitionName(it) ?: "") } activity.startActivity(intent, options?.toBundle()) } diff --git a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt index 58fd78e26a..0cb57fda4f 100644 --- a/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomprofile/RoomProfileFragment.kt @@ -25,9 +25,7 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AlertDialog -import androidx.core.app.ActivityOptionsCompat import androidx.core.content.pm.ShortcutManagerCompat -import androidx.core.view.ViewCompat import androidx.core.view.isVisible import com.airbnb.mvrx.args import com.airbnb.mvrx.fragmentViewModel @@ -52,7 +50,6 @@ import im.vector.app.features.home.room.list.actions.RoomListActionsArgs import im.vector.app.features.home.room.list.actions.RoomListQuickActionsBottomSheet import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedAction import im.vector.app.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel -import im.vector.app.features.media.BigImageViewerActivity import kotlinx.parcelize.Parcelize import org.matrix.android.sdk.api.session.room.notification.RoomNotificationState import org.matrix.android.sdk.api.util.MatrixItem @@ -103,8 +100,8 @@ class RoomProfileFragment @Inject constructor( appBarStateChangeListener = MatrixItemAppBarStateChangeListener( headerView, listOf(views.matrixProfileToolbarAvatarImageView, - views.matrixProfileToolbarTitleView, - views.matrixProfileDecorationToolbarAvatarImageView) + views.matrixProfileToolbarTitleView, + views.matrixProfileDecorationToolbarAvatarImageView) ) views.matrixProfileAppBarLayout.addOnOffsetChangedListener(appBarStateChangeListener) roomProfileViewModel.observeViewEvents { @@ -289,13 +286,7 @@ class RoomProfileFragment @Inject constructor( ) } - private fun onAvatarClicked(view: View, matrixItem: MatrixItem.RoomItem) = withState(roomProfileViewModel) { - 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()) - } + private fun onAvatarClicked(view: View, matrixItem: MatrixItem.RoomItem) { + navigator.openBigImageViewer(requireActivity(), view, matrixItem) } }