Skip to content

Commit

Permalink
allow passing OnFadeInfo for VitoView.show
Browse files Browse the repository at this point in the history
Reviewed By: oprisnik

Differential Revision: D64343004

fbshipit-source-id: 8d35f91e8441f0bd35c16d59d5e7b3813388901c
  • Loading branch information
Jason Sendros-Keshka authored and facebook-github-bot committed Oct 16, 2024
1 parent caa9739 commit 9b907f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package com.facebook.fresco.vito.view

import android.net.Uri
import android.view.View
import com.facebook.fresco.ui.common.OnFadeListener
import com.facebook.fresco.vito.core.FrescoDrawableInterface
import com.facebook.fresco.vito.core.VitoImageRequest
import com.facebook.fresco.vito.core.VitoImageRequestListener
Expand Down Expand Up @@ -108,14 +109,17 @@ object VitoView {
* Display an image
*/
@JvmStatic
@JvmOverloads
fun show(
imageSource: ImageSource,
imageOptions: ImageOptions,
callerContext: Any?,
imageListener: ImageListener?,
target: View
target: View,
onFadeListener: OnFadeListener? = null,
) {
VitoViewImpl2.show(imageSource, imageOptions, callerContext, imageListener, null, target)
VitoViewImpl2.show(
imageSource, imageOptions, callerContext, imageListener, null, target, onFadeListener)
}

@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.core.view.ViewCompat
import com.facebook.common.internal.Supplier
import com.facebook.common.internal.Suppliers
import com.facebook.drawee.drawable.VisibilityCallback
import com.facebook.fresco.ui.common.OnFadeListener
import com.facebook.fresco.vito.core.FrescoDrawableInterface
import com.facebook.fresco.vito.core.VitoImageRequest
import com.facebook.fresco.vito.core.VitoImageRequestListener
Expand Down Expand Up @@ -55,13 +56,15 @@ object VitoViewImpl2 {
}

@JvmStatic
@JvmOverloads
fun show(
imageSource: ImageSource,
imageOptions: ImageOptions,
callerContext: Any?,
imageListener: ImageListener?,
imageRequestListener: VitoImageRequestListener?,
target: View
target: View,
onFadeListener: OnFadeListener? = null,
) {
show(
FrescoVitoProvider.getImagePipeline()
Expand All @@ -75,16 +78,19 @@ object VitoViewImpl2 {
callerContext,
imageListener,
imageRequestListener,
target)
target,
onFadeListener)
}

@JvmStatic
@JvmOverloads
fun show(
imageRequest: VitoImageRequest,
callerContext: Any?,
imageListener: ImageListener?,
imageRequestListener: VitoImageRequestListener?,
target: View
target: View,
onFadeListener: OnFadeListener? = null,
) {
val frescoDrawable = ensureDrawableSet(target)
// The Drawable might be re-purposed before being cleaned up, so we release if necessary.
Expand All @@ -101,7 +107,7 @@ object VitoViewImpl2 {
contextChain = null,
listener = imageListener,
perfDataListener = null,
onFadeListener = null,
onFadeListener = onFadeListener,
viewportDimensions = Rect(0, 0, target.width, target.height),
vitoImageRequestListener = imageRequestListener)
}
Expand Down

0 comments on commit 9b907f1

Please sign in to comment.