Code review fixes.
This commit is contained in:
parent
1a273407de
commit
56fc91a8c3
|
@ -19,7 +19,10 @@ package im.vector.riotx.features.navigation
|
|||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.app.TaskStackBuilder
|
||||
import androidx.core.view.ViewCompat
|
||||
import im.vector.matrix.android.api.session.crypto.sas.IncomingSasVerificationTransaction
|
||||
import im.vector.matrix.android.api.session.crypto.sas.VerificationMethod
|
||||
import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom
|
||||
|
@ -36,6 +39,7 @@ import im.vector.riotx.features.debug.DebugMenuActivity
|
|||
import im.vector.riotx.features.home.room.detail.RoomDetailActivity
|
||||
import im.vector.riotx.features.home.room.detail.RoomDetailArgs
|
||||
import im.vector.riotx.features.home.room.filtered.FilteredRoomsActivity
|
||||
import im.vector.riotx.features.media.BigImageViewerActivity
|
||||
import im.vector.riotx.features.roomdirectory.RoomDirectoryActivity
|
||||
import im.vector.riotx.features.roomdirectory.createroom.CreateRoomActivity
|
||||
import im.vector.riotx.features.roomdirectory.roompreview.RoomPreviewActivity
|
||||
|
@ -179,6 +183,14 @@ class DefaultNavigator @Inject constructor(
|
|||
context.startActivity(RoomProfileActivity.newIntent(context, roomId))
|
||||
}
|
||||
|
||||
override fun openBigImageViewer(activity: Activity, sharedElement: View?, title: String, avatarUrl: String) {
|
||||
val intent = BigImageViewerActivity.newIntent(activity, title, avatarUrl)
|
||||
val options = sharedElement?.let {
|
||||
ActivityOptionsCompat.makeSceneTransitionAnimation(activity, it, ViewCompat.getTransitionName(it) ?: "")
|
||||
}
|
||||
activity.startActivity(intent, options?.toBundle())
|
||||
}
|
||||
|
||||
private fun startActivity(context: Context, intent: Intent, buildTask: Boolean) {
|
||||
if (buildTask) {
|
||||
val stackBuilder = TaskStackBuilder.create(context)
|
||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.riotx.features.navigation
|
|||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom
|
||||
import im.vector.riotx.features.settings.VectorSettingsActivity
|
||||
import im.vector.riotx.features.share.SharedData
|
||||
|
@ -59,4 +60,6 @@ interface Navigator {
|
|||
fun openRoomMemberProfile(userId: String, roomId: String?, context: Context, buildTask: Boolean = false)
|
||||
|
||||
fun openRoomProfile(context: Context, roomId: String)
|
||||
|
||||
fun openBigImageViewer(activity: Activity, sharedElement: View?, title: String, avatarUrl: String)
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ import android.os.Parcelable
|
|||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.Incomplete
|
||||
|
@ -44,7 +42,6 @@ import im.vector.riotx.core.platform.VectorBaseFragment
|
|||
import im.vector.riotx.core.utils.startSharePlainTextIntent
|
||||
import im.vector.riotx.features.crypto.verification.VerificationBottomSheet
|
||||
import im.vector.riotx.features.home.AvatarRenderer
|
||||
import im.vector.riotx.features.media.BigImageViewerActivity
|
||||
import im.vector.riotx.features.roommemberprofile.devices.DeviceListBottomSheet
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.synthetic.main.fragment_matrix_profile.*
|
||||
|
@ -197,12 +194,7 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||
}
|
||||
|
||||
memberProfileAvatarView.setOnClickListener { view ->
|
||||
userMatrixItem.avatarUrl
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { avatarUrl ->
|
||||
val title = userMatrixItem.displayName ?: ""
|
||||
onAvatarClicked(view, title, avatarUrl)
|
||||
}
|
||||
onAvatarClicked(view, userMatrixItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,9 +232,12 @@ class RoomMemberProfileFragment @Inject constructor(
|
|||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||
}
|
||||
|
||||
private fun onAvatarClicked(view: View, title: String, avatarUrl: String) {
|
||||
val intent = BigImageViewerActivity.newIntent(context!!, title, avatarUrl)
|
||||
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view, ViewCompat.getTransitionName(view) ?: "")
|
||||
startActivity(intent, options.toBundle())
|
||||
private fun onAvatarClicked(view: View, userMatrixItem: MatrixItem) {
|
||||
userMatrixItem.avatarUrl
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { avatarUrl ->
|
||||
val title = userMatrixItem.getBestName()
|
||||
navigator.openBigImageViewer(requireActivity(), view, title, avatarUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,13 +22,12 @@ import android.os.Parcelable
|
|||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.mvrx.args
|
||||
import com.airbnb.mvrx.fragmentViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.matrix.android.api.session.room.notification.RoomNotificationState
|
||||
import im.vector.matrix.android.api.util.MatrixItem
|
||||
import im.vector.matrix.android.api.util.toMatrixItem
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.animations.AppBarStateChangeListener
|
||||
|
@ -46,7 +45,6 @@ import im.vector.riotx.features.home.room.list.actions.RoomListActionsArgs
|
|||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsSharedAction
|
||||
import im.vector.riotx.features.home.room.list.actions.RoomListQuickActionsSharedActionViewModel
|
||||
import im.vector.riotx.features.media.BigImageViewerActivity
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import kotlinx.android.synthetic.main.fragment_matrix_profile.*
|
||||
import kotlinx.android.synthetic.main.view_stub_room_profile_header.*
|
||||
|
@ -169,12 +167,7 @@ class RoomProfileFragment @Inject constructor(
|
|||
matrixProfileDecorationToolbarAvatarImageView.setImageResource(it.roomEncryptionTrustLevel.toImageRes())
|
||||
|
||||
roomProfileAvatarView.setOnClickListener { view ->
|
||||
matrixItem.avatarUrl
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { avatarUrl ->
|
||||
val title = state.roomSummary()?.displayName ?: ""
|
||||
onAvatarClicked(view, title, avatarUrl)
|
||||
}
|
||||
onAvatarClicked(view, matrixItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,9 +217,12 @@ class RoomProfileFragment @Inject constructor(
|
|||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||
}
|
||||
|
||||
private fun onAvatarClicked(view: View, title: String, avatarUrl: String) {
|
||||
val intent = BigImageViewerActivity.newIntent(context!!, title, avatarUrl)
|
||||
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view, ViewCompat.getTransitionName(view) ?: "")
|
||||
startActivity(intent, options.toBundle())
|
||||
private fun onAvatarClicked(view: View, matrixItem: MatrixItem.RoomItem) {
|
||||
matrixItem.avatarUrl
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { avatarUrl ->
|
||||
val title = matrixItem.getBestName()
|
||||
navigator.openBigImageViewer(requireActivity(), view, title, avatarUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:elevation="4dp"
|
||||
android:transitionName="toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
Loading…
Reference in New Issue