/** * Cancels all requests in this queue with the given tag. Tag must be non-null * and equality is by identity. */ public void cancelAll(final Object tag) { if (tag == null) { throw new IllegalArgumentException("Cannot cancelAll with a null tag"); } cancelAll(new RequestFilter() { @Override public boolean apply(Request<?> request) { return request.getTag() == tag; } }); }
/** * Cancels all requests in this queue with the given tag. Tag must be non-null * and equality is by identity. */ public void cancelAll(final Object tag) { if (tag == null) { throw new IllegalArgumentException("Cannot cancelAll with a null tag"); } cancelAll(new RequestFilter() { @Override public boolean apply(Request<?> request) { return request.getTag() == tag; } }); }
/** * Cancels all requests in this queue with the given tag. Tag must be non-null * and equality is by identity. */ public void cancelAll(final Object tag) { if (tag == null) { throw new IllegalArgumentException("Cannot cancelAll with a null tag"); } cancelAll(new RequestFilter() { @Override public boolean apply(Request<?> request) { return request.getTag() == tag; } }); }
@Override public void onPause() { super.onPause(); App.getRequestQueue().cancelAll(TAG + "refresh"); App.getRequestQueue().cancelAll(TAG+"loadmore"); if (swipeToLoadLayout.isRefreshing()) { swipeToLoadLayout.setRefreshing(false); } if (swipeToLoadLayout.isLoadingMore()) { swipeToLoadLayout.setLoadingMore(false); } }
@Override public void onPause() { super.onPause(); App.getRequestQueue().cancelAll(TAG + "refresh" + mType); App.getRequestQueue().cancelAll(TAG + "loadmore" + mType); if (swipeToLoadLayout.isRefreshing()) { swipeToLoadLayout.setRefreshing(false); } if (swipeToLoadLayout.isLoadingMore()) { swipeToLoadLayout.setLoadingMore(false); } mAdapter.stop(); }
@Override public void onPause() { super.onPause(); App.getRequestQueue().cancelAll(TAG + "refresh" + mType); App.getRequestQueue().cancelAll(TAG + "loadmore" + mType); if (swipeToLoadLayout.isRefreshing()) { swipeToLoadLayout.setRefreshing(false); } if (swipeToLoadLayout.isLoadingMore()) { swipeToLoadLayout.setLoadingMore(false); } mAdapter.stop(); }
@Override public void onPause() { super.onPause(); App.getRequestQueue().cancelAll(TAG); if (swipeToLoadLayout.isRefreshing()) { swipeToLoadLayout.setRefreshing(false); } if (swipeToLoadLayout.isLoadingMore()) { swipeToLoadLayout.setLoadingMore(false); } if (mPagerAdapter != null) { mPagerAdapter.stop(); } }
@Override public void onPause() { super.onPause(); App.getRequestQueue().cancelAll(TAG); if (swipeToLoadLayout.isRefreshing()) { swipeToLoadLayout.setRefreshing(false); } if (swipeToLoadLayout.isLoadingMore()) { swipeToLoadLayout.setLoadingMore(false); } }
@Test public void cancelAll_onlyCorrectTag() throws Exception { RequestQueue queue = new RequestQueue(new NoCache(), mMockNetwork, 0, mDelivery); Object tagA = new Object(); Object tagB = new Object(); Request req1 = mock(Request.class); when(req1.getTag()).thenReturn(tagA); Request req2 = mock(Request.class); when(req2.getTag()).thenReturn(tagB); Request req3 = mock(Request.class); when(req3.getTag()).thenReturn(tagA); Request req4 = mock(Request.class); when(req4.getTag()).thenReturn(tagA); queue.add(req1); // A queue.add(req2); // B queue.add(req3); // A queue.cancelAll(tagA); queue.add(req4); // A verify(req1).cancel(); // A cancelled verify(req3).cancel(); // A cancelled verify(req2, never()).cancel(); // B not cancelled verify(req4, never()).cancel(); // A added after cancel not cancelled } }
@Test public void cancelAll_onlyCorrectTag() throws Exception { RequestQueue queue = new RequestQueue(new NoCache(), mMockNetwork, 0, mDelivery); Object tagA = new Object(); Object tagB = new Object(); Request req1 = mock(Request.class); when(req1.getTag()).thenReturn(tagA); Request req2 = mock(Request.class); when(req2.getTag()).thenReturn(tagB); Request req3 = mock(Request.class); when(req3.getTag()).thenReturn(tagA); Request req4 = mock(Request.class); when(req4.getTag()).thenReturn(tagA); queue.add(req1); // A queue.add(req2); // B queue.add(req3); // A queue.cancelAll(tagA); queue.add(req4); // A verify(req1).cancel(); // A cancelled verify(req3).cancel(); // A cancelled verify(req2, never()).cancel(); // B not cancelled verify(req4, never()).cancel(); // A added after cancel not cancelled } }
@Override public void onDismiss(DialogInterface dialog) { requestQueue.cancelAll(this); currencyPairsMapHelper = null; }
public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } }
public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } }
public void cancelPendingRequests(Object tag) { if (bRequestQueue != null) { bRequestQueue.cancelAll(tag); } }
@Override protected void onStop () { super.onStop(); // Cancel all requests(Chromium's latest build is updated CONSTANTLY). if (mRequestQueue != null) { mRequestQueue.cancelAll(TAG); } } }
public static void cancelPendingRequests(Context context, Object tag) { if (mRequestQueue == null) getRequestQueue(context); mRequestQueue.cancelAll(tag); } }
@Override protected void onStop() { super.onStop(); MyApplication.getHttpRequestQueue().cancelAll("jackStringRequest"); MyApplication.getHttpRequestQueue().cancelAll("jackJsonObjectRequest"); MyApplication.getHttpRequestQueue().cancelAll("jackPost"); MyApplication.getHttpRequestQueue().cancelAll("jsonPost"); } }
/** * Cancel the app's request queue : cancel all requests remaining in the queue */ void cancelQueue() { RequestQueue.RequestFilter filterForAll = request -> true; mRequestQueue.cancelAll(filterForAll); Timber.d("RequestQueue ::: canceled"); } }
@Override protected void onDestroy() { super.onDestroy(); if (mDLCompleteReceiver != null) unregisterReceiver(mDLCompleteReceiver); VolleyManager.getInstance(this).getRequestQ().cancelAll(CANCELABLE_REQUEST_TAG); } }
@Override public void onDestroy() { OkVolley.getInstance().getRequestQueue().cancelAll(new RequestQueue.RequestFilter() { @Override public boolean apply(Request<?> request) { return request.getTag() != null && request.getTag().equals("request"); } }); super.onDestroy(); }