@Test public void cancelNullTagThrows() { try { picasso.cancelTag(null); fail("Canceling with a null tag should throw exception."); } catch (IllegalArgumentException expected) { } }
public void cancelTag(@NonNull Object tag) { checkMain(); if (tag == null) { throw new IllegalArgumentException("Cannot cancel requests with null tag."); } List<Action> actions = new ArrayList<>(targetToAction.values()); for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } }
Picasso { public void cancelTag(@NonNull Object tag) { checkMain(); if (tag == null) { throw new IllegalArgumentException("Cannot cancel requests with null tag."); } List<Action> actions = new ArrayList<>(targetToAction.values()); for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } } }
Picasso { public void cancelTag(@NonNull Object tag) { checkMain(); if (tag == null) { throw new IllegalArgumentException("Cannot cancel requests with null tag."); } List<Action> actions = new ArrayList<>(targetToAction.values()); for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); }
Picasso { public void cancelTag(@NonNull Object tag) { checkMain(); if (tag == null) { throw new IllegalArgumentException("Cannot cancel requests with null tag."); } List<Action> actions = new ArrayList<>(targetToAction.values()); for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); void cancelRequest(@NonNull ImageView view); void cancelRequest(@NonNull Target target); void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId); void cancelTag(@NonNull Object tag); void pauseTag(@NonNull Object tag); void resumeTag(@NonNull Object tag); RequestCreator load(@Nullable Uri uri); RequestCreator load(@Nullable String path); RequestCreator load(@NonNull File file); RequestCreator load(@DrawableRes int resourceId); void invalidate(@Nullable Uri uri); void invalidate(@Nullable String path); void invalidate(@NonNull File file); @SuppressWarnings("UnusedDeclaration") void setIndicatorsEnabled(boolean enabled); @SuppressWarnings("UnusedDeclaration") boolean areIndicatorsEnabled(); @SuppressWarnings("UnusedDeclaration") // Public API. void setLoggingEnabled(boolean enabled); boolean isLoggingEnabled(); @SuppressWarnings("UnusedDeclaration") StatsSnapshot getSnapshot(); void shutdown(); static Picasso with(@NonNull Context context); static void setSingletonInstance(@NonNull Picasso picasso); }
Picasso { public void cancelTag(@NonNull Object tag) { checkMain(); if (tag == null) { throw new IllegalArgumentException("Cannot cancel requests with null tag."); } List<Action> actions = new ArrayList<>(targetToAction.values()); for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } } Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener,
      RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats,
      Bitmap.Config defaultBitmapConfig, boolean indicatorsEnabled, boolean loggingEnabled); void cancelRequest(@NonNull ImageView view); void cancelRequest(@NonNull Target target); void cancelRequest(@NonNull RemoteViews remoteViews, @IdRes int viewId); void cancelTag(@NonNull Object tag); void pauseTag(@NonNull Object tag); void resumeTag(@NonNull Object tag); RequestCreator load(@Nullable Uri uri); RequestCreator load(@Nullable String path); RequestCreator load(@NonNull File file); RequestCreator load(@DrawableRes int resourceId); void invalidate(@Nullable Uri uri); void invalidate(@Nullable String path); void invalidate(@NonNull File file); @SuppressWarnings("UnusedDeclaration") void setIndicatorsEnabled(boolean enabled); @SuppressWarnings("UnusedDeclaration") boolean areIndicatorsEnabled(); @SuppressWarnings("UnusedDeclaration") // Public API. void setLoggingEnabled(boolean enabled); boolean isLoggingEnabled(); @SuppressWarnings("UnusedDeclaration") StatsSnapshot getSnapshot(); void shutdown(); static Picasso with(@NonNull Context context); static void setSingletonInstance(@NonNull Picasso picasso);  }