android.graphics.drawable.Drawable.getCallback()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中android.graphics.drawable.Drawable.getCallback()方法的一些代码示例,展示了Drawable.getCallback()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Drawable.getCallback()方法的具体详情如下:
包路径:android.graphics.drawable.Drawable
类名称:Drawable
方法名:getCallback

Drawable.getCallback介绍

暂无

代码示例

代码示例来源:origin: bumptech/glide

@Override
public Callback getCallback() {
 return wrapped.getCallback();
}

代码示例来源:origin: facebook/litho

@Nullable
 private static View getHostView(Drawable drawable) {
  Drawable.Callback callback;
  while (true) {
   callback = drawable.getCallback();
   if (callback instanceof Drawable) {
    drawable = (Drawable) callback;
   } else if (callback instanceof View) {
    return (View) callback;
   } else {
    return null;
   }
  }
 }
}

代码示例来源:origin: bumptech/glide

private Callback findCallback() {
 Callback callback = getCallback();
 while (callback instanceof Drawable) {
  callback = ((Drawable) callback).getCallback();
 }
 return callback;
}

代码示例来源:origin: facebook/litho

@Nullable
 private static Object resolveReference(WeakReference<Object> mountContentRef) {
  final Object mountContent = mountContentRef != null ? mountContentRef.get() : null;
  if (mountContent == null) {
   return null;
  }
  if ((mountContent instanceof Drawable) && ((Drawable) mountContent).getCallback() == null) {
   // MountContent have been already unmounted but we still hold reference to it, so let's clear
   // up the reference and return null. Actual unmounting of a view can be deferred, so don't
   // check it here
   mountContentRef.clear();
   return null;
  }
  return mountContent;
 }
}

代码示例来源:origin: square/assertj-android

@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;
}

代码示例来源:origin: facebook/litho

public static DisplayListDrawable acquireDisplayListDrawable(Drawable content) {
 // When we are wrapping drawable with DisplayListDrawable we need to make sure that
 // wrapped DisplayListDrawable has the same view callback as original one had for correct
 // view invalidations.
 final Drawable.Callback callback = content.getCallback();
 DisplayListDrawable displayListDrawable =
   ComponentsConfiguration.disablePools ? null : sDisplayListDrawablePool.acquire();
 if (displayListDrawable == null) {
  displayListDrawable = new DisplayListDrawable(content);
 } else {
  displayListDrawable.setWrappedDrawable(content);
 }
 displayListDrawable.setCallback(callback);
 return displayListDrawable;
}

代码示例来源:origin: facebook/litho

@Test
public void testCallbacks() {
 Drawable d = new ColorDrawable();
 assertThat(d.getCallback()).isNull();
 MountItem mountItem = mount(0, d);
 assertThat(d.getCallback()).isEqualTo(mHost);
 unmount(0, mountItem);
 assertThat(d.getCallback()).isNull();
}

代码示例来源:origin: DreaminginCodeZH/MaterialProgressBar

d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
try {
  if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {

代码示例来源:origin: mozilla-tw/Rocket

@Override
public Callback getCallback() {
 return wrapped.getCallback();
}

代码示例来源:origin: square1-io/rich-text-android

@Override
public void onViewDetachedFromWindow(View viewDisplay) {
  if (mBitmap != null && mBitmap.getCallback() == viewDisplay) {
    mBitmap.setCallback(null);
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

@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;
}

代码示例来源:origin: jbruchanov/AnUitor

data.put("Callback", String.valueOf(d.getCallback()));

代码示例来源:origin: noties/Markwon

@Test
public void previous_result_detached() {
  // when result is present it will be detached (setCallback(null))
  final AsyncDrawable drawable = new AsyncDrawable("",
      mock(AsyncDrawable.Loader.class),
      imageSizeResolver,
      null);
  drawable.setCallback2(mock(Drawable.Callback.class));
  drawable.initWithKnownDimensions(100, 1);
  final Drawable result1 = new AbstractDrawable();
  final Drawable result2 = new AbstractDrawable();
  drawable.setResult(result1);
  assertNotNull(result1.getCallback());
  drawable.setResult(result2);
  assertNull(result1.getCallback());
  assertNotNull(result2.getCallback());
}

代码示例来源:origin: com.albedinsky.android/ui-graphics-base

/**
 * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>.
 *
 * @param drawable The drawable to wrap.
 */
public DrawableWrapper(@NonNull Drawable drawable) {
  this.mDrawable = drawable;
  /**
   * Copy current state of the wrapped drawable.
   */
  setState(drawable.getState());
  setBounds(drawable.getBounds());
  setLevel(drawable.getLevel());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    setCallback(drawable.getCallback());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    setAlpha(drawable.getAlpha());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setColorFilter(drawable.getColorFilter());
  }
  mDrawable.setCallback(this);
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>.
 *
 * @param drawable The drawable to wrap.
 */
public DrawableWrapper(@NonNull Drawable drawable) {
  this.mDrawable = drawable;
  /**
   * Copy current state of the wrapped drawable.
   */
  setState(drawable.getState());
  setBounds(drawable.getBounds());
  setLevel(drawable.getLevel());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    setCallback(drawable.getCallback());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    setAlpha(drawable.getAlpha());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setColorFilter(drawable.getColorFilter());
  }
  mDrawable.setCallback(this);
}

代码示例来源:origin: com.albedinsky.android/ui-graphics

/**
 * Creates a new instance of DrawableWrapper which wraps the given <var>drawable</var>.
 *
 * @param drawable The drawable to wrap.
 */
public DrawableWrapper(@NonNull Drawable drawable) {
  this.mDrawable = drawable;
  /**
   * Copy current state of the wrapped drawable.
   */
  setState(drawable.getState());
  setBounds(drawable.getBounds());
  setLevel(drawable.getLevel());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    setCallback(drawable.getCallback());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    setAlpha(drawable.getAlpha());
  } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setColorFilter(drawable.getColorFilter());
  }
  mDrawable.setCallback(this);
}

相关文章