Java 类com.android.volley.Response.ErrorListener 实例源码

项目:GitHub    文件:ImageLoader.java   
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight,
        ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onGetImageError(cacheKey, error);
        }
    });
}
项目:boohee_v5.6    文件:Request.java   
public Request(int method, String url, ErrorListener listener) {
    MarkerLog markerLog;
    if (MarkerLog.ENABLED) {
        markerLog = new MarkerLog();
    } else {
        markerLog = null;
    }
    this.mEventLog = markerLog;
    this.mShouldCache = true;
    this.mCanceled = false;
    this.mResponseDelivered = false;
    this.mCacheEntry = null;
    this.mMethod = method;
    this.mUrl = url;
    this.mIdentifier = createIdentifier(method, url);
    this.mErrorListener = listener;
    setRetryPolicy(new DefaultRetryPolicy());
    this.mDefaultTrafficStatsTag = findDefaultTrafficStatsTag(url);
}
项目:boohee_v5.6    文件:WelcomeActivity.java   
private void requestJson() {
    RequestManager.addRequest(new StringRequest("http://shop.boohee" +
            ".com/store/pages/story_json", new Listener<String>() {
        public void onResponse(String response) {
            try {
                List<Story> stories = Story.parseStory(response);
                if (stories != null && stories.size() > 0) {
                    WelcomeActivity.this.mDataList.clear();
                    WelcomeActivity.this.mDataList.addAll(stories);
                    WelcomeActivity.this.mAdapter.notifyDataSetChanged();
                    stories.clear();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            WelcomeActivity.this.setRefresh(false);
        }
    }, new ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            Helper.showToast(error.toString());
            WelcomeActivity.this.setRefresh(false);
        }
    }), this);
    setRefresh(true);
}
项目:boohee_v5.6    文件:ImageRequest.java   
public ImageRequest(String url, Listener<Bitmap> listener, int maxWidth, int maxHeight, ScaleType scaleType, Config decodeConfig, ErrorListener errorListener) {
    super(0, url, errorListener);
    setRetryPolicy(new DefaultRetryPolicy(1000, 2, IMAGE_BACKOFF_MULT));
    this.mListener = listener;
    this.mDecodeConfig = decodeConfig;
    this.mMaxWidth = maxWidth;
    this.mMaxHeight = maxHeight;
    this.mScaleType = scaleType;
}
项目:publicProject    文件:JRYGRequest.java   
public JRYGRequest(int method, String url, Class<T> clazz, Map<String, Object> params, Response.Listener<T> listener, Response.ErrorListener errorListener) {
    super(method, url, errorListener);
    this.url = url;
    this.mListener = listener;
    this.errorListener = errorListener;
    this.mClazz = clazz;
    this.mParams = params;
    body = getBodyString();
}
项目:publicProject    文件:JRYGRequest.java   
public JRYGRequest(String url, Class<T> clazz, Map<String, Object> params, Response.Listener<T> listener, Response.ErrorListener errorListener) {
    super(Request.Method.POST, url, errorListener);
    this.url = url;
    this.mListener = listener;
    this.errorListener = errorListener;
    this.mClazz = clazz;
    this.mParams = params;
    CommonLog.d("URL:" + url);
    body = getBodyString();
}
项目:publicProject    文件:ImageLoader.java   
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight,
        ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onGetImageError(cacheKey, error);
        }
    });
}
项目:Codeforces    文件:ImageLoader.java   
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight,
        ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onGetImageError(cacheKey, error);
        }
    });
}
项目:GeekZone    文件:ImageLoader.java   
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight,
        ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        @Override
        public void onResponse(Bitmap response) {
            onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onGetImageError(cacheKey, error);
        }
    });
}
项目:boohee_v5.6    文件:MiBandHelper.java   
public static void loadMIBndData(final Context context, final MiBandCallBack callBack) {
    String currentDate = DateHelper.today();
    Map<String, String> params = new HashMap();
    params.put("appid", XMPush.APP_ID);
    params.put("third_appid", THIRD_APP_ID);
    params.put("third_appsecret", THIRD_APP_SECRET);
    params.put("call_id", System.currentTimeMillis() + "");
    params.put("access_token", getXMToken());
    params.put("fromdate", currentDate);
    params.put("todate", currentDate);
    params.put("v", "1.0");
    params.put("l", "english");
    RequestManager.addRequest(new JsonObjectRequest(1, buildUrl(XMDataApi, params), new
            OkListener((Activity) context) {
        public void ok(JSONObject object) {
            XiaoMiSportData sportData = (XiaoMiSportData) FastJsonUtils.fromJson(object,
                    XiaoMiSportData.class);
            if (context != null && sportData != null) {
                if (!XiaoMiSportData.KEY_SUCCESS.equals(sportData.message)) {
                    MiBandHelper.lastUpdateTime = System.currentTimeMillis() - 180000;
                    callBack.onFailed("获取小米手环数据失败,请绑定小米手环并同步数据~~");
                } else if (sportData.data == null || sportData.data.size() == 0) {
                    callBack.onFailed("今日暂无数据,先同步手环数据~~");
                } else {
                    callBack.onSuccess(((SportData) sportData.data.get(0)).step);
                }
            }
        }
    }, new ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            MiBandHelper.lastUpdateTime = System.currentTimeMillis() - 180000;
            callBack.onFailed("获取小米手环数据失败,请重试~~");
        }
    }), context);
}
项目:boohee_v5.6    文件:BaseJsonRequest.java   
public BaseJsonRequest(int method, String url, JsonParams jsonParams, Listener<String>
        listener, ErrorListener errorListener) {
    JsonParams jsonParams2;
    String bestUrl = DnspodFree.getBestUrl(url);
    String host = Uri.parse(url).getHost();
    if (jsonParams == null) {
        jsonParams2 = null;
    } else {
        jsonParams2 = jsonParams;
    }
    this(method, bestUrl, host, jsonParams2, listener, errorListener);
}
项目:boohee_v5.6    文件:BaseJsonRequest.java   
public BaseJsonRequest(int method, String url, String host, JsonParams jsonParams,
                       Listener<String> listener, ErrorListener errorListener) {
    String str;
    String bestUrl = DnspodFree.getBestUrl(url);
    if (jsonParams == null) {
        str = null;
    } else {
        str = jsonParams.toString();
    }
    super(method, bestUrl, str, listener, errorListener);
    parseUrlToApi(jsonParams, host);
}
项目:boohee_v5.6    文件:ImageLoader.java   
protected Request<Bitmap> makeImageRequest(String requestUrl, int maxWidth, int maxHeight, ScaleType scaleType, final String cacheKey) {
    return new ImageRequest(requestUrl, new Listener<Bitmap>() {
        public void onResponse(Bitmap response) {
            ImageLoader.this.onGetImageSuccess(cacheKey, response);
        }
    }, maxWidth, maxHeight, scaleType, Config.RGB_565, new ErrorListener() {
        public void onErrorResponse(VolleyError error) {
            ImageLoader.this.onGetImageError(cacheKey, error);
        }
    });
}
项目:GitHub    文件:JsonRequest.java   
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
        ErrorListener errorListener) {
    super(method, url, errorListener);
    mListener = listener;
    mRequestBody = requestBody;
}
项目:boohee_v5.6    文件:StringRequest.java   
public StringRequest(int method, String url, Listener<String> listener, ErrorListener errorListener) {
    super(method, url, errorListener);
    this.mListener = listener;
}
项目:dolores-android    文件:StringRequest.java   
public StringRequest(String url, Map<String, String> map, Listener<String> listener, ErrorListener errorListener) {
    super(Method.GET, Constants.BASE_URL + url, errorListener);
    super.setShouldCache(false);
    mListener = listener;
    mMap = map;
}
项目:GitHub    文件:MockRequest.java   
public MockRequest(String url, ErrorListener listener) {
    super(Request.Method.GET, url, listener);
}
项目:GitHub    文件:JsonRequest.java   
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
        ErrorListener errorListener) {
    super(method, url, errorListener);
    mListener = listener;
    mRequestBody = requestBody;
}
项目:boohee_v5.6    文件:JsonObjectRequest.java   
public JsonObjectRequest(String url, JSONObject jsonRequest, Listener<JSONObject> listener, ErrorListener errorListener) {
    this(jsonRequest == null ? 0 : 1, url, jsonRequest, (Listener) listener, errorListener);
}
项目:boohee_v5.6    文件:JsonObjectRequest.java   
public JsonObjectRequest(int method, String url, JSONObject jsonRequest, Listener<JSONObject> listener, ErrorListener errorListener) {
    super(method, url, jsonRequest == null ? null : jsonRequest.toString(), listener, errorListener);
}
项目:GitHub    文件:MockRequest.java   
public MockRequest(String url, ErrorListener listener) {
    super(Request.Method.GET, url, listener);
}
项目:GitHub    文件:RawRequest.java   
public RawRequest(String url, Listener<byte[]> listener, ErrorListener errorListener) {
  super(0, url, errorListener);
  this.mListener = listener;
  setShouldCache(false);
}
项目:publicProject    文件:JRYGRequest.java   
public JRYGRequest(int method, String url, Response.ErrorListener listener) {
    super(method, url, listener);
    // TODO Auto-generated constructor stub
    this.url = url;
}
项目:boohee_v5.6    文件:JsonArrayRequest.java   
public JsonArrayRequest(int method, String url, Listener<JSONArray> listener, ErrorListener errorListener) {
    super(method, url, null, listener, errorListener);
}
项目:boohee_v5.6    文件:JsonArrayRequest.java   
public JsonArrayRequest(int method, String url, JSONObject jsonRequest, Listener<JSONArray> listener, ErrorListener errorListener) {
    super(method, url, jsonRequest == null ? null : jsonRequest.toString(), listener, errorListener);
}
项目:TYT    文件:JsonObjectPostRequest.java   
public JsonObjectPostRequest(String url, Listener<JSONObject> listener, ErrorListener errorListener, Map map) {
    super(Method.POST, url, errorListener);
    mListener = listener;
    mMap = map;
}
项目:AndroidCrossPromotion    文件:CustomRequest.java   
public CustomRequest(String url, Map<String, String> params,
                     Listener<JSONObject> reponseListener, ErrorListener errorListener) {
    super(Method.GET, url, errorListener);
    this.listener = reponseListener;
    this.params = params;
}
项目:dolores-android    文件:StringRequest.java   
public StringRequest(String url, int requestType, Map<String, String> map, Listener<String> listener, ErrorListener errorListener) {
    super(requestType, Constants.BASE_URL + url, errorListener);
    super.setShouldCache(false);
    mListener = listener;
    mMap = map;
}
项目:super-volley    文件:BaseRequest.java   
@Override
public ErrorListener getErrorListener() {
    return listener;
}
项目:boohee_v5.6    文件:JsonArrayRequest.java   
public JsonArrayRequest(int method, String url, JSONArray jsonRequest, Listener<JSONArray> listener, ErrorListener errorListener) {
    super(method, url, jsonRequest == null ? null : jsonRequest.toString(), listener, errorListener);
}
项目:Codeforces    文件:JsonRequest.java   
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
        ErrorListener errorListener) {
    super(method, url, errorListener);
    mListener = listener;
    mRequestBody = requestBody;
}
项目:boohee_v5.6    文件:Request.java   
@Deprecated
public Request(String url, ErrorListener listener) {
    this(-1, url, listener);
}
项目:Codeforces    文件:MockRequest.java   
public MockRequest(String url, ErrorListener listener) {
    super(Request.Method.GET, url, listener);
}
项目:GeekZone    文件:JsonRequest.java   
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
        ErrorListener errorListener) {
    super(method, url, errorListener);
    mListener = listener;
    mRequestBody = requestBody;
}
项目:boohee_v5.6    文件:JsonArrayRequest.java   
public JsonArrayRequest(String url, JSONArray jsonRequest, Listener<JSONArray> listener, ErrorListener errorListener) {
    this(jsonRequest == null ? 0 : 1, url, jsonRequest, (Listener) listener, errorListener);
}
项目:FlyHttp    文件:CustomJsonRequest.java   
public CustomJsonRequest(int method, String url, Map<String, String> params,
                         Listener<JSONObject> responseListener, ErrorListener errorListener) {
    super(method, url, errorListener);
    this.listener = responseListener;
    this.params = params;
}
项目:iosched-reader    文件:JsonRequest.java   
public JsonRequest(int method, String url, String requestBody, Listener<T> listener,
        ErrorListener errorListener) {
    super(method, url, errorListener);
    mListener = listener;
    mRequestBody = requestBody;
}
项目:iosched-reader    文件:ImageLoader.java   
/**
 * Issues a bitmap request with the given URL if that image is not available
 * in the cache, and returns a bitmap container that contains all of the data
 * relating to the request (as well as the default image if the requested
 * image is not available).
 * @param requestUrl The url of the remote image
 * @param imageListener The listener to call when the remote image is loaded
 * @param maxWidth The maximum width of the returned image.
 * @param maxHeight The maximum height of the returned image.
 * @return A container object that contains all of the properties of the request, as well as
 *     the currently available image (default if remote is not loaded).
 */
public ImageContainer get(String requestUrl, ImageListener imageListener,
        int maxWidth, int maxHeight) {
    // only fulfill requests that were initiated from the main thread.
    throwIfNotOnMainThread();

    final String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight);

    // Try to look up the request in the cache of remote images.
    Bitmap cachedBitmap = mCache.getBitmap(cacheKey);
    if (cachedBitmap != null) {
        // Return the cached bitmap.
        ImageContainer container = new ImageContainer(cachedBitmap, requestUrl, null, null);
        imageListener.onResponse(container, true);
        return container;
    }

    // The bitmap did not exist in the cache, fetch it!
    ImageContainer imageContainer =
            new ImageContainer(null, requestUrl, cacheKey, imageListener);

    // Update the caller to let them know that they should use the default bitmap.
    imageListener.onResponse(imageContainer, true);

    // Check to see if a request is already in-flight.
    BatchedImageRequest request = mInFlightRequests.get(cacheKey);
    if (request != null) {
        // If it is, add this request to the list of listeners.
        request.addContainer(imageContainer);
        return imageContainer;
    }

    // The request is not already in flight. Send the new request to the network and
    // track it.
    Request<?> newRequest =
        new ImageRequest(requestUrl, new Listener<Bitmap>() {
            @Override
            public void onResponse(Bitmap response) {
                onGetImageSuccess(cacheKey, response);
            }
        }, maxWidth, maxHeight,
        Config.RGB_565, new ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                onGetImageError(cacheKey, error);
            }
        });

    mRequestQueue.add(newRequest);
    mInFlightRequests.put(cacheKey,
            new BatchedImageRequest(newRequest, imageContainer));
    return imageContainer;
}
项目:boohee_v5.6    文件:JsonArrayRequest.java   
public JsonArrayRequest(int method, String url, String requestBody, Listener<JSONArray> listener, ErrorListener errorListener) {
    super(method, url, requestBody, listener, errorListener);
}
项目:boohee_v5.6    文件:JsonArrayRequest.java   
public JsonArrayRequest(String url, JSONObject jsonRequest, Listener<JSONArray> listener, ErrorListener errorListener) {
    this(jsonRequest == null ? 0 : 1, url, jsonRequest, (Listener) listener, errorListener);
}