@Override public void invalidateDrawable(@NonNull final Drawable who) { for (int i = 0; i < mCallbacks.size(); i++) { final CallbackWeakReference reference = mCallbacks.get(i); final Callback callback = reference.get(); if (callback != null) { if (mUseViewInvalidate && callback instanceof View) { ((View) callback).invalidate(); } else { callback.invalidateDrawable(who); } } else { // Always remove null references to reduce list size mCallbacks.remove(reference); } } }
public Ring(Callback callback) { this.mCallback = callback; this.mPaint.setStrokeCap(Cap.SQUARE); this.mPaint.setAntiAlias(true); this.mPaint.setStyle(Style.STROKE); this.mArrowPaint.setStyle(Style.FILL); this.mArrowPaint.setAntiAlias(true); }
public AnimatedVectorDrawableCompatState(Context context, AnimatedVectorDrawableCompatState copy, Callback owner, Resources res) { if (copy != null) { this.mChangingConfigurations = copy.mChangingConfigurations; if (copy.mVectorDrawable != null) { ConstantState cs = copy.mVectorDrawable.getConstantState(); if (res != null) { this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable(res); } else { this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable(); } this.mVectorDrawable = (VectorDrawableCompat) this.mVectorDrawable.mutate(); this.mVectorDrawable.setCallback(owner); this.mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds()); this.mVectorDrawable.setAllowCaching(false); } if (copy.mAnimators != null) { int numAnimators = copy.mAnimators.size(); this.mAnimators = new ArrayList(numAnimators); this.mTargetNameMap = new ArrayMap(numAnimators); for (int i = 0; i < numAnimators; i++) { Animator anim = (Animator) copy.mAnimators.get(i); Animator animClone = anim.clone(); String targetName = (String) copy.mTargetNameMap.get(anim); animClone.setTarget(this.mVectorDrawable.getTargetByName(targetName)); this.mAnimators.add(animClone); this.mTargetNameMap.put(animClone, targetName); } } } }
public C0004d(Context context, C0004d c0004d, Callback callback, Resources resources) { int i = 0; if (c0004d != null) { this.f12a = c0004d.f12a; if (c0004d.f13b != null) { ConstantState constantState = c0004d.f13b.getConstantState(); if (resources != null) { this.f13b = (C0011l) constantState.newDrawable(resources); } else { this.f13b = (C0011l) constantState.newDrawable(); } this.f13b = (C0011l) this.f13b.mutate(); this.f13b.setCallback(callback); this.f13b.setBounds(c0004d.f13b.getBounds()); this.f13b.m34a(false); } if (c0004d.f14c != null) { int size = c0004d.f14c.size(); this.f14c = new ArrayList(size); this.f15d = new C0107a(size); while (i < size) { Animator animator = (Animator) c0004d.f14c.get(i); Animator clone = animator.clone(); String str = (String) c0004d.f15d.get(animator); clone.setTarget(this.f13b.m33a(str)); this.f14c.add(clone); this.f15d.put(clone, str); i++; } } } }
@Override public void invalidateDrawable(@NonNull Drawable who) { Callback callback = getCallback(); if (callback != null) { callback.invalidateDrawable(this); } }
@Override public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) { Callback callback = getCallback(); if (callback != null) { callback.scheduleDrawable(this, what, when); } }
@Override public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) { Callback callback = getCallback(); if (callback != null) { callback.unscheduleDrawable(this, what); } }
@Override public void invalidateDrawable(@NonNull Drawable who) { final Callback callback = callbackWeakReference.get(); if (callback != null) { callback.invalidateDrawable(who); } checkCanFinishAnimation(who); }
@Override public void scheduleDrawable(@NonNull Drawable who, @NonNull Runnable what, long when) { final Callback callback = callbackWeakReference.get(); if (callback != null) { callback.scheduleDrawable(who, what, when); } }
@Override public void unscheduleDrawable(@NonNull Drawable who, @NonNull Runnable what) { final Callback callback = callbackWeakReference.get(); if (callback != null) { callback.unscheduleDrawable(who, what); } }
public Ring(Drawable.Callback paramCallback) { this.mCallback = paramCallback; this.mPaint.setStrokeCap(Paint.Cap.SQUARE); this.mPaint.setAntiAlias(true); this.mPaint.setStyle(Paint.Style.STROKE); this.mArrowPaint.setStyle(Paint.Style.FILL); this.mArrowPaint.setAntiAlias(true); }
public Spannable emojify(CharSequence text, Callback callback) { Matcher matches = EMOJI_RANGE.matcher(text); SpannableStringBuilder builder = new SpannableStringBuilder(text); while (matches.find()) { int codePoint = matches.group().codePointAt(0); Drawable drawable = getEmojiDrawable(codePoint, EMOJI_SMALL); if (drawable != null) { builder.setSpan(new InvalidatingDrawableSpan(drawable, callback), matches.start(), matches.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } return builder; }
public final void invalidateDrawable(Drawable paramDrawable) { if (fg.cD()) { Drawable.Callback localCallback = getCallback(); if (localCallback != null) localCallback.invalidateDrawable(this); } }
public final void scheduleDrawable(Drawable paramDrawable, Runnable paramRunnable, long paramLong) { if (fg.cD()) { Drawable.Callback localCallback = getCallback(); if (localCallback != null) localCallback.scheduleDrawable(this, paramRunnable, paramLong); } }
public final void unscheduleDrawable(Drawable paramDrawable, Runnable paramRunnable) { if (fg.cD()) { Drawable.Callback localCallback = getCallback(); if (localCallback != null) localCallback.unscheduleDrawable(this, paramRunnable); } }
@Override public void scheduleDrawable(@NonNull final Drawable who, @NonNull final Runnable what, final long when) { for (int i = 0; i < mCallbacks.size(); i++) { final CallbackWeakReference reference = mCallbacks.get(i); final Callback callback = reference.get(); if (callback != null) { callback.scheduleDrawable(who, what, when); } else { // Always remove null references to reduce Set size mCallbacks.remove(reference); } } }
@Override public void unscheduleDrawable(@NonNull final Drawable who, @NonNull final Runnable what) { for (int i = 0; i < mCallbacks.size(); i++) { final CallbackWeakReference reference = mCallbacks.get(i); final Callback callback = reference.get(); if (callback != null) { callback.unscheduleDrawable(who, what); } else { // Always remove null references to reduce list size mCallbacks.remove(reference); } } }
/** * Associates given {@link Callback}. If callback has been already added, nothing happens. * * @param callback Callback to be associated */ public void addView(final Callback callback) { for (int i = 0; i < mCallbacks.size(); i++) { final CallbackWeakReference reference = mCallbacks.get(i); final Callback item = reference.get(); if (item == null) { // Always remove null references to reduce list size mCallbacks.remove(reference); } } mCallbacks.addIfAbsent(new CallbackWeakReference(callback)); }
/** * Disassociates given {@link Callback}. If callback is not associated, nothing happens. * * @param callback Callback to be disassociated */ public void removeView(final Callback callback) { for (int i = 0; i < mCallbacks.size(); i++) { final CallbackWeakReference reference = mCallbacks.get(i); final Callback item = reference.get(); if (item == null || item == callback) { // Always remove null references to reduce list size mCallbacks.remove(reference); } } }
public AnimatingImageSpan(Drawable drawable, Callback callback) { super(drawable, ALIGN_BOTTOM); drawable.setCallback(callback); }
AnimatingImageSpan(Drawable drawable, Callback callback) { super(drawable, ALIGN_BOTTOM); drawable.setCallback(callback); }
public AnimationDrawableCallback(AnimationDrawable animationDrawable, Callback callback) { lastFrameWeakReference = new WeakReference<>( animationDrawable.getFrame(animationDrawable.getNumberOfFrames() - 1)); callbackWeakReference = new WeakReference<>(callback); }
public InvalidatingDrawableSpan(Drawable drawable, Callback callback) { super(drawable, ALIGN_BOTTOM); drawable.setCallback(callback); }
CallbackWeakReference(final Callback r) { super(r); }
@Override public int hashCode() { final Callback callback = get(); return callback != null ? callback.hashCode() : 0; }
/** * Constructor. * * @param animationDrawable the {@link AnimationDrawable}. * @param callback the client's {@link Callback} implementation. This is usually the {@link View} the has the * {@link AnimationDrawable} as background. */ public TakePictureAnimationDrawableCallback(AnimationDrawable animationDrawable, Callback callback) { super(animationDrawable, callback); }
/** * Constructor. * * @param animationDrawable the {@link AnimationDrawable}. * @param callback the client's {@link Callback} implementation. This is usually the {@link View} the has the * {@link AnimationDrawable} as background. */ public AnimationDrawableCallback(AnimationDrawable animationDrawable, Callback callback) { mTotalFrames = animationDrawable.getNumberOfFrames(); mLastFrame = animationDrawable.getFrame(mTotalFrames - 1); mWrappedCallback = callback; }