当前位置: 首页>>代码示例>>Java>>正文


Java Target.getRequest方法代码示例

本文整理汇总了Java中com.bumptech.glide.request.target.Target.getRequest方法的典型用法代码示例。如果您正苦于以下问题:Java Target.getRequest方法的具体用法?Java Target.getRequest怎么用?Java Target.getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.bumptech.glide.request.target.Target的用法示例。


在下文中一共展示了Target.getRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: untrackOrDelegate

import com.bumptech.glide.request.target.Target; //导入方法依赖的package包/类
private void untrackOrDelegate(Target<?> target) {
  boolean isOwnedByUs = untrack(target);
  // We'll end up here if the Target was cleared after the RequestManager that started the request
  // is destroyed. That can happen for at least two reasons:
  // 1. We call clear() on a background thread using something other than Application Context
  // RequestManager.
  // 2. The caller retains a reference to the RequestManager after the corresponding Activity or
  // Fragment is destroyed, starts a load with it, and then clears that load with a different
  // RequestManager. Callers seem especially likely to do this in retained Fragments (#2262).
  //
  // #1 is always an error. At best the caller is leaking memory briefly in something like an
  // AsyncTask. At worst the caller is leaking an Activity or Fragment for a sustained period of
  // time if they do something like reference the Activity RequestManager in a long lived
  // background thread or task.
  //
  // #2 is always an error. Callers shouldn't be starting new loads using RequestManagers after
  // the corresponding Activity or Fragment is destroyed because retaining any reference to the
  // RequestManager leaks memory. It's possible that there's some brief period of time during or
  // immediately after onDestroy where this is reasonable, but I can't think of why.
  if (!isOwnedByUs && !glide.removeFromManagers(target) && target.getRequest() != null) {
    Request request = target.getRequest();
    target.setRequest(null);
    request.clear();
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:RequestManager.java

示例2: untrack

import com.bumptech.glide.request.target.Target; //导入方法依赖的package包/类
boolean untrack(Target<?> target) {
  Request request = target.getRequest();
  // If the Target doesn't have a request, it's already been cleared.
  if (request == null) {
    return true;
  }

  if (requestTracker.clearRemoveAndRecycle(request)) {
    targetTracker.untrack(target);
    target.setRequest(null);
    return true;
  } else {
    return false;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RequestManager.java


注:本文中的com.bumptech.glide.request.target.Target.getRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。