Java Code Examples for android.graphics.drawable.Drawable#Callback
The following examples show how to use
android.graphics.drawable.Drawable#Callback .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageAssetBitmapManager.java From atlas with Apache License 2.0 | 6 votes |
ImageAssetBitmapManager(Drawable.Callback callback, String imagesFolder, ImageAssetDelegate assetDelegate, Map<String, LottieImageAsset> imageAssets) { assertNotNull(callback); this.imagesFolder = imagesFolder; if (!TextUtils.isEmpty(imagesFolder) && this.imagesFolder.charAt(this.imagesFolder.length() - 1) != '/') { this.imagesFolder += '/'; } if (!(callback instanceof View)) { Log.w(L.TAG, "LottieDrawable must be inside of a view for images to work."); this.imageAssets = new HashMap<>(); context = null; return; } context = ((View) callback).getContext(); this.imageAssets = imageAssets; setAssetDelegate(assetDelegate); }
Example 2
Source File: ImageAssetManager.java From lottie-android with Apache License 2.0 | 6 votes |
public ImageAssetManager(Drawable.Callback callback, String imagesFolder, ImageAssetDelegate delegate, Map<String, LottieImageAsset> imageAssets) { this.imagesFolder = imagesFolder; if (!TextUtils.isEmpty(imagesFolder) && this.imagesFolder.charAt(this.imagesFolder.length() - 1) != '/') { this.imagesFolder += '/'; } if (!(callback instanceof View)) { Logger.warning("LottieDrawable must be inside of a view for images to work."); this.imageAssets = new HashMap<>(); context = null; return; } context = ((View) callback).getContext(); this.imageAssets = imageAssets; setDelegate(delegate); }
Example 3
Source File: DrawableUtils.java From ImageLoader with Apache License 2.0 | 5 votes |
/** * Sets callback to the drawable. * @param drawable drawable to set callbacks to * @param callback standard Android Drawable.Callback * @param transformCallback TransformCallback used by TransformAwareDrawables */ public static void setCallbacks( Drawable drawable, @Nullable Drawable.Callback callback, @Nullable TransformCallback transformCallback) { if (drawable != null) { drawable.setCallback(callback); if (drawable instanceof TransformAwareDrawable) { ((TransformAwareDrawable) drawable).setTransformCallback(transformCallback); } } }
Example 4
Source File: FontAssetManager.java From lottie-android with Apache License 2.0 | 5 votes |
public FontAssetManager(Drawable.Callback callback, @Nullable FontAssetDelegate delegate) { this.delegate = delegate; if (!(callback instanceof View)) { Logger.warning("LottieDrawable must be inside of a view for images to work."); assetManager = null; return; } assetManager = ((View) callback).getContext().getAssets(); }
Example 5
Source File: DrawableUtils.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
/** * Sets callback to the drawable. * @param drawable drawable to set callbacks to * @param callback standard Android Drawable.Callback * @param transformCallback TransformCallback used by TransformAwareDrawables */ public static void setCallbacks( Drawable drawable, @Nullable Drawable.Callback callback, @Nullable TransformCallback transformCallback) { if (drawable != null) { drawable.setCallback(callback); if (drawable instanceof TransformAwareDrawable) { ((TransformAwareDrawable) drawable).setTransformCallback(transformCallback); } } }
Example 6
Source File: DrawableUtils.java From fresco with MIT License | 5 votes |
/** * Sets callback to the drawable. * * @param drawable drawable to set callbacks to * @param callback standard Android Drawable.Callback * @param transformCallback TransformCallback used by TransformAwareDrawables */ public static void setCallbacks( @Nullable Drawable drawable, @Nullable Drawable.Callback callback, @Nullable TransformCallback transformCallback) { if (drawable != null) { drawable.setCallback(callback); if (drawable instanceof TransformAwareDrawable) { ((TransformAwareDrawable) drawable).setTransformCallback(transformCallback); } } }
Example 7
Source File: SettableDrawableTest.java From fresco with MIT License | 5 votes |
@Test public void testSetCurrent() { Drawable.Callback callback = mock(Drawable.Callback.class); mSettableDrawable.setCallback(callback); mSettableDrawable.setDrawable(mUnderlyingDrawable1); verify(mUnderlyingDrawable0).setCallback(null); verify(mUnderlyingDrawable1).setCallback(isNotNull(Drawable.Callback.class)); verify(callback).invalidateDrawable(mSettableDrawable); }
Example 8
Source File: DrawableHelper.java From ProjectX with Apache License 2.0 | 5 votes |
/** * 获取View类型的回调 * * @param drawable Drawable * @return View */ static View getViewCallback(Drawable drawable) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) return null; final Drawable.Callback callback = drawable.getCallback(); if (callback instanceof View) return (View) callback; else if (callback instanceof Drawable) return getViewCallback((Drawable) callback); else return null; }
Example 9
Source File: AbstractDrawableAssert.java From assertj-android with Apache License 2.0 | 5 votes |
@TargetApi(HONEYCOMB) public S hasCallback(Drawable.Callback callback) { isNotNull(); Drawable.Callback actualCallback = actual.getCallback(); assertThat(actualCallback) // .overridingErrorMessage("Expected callback <%s> but was <%s>.", callback, actualCallback) // .isSameAs(callback); return myself; }
Example 10
Source File: ZLoadingBuilder.java From AndroidWallet with GNU General Public License v3.0 | 4 votes |
void setCallback(Drawable.Callback callback) { this.mCallback = callback; }
Example 11
Source File: LoadingRenderer.java From DevUtils with Apache License 2.0 | 4 votes |
void setCallback(Drawable.Callback callback) { this.mCallback = callback; }
Example 12
Source File: ZLoadingBuilder.java From ZLoading with MIT License | 4 votes |
void setCallback(Drawable.Callback callback) { this.mCallback = callback; }
Example 13
Source File: GenericDraweeHierarchyTest.java From fresco with MIT License | 4 votes |
private void verifyCallback(Drawable parent, Drawable child) { Drawable.Callback callback = mock(Drawable.Callback.class); parent.setCallback(callback); child.invalidateSelf(); verify(callback).invalidateDrawable(any(Drawable.class)); }
Example 14
Source File: RippleDrawable.java From Carbon with Apache License 2.0 | votes |
void setCallback(Drawable.Callback cb);