Skip to content

Commit

Permalink
Merge pull request #5202 from wikimedia/galleryTransitionCorners
Browse files Browse the repository at this point in the history
Fix/remove unnecessary parameter during page->gallery transition.
  • Loading branch information
Williamrai authored Jan 6, 2025
2 parents e0a2d61 + b555308 commit d67ec44
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,5 @@ object JavaScriptActionHandler {

@Serializable
class ImageHitInfo(val left: Float = 0f, val top: Float = 0f, val width: Float = 0f, val height: Float = 0f,
val src: String = "", val centerCrop: Boolean = false)
val src: String = "")
}
3 changes: 1 addition & 2 deletions app/src/main/java/org/wikipedia/gallery/GalleryActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ class GalleryActivity : BaseActivity(), LinkPreviewDialog.LoadPageCallback, Gall
params.gravity = Gravity.CENTER
binding.transitionReceiver.layoutParams = params
binding.transitionReceiver.visibility = View.VISIBLE
ViewUtil.loadImage(binding.transitionReceiver, TRANSITION_INFO!!.src, TRANSITION_INFO!!.centerCrop,
force = false, listener = null)
ViewUtil.loadImage(binding.transitionReceiver, TRANSITION_INFO!!.src)
val transitionMillis = 500
binding.transitionReceiver.postDelayed({
if (isDestroyed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class LeadImagesHandler(private val parentFragment: PageFragment,
val wiki = language?.run { WikiSite.forLanguageCode(this) } ?: it.wikiSite
val hitInfo = JavaScriptActionHandler.ImageHitInfo(pageHeaderView.imageView.left.toFloat(),
pageHeaderView.imageView.top.toFloat(), leadImageWidth.toFloat(), leadImageHeight.toFloat(),
leadImageUrl!!, true)
leadImageUrl!!)
GalleryActivity.setTransitionInfo(hitInfo)
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pageHeaderView.imageView, activity.getString(R.string.transition_page_gallery))
callback?.onPageRequestGallery(it, filename, wiki, parentFragment.revision, true, options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class LinkPreviewDialog : ExtendedBottomSheetDialogFragment(), LinkPreviewErrorV
private val galleryViewListener = GalleryViewListener { view, thumbUrl, imageName ->
var options: ActivityOptionsCompat? = null
view.drawable?.let {
val hitInfo = JavaScriptActionHandler.ImageHitInfo(0f, 0f, it.intrinsicWidth.toFloat(), it.intrinsicHeight.toFloat(), thumbUrl, false)
val hitInfo = JavaScriptActionHandler.ImageHitInfo(0f, 0f, it.intrinsicWidth.toFloat(), it.intrinsicHeight.toFloat(), thumbUrl)
GalleryActivity.setTransitionInfo(hitInfo)
view.transitionName = requireActivity().getString(R.string.transition_page_gallery)
options = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view, requireActivity().getString(R.string.transition_page_gallery))
Expand Down

0 comments on commit d67ec44

Please sign in to comment.