Java Code Examples for com.bumptech.glide.request.Request#clear()
The following examples show how to use
com.bumptech.glide.request.Request#clear() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenericRequestBuilder.java From giffun with Apache License 2.0 | 6 votes |
/** * Set the target the resource will be loaded into. * * @see Glide#clear(Target) * * @param target The target to load the resource into. * @return The given target. */ public <Y extends Target<TranscodeType>> Y into(Y target) { Util.assertMainThread(); if (target == null) { throw new IllegalArgumentException("You must pass in a non null Target"); } if (!isModelSet) { throw new IllegalArgumentException("You must first set a model (try #load())"); } Request previous = target.getRequest(); if (previous != null) { previous.clear(); requestTracker.removeRequest(previous); previous.recycle(); } Request request = buildRequest(target); target.setRequest(request); lifecycle.addListener(target); requestTracker.runRequest(request); return target; }
Example 2
Source File: RequestTracker.java From giffun with Apache License 2.0 | 5 votes |
/** * Cancels all requests and clears their resources. */ public void clearRequests() { for (Request request : Util.getSnapshot(requests)) { request.clear(); } pendingRequests.clear(); }
Example 3
Source File: Glide.java From giffun with Apache License 2.0 | 5 votes |
/** * Cancel any pending loads Glide may have for the target and free any resources (such as {@link Bitmap}s) that may * have been loaded for the target so they may be reused. * * @param target The Target to cancel loads for. */ public static void clear(Target<?> target) { Util.assertMainThread(); Request request = target.getRequest(); if (request != null) { request.clear(); target.setRequest(null); } }