@Test public void testViewInvalidate() { final MultiCallback viewInvalidateMultiCallback = new MultiCallback(true); viewInvalidateMultiCallback.addView(view); drawable.setCallback(viewInvalidateMultiCallback); drawable.invalidateSelf(); verify(view).invalidate(); }
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) { mCallbacks.remove(reference); } } mCallbacks.addIfAbsent(new CallbackWeakReference(callback)); }
MultiCallback implements Callback { 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) { mCallbacks.remove(reference); } } mCallbacks.addIfAbsent(new CallbackWeakReference(callback)); } }
MultiCallback implements Callback { 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) { mCallbacks.remove(reference); } } mCallbacks.addIfAbsent(new CallbackWeakReference(callback)); } MultiCallback();  MultiCallback(final boolean useViewInvalidate); }
MultiCallback implements Callback { 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) { mCallbacks.remove(reference); } } mCallbacks.addIfAbsent(new CallbackWeakReference(callback)); } MultiCallback();  MultiCallback(final boolean useViewInvalidate); @Override void invalidateDrawable(@NonNull final Drawable who); @Override void scheduleDrawable(@NonNull final Drawable who, @NonNull final Runnable what, final long when); @Override void unscheduleDrawable(@NonNull final Drawable who, @NonNull final Runnable what); void addView(final Callback callback); void removeView(final Callback callback); }
MultiCallback implements Callback { 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) { mCallbacks.remove(reference); } } mCallbacks.addIfAbsent(new CallbackWeakReference(callback)); } MultiCallback();  MultiCallback(final boolean useViewInvalidate); @Override void invalidateDrawable(@NonNull final Drawable who); @Override void scheduleDrawable(@NonNull final Drawable who, @NonNull final Runnable what, final long when); @Override void unscheduleDrawable(@NonNull final Drawable who, @NonNull final Runnable what); void addView(final Callback callback); void removeView(final Callback callback);  }