Package pl.droidsonroids.gif
Class MultiCallback
java.lang.Object
pl.droidsonroids.gif.MultiCallback
- All Implemented Interfaces:
Drawable.Callback
public class MultiCallback extends Object implements Drawable.Callback
Drawable.Callback which allows single Drawable to be associated with multiple callbacks,
eg. with multiple Views.
If drawable needs to be redrawn all currently associated callbacks are invoked.
If Callback is a View it is then invalidated.-
Constructor Summary
Constructors Constructor Description MultiCallback()Equivalent toMultiCallback(boolean)withfalsevalue.MultiCallback(boolean useViewInvalidate)SetuseViewInvalidatetotrueif displayedDrawableis not supported byDrawable.Callback.invalidateDrawable(Drawable)of the target. -
Method Summary
Modifier and Type Method Description voidaddView(Drawable.Callback callback)Associates givenDrawable.Callback.voidinvalidateDrawable(Drawable who)voidremoveView(Drawable.Callback callback)Disassociates givenDrawable.Callback.voidscheduleDrawable(Drawable who, Runnable what, long when)voidunscheduleDrawable(Drawable who, Runnable what)
-
Constructor Details
-
MultiCallback
public MultiCallback()Equivalent toMultiCallback(boolean)withfalsevalue. -
MultiCallback
public MultiCallback(boolean useViewInvalidate)SetuseViewInvalidatetotrueif displayedDrawableis not supported byDrawable.Callback.invalidateDrawable(Drawable)of the target. For example if it is located insideImageSpandisplayed inTextView.- Parameters:
useViewInvalidate- whetherView.invalidate()should be used instead ofDrawable.Callback.invalidateDrawable(Drawable)
-
-
Method Details
-
invalidateDrawable
- Specified by:
invalidateDrawablein interfaceDrawable.Callback
-
scheduleDrawable
- Specified by:
scheduleDrawablein interfaceDrawable.Callback
-
unscheduleDrawable
- Specified by:
unscheduleDrawablein interfaceDrawable.Callback
-
addView
Associates givenDrawable.Callback. If callback has been already added, nothing happens.- Parameters:
callback- Callback to be associated
-
removeView
Disassociates givenDrawable.Callback. If callback is not associated, nothing happens.- Parameters:
callback- Callback to be disassociated
-