mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Implement cross-fade for story thumb shared element animation.
This commit is contained in:
committed by
Cody Henthorne
parent
cb63fe600c
commit
a894ba7a51
@@ -0,0 +1,32 @@
|
||||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import com.bumptech.glide.load.DataSource
|
||||
import com.bumptech.glide.load.engine.GlideException
|
||||
import com.bumptech.glide.request.RequestListener
|
||||
import com.bumptech.glide.request.target.Target
|
||||
|
||||
/**
|
||||
* Performs actions in onResourceReady and onLoadFailed
|
||||
*/
|
||||
class ActionRequestListener<T>(
|
||||
private val onResourceReady: Runnable,
|
||||
private val onLoadFailed: Runnable
|
||||
) : RequestListener<T> {
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun <T> onEither(onEither: Runnable): ActionRequestListener<T> {
|
||||
return ActionRequestListener(onEither, onEither)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<T>?, isFirstResource: Boolean): Boolean {
|
||||
onLoadFailed.run()
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(resource: T, model: Any?, target: Target<T>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
onResourceReady.run()
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user