com.bumptech.glide.request.target.ViewTarget.getTag()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(99)

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

ViewTarget.getTag介绍

暂无

代码示例

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

/**
 * Returns any stored request using {@link android.view.View#getTag()}.
 *
 * <p> For Glide to function correctly, Glide must be the only thing that calls {@link
 * View#setTag(Object)}. If the tag is cleared or put to another object type, Glide will not be
 * able to retrieve and cancel previous loads which will not only prevent Glide from reusing
 * resource, but will also result in incorrect images being loaded and lots of flashing of images
 * in lists. As a result, this will throw an {@link java.lang.IllegalArgumentException} if {@link
 * android.view.View#getTag()}} returns a non null object that is not an {@link
 * com.bumptech.glide.request.Request}. </p>
 */
@Override
@Nullable
public Request getRequest() {
 Object tag = getTag();
 Request request = null;
 if (tag != null) {
  if (tag instanceof Request) {
   request = (Request) tag;
  } else {
   throw new IllegalArgumentException(
     "You must not call setTag() on a view Glide is targeting");
  }
 }
 return request;
}

代码示例来源:origin: guolindev/giffun

/**
 * Returns any stored request using {@link View#getTag()}.
 *
 * <p>
 *     For Glide to function correctly, Glide must be the only thing that calls {@link View#setTag(Object)}. If the
 *     tag is cleared or set to another object type, Glide will not be able to retrieve and cancel previous loads
 *     which will not only prevent Glide from reusing resource, but will also result in incorrect images being
 *     loaded and lots of flashing of images in lists. As a result, this will throw an
 *     {@link IllegalArgumentException} if {@link View#getTag()}} returns a non null object
 *     that is not an {@link Request}.
 * </p>
 */
@Override
public Request getRequest() {
  Object tag = getTag();
  Request request = null;
  if (tag != null) {
    if (tag instanceof Request) {
      request = (Request) tag;
    } else {
      throw new IllegalArgumentException("You must not call setTag() on a view Glide is targeting");
    }
  }
  return request;
}

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

/**
 * Returns any stored request using {@link android.view.View#getTag()}.
 *
 * <p> For Glide to function correctly, Glide must be the only thing that calls {@link
 * View#setTag(Object)}. If the tag is cleared or put to another object type, Glide will not be
 * able to retrieve and cancel previous loads which will not only prevent Glide from reusing
 * resource, but will also result in incorrect images being loaded and lots of flashing of images
 * in lists. As a result, this will throw an {@link java.lang.IllegalArgumentException} if {@link
 * android.view.View#getTag()}} returns a non null object that is not an {@link
 * com.bumptech.glide.request.Request}. </p>
 */
@Override
@Nullable
public Request getRequest() {
 Object tag = getTag();
 Request request = null;
 if (tag != null) {
  if (tag instanceof Request) {
   request = (Request) tag;
  } else {
   throw new IllegalArgumentException(
     "You must not call setTag() on a view Glide is targeting");
  }
 }
 return request;
}

相关文章