當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。