public class MultiCallback extends Object implements android.graphics.drawable.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 and Description |
|---|
MultiCallback()
Equivalent to
MultiCallback(boolean) with false value. |
MultiCallback(boolean useViewInvalidate)
Set
useViewInvalidate to true if displayed Drawable is not supported by
Drawable.Callback#invalidateDrawable(Drawable) of the target. |
| Modifier and Type | Method and Description |
|---|---|
void |
addView(android.graphics.drawable.Drawable.Callback callback)
Associates given
Drawable.Callback. |
void |
invalidateDrawable(android.graphics.drawable.Drawable who) |
void |
removeView(android.graphics.drawable.Drawable.Callback callback)
Disassociates given
Drawable.Callback. |
void |
scheduleDrawable(android.graphics.drawable.Drawable who,
Runnable what,
long when) |
void |
unscheduleDrawable(android.graphics.drawable.Drawable who,
Runnable what) |
public MultiCallback()
MultiCallback(boolean) with false value.public MultiCallback(boolean useViewInvalidate)
useViewInvalidate to true if displayed Drawable is not supported by
Drawable.Callback#invalidateDrawable(Drawable) of the target. For example if it is located inside ImageSpan
displayed in TextView.useViewInvalidate - whether View.invalidate() should be used instead of Drawable.Callback#invalidateDrawable(Drawable)public void invalidateDrawable(@NonNull
android.graphics.drawable.Drawable who)
invalidateDrawable in interface android.graphics.drawable.Drawable.Callbackpublic void scheduleDrawable(@NonNull
android.graphics.drawable.Drawable who,
@NonNull
Runnable what,
long when)
scheduleDrawable in interface android.graphics.drawable.Drawable.Callbackpublic void unscheduleDrawable(@NonNull
android.graphics.drawable.Drawable who,
@NonNull
Runnable what)
unscheduleDrawable in interface android.graphics.drawable.Drawable.Callbackpublic void addView(android.graphics.drawable.Drawable.Callback callback)
Drawable.Callback. If callback has been already added, nothing happens.callback - Callback to be associatedpublic void removeView(android.graphics.drawable.Drawable.Callback callback)
Drawable.Callback. If callback is not associated, nothing happens.callback - Callback to be disassociated