private void clearDrawable() {
   Drawable drawable = getDrawable();
   if (drawable instanceof ImageDrawable) {
     ((ImageDrawable) drawable).recycle();
   }
   setDrawable(null);
 }
  @Override
  public boolean onGetValue(@NonNull ImageBitmap value, int source) {
    ImageDrawable drawable;
    try {
      drawable = new ImageDrawable(value);
    } catch (RecycledException e) {
      Log.d(TAG, "The ImageBitmap is recycled", e);
      return false;
    }

    clearDrawable();

    setDrawable(drawable);
    drawable.start();

    return true;
  }