Java Code Examples for com.android.volley.VolleyLog#e()

The following examples show how to use com.android.volley.VolleyLog#e() . 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: ImageRequest.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
	// Serialize all decode on a global lock to reduce concurrent heap
	// usage.
	synchronized (sDecodeLock) {
		try {
			if (getUrl().startsWith("file:")) {
				return doFileParse();
			} else if (getUrl().startsWith("android.resource:")) {
				return doResourceParse();
			} else {
				return doParse(response);
			}
		} catch (OutOfMemoryError e) {
			VolleyLog.e("Caught OOM for %d byte image, url=%s",
					response.data.length, getUrl());
			return Response.error(new ParseError(e));
		}
	}
}
 
Example 2
Source File: UserAPIImpl.java    From the-tech-frontier-app with MIT License 6 votes vote down vote up
@Override
public void fetchUserInfo(String uid, String token, final DataListener<UserInfo> listener) {
    JsonObjectRequest request = new JsonObjectRequest(Constants.SINA_UID_TOKEN + uid
            + "&access_token=" + token, null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    if (listener != null) {
                        listener.onComplete(mRespHandler.parse(response));
                    }
                }
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    VolleyLog.e("Error: ", error.getMessage());
                }
            });

    performRequest(request);
}
 
Example 3
Source File: FileImageRequest.java    From CrossBow with Apache License 2.0 6 votes vote down vote up
@Override
public FileResponse<Bitmap> doFileWork(File file) throws VolleyError {
    try {
        if (isCanceled()) {
            return null;
        }

        Bitmap parsed = ImageDecoder.parseFile(file, config, scaleType, maxWidth, maxHeight);

        if (parsed != null) {
            return FileResponse.success(parsed);
        }
        else {
            return FileResponse.error();
        }

    }
    catch (OutOfMemoryError e) {
        VolleyLog.e("Caught OOM for file image, path=%s", getFilePath());
        return FileResponse.error(e);
    } catch (ParseError parseError) {
        return FileResponse.error(parseError);
    }
}
 
Example 4
Source File: RestVolleyImageCache.java    From RestVolley with Apache License 2.0 6 votes vote down vote up
private Bitmap getBitmapFromDiskLruCache(String key) {
    if (getDiskCache() == null) {
        return null;
    }

    String cachePath = new StringBuilder(getDiskCachePath()).append(File.separator).append(key).append(".0").toString();
    File cacheFile = new File(cachePath);
    try {
        if (cacheFile.exists()) {
            return ImageProcessor.decode(cachePath);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } catch (OutOfMemoryError error) {
        VolleyLog.e("Caught OOM for %d byte image, uri=%s", cacheFile.length(), cachePath);
    }

    return null;
}
 
Example 5
Source File: ImageRequest.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 6
Source File: ImageRequest.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 7
Source File: BallMarkerLog.java    From Volley-Ball with MIT License 5 votes vote down vote up
@Override
protected void finalize() throws Throwable {
    // Catch requests that have been collected (and hence end-of-lifed)
    // but had no debugging output printed for them.
    if (!mFinished) {
        finish("Request on the loose");
        VolleyLog.e("Marker log finalized without finish() - uncaught exit point for request");
    }
}
 
Example 8
Source File: ImageRequest.java    From CrossBow with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 9
Source File: ImageRequest.java    From okulus with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 10
Source File: BallImageRequest.java    From Volley-Ball with MIT License 5 votes vote down vote up
@Override
protected BallResponse<Bitmap> parseBallNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return BallResponse.error(new ParseError(e));
        }
    }
}
 
Example 11
Source File: ImageRequest.java    From volley with Apache License 2.0 5 votes vote down vote up
/**
     * Scales one side of a rectangle to fit aspect ratio.
     *
     * @param maxPrimary Maximum size of the primary dimension (i.e. width for
     *        max width), or zero to maintain aspect ratio with secondary
     *        dimension
     * @param maxSecondary Maximum size of the secondary dimension, or zero to
     *        maintain aspect ratio with primary dimension
     * @param actualPrimary Actual size of the primary dimension
     * @param actualSecondary Actual size of the secondary dimension
     */
//    private static int getResizedDimension(int maxPrimary, int maxSecondary, int actualPrimary,
//            int actualSecondary) {
//        // If no dominant value at all, just return the actual.
//        if (maxPrimary == 0 && maxSecondary == 0) {
//            return actualPrimary;
//        }
//
//        // If primary is unspecified, scale primary to match secondary's scaling ratio.
//        if (maxPrimary == 0) {
//            double ratio = (double) maxSecondary / (double) actualSecondary;
//            return (int) (actualPrimary * ratio);
//        }
//
//        if (maxSecondary == 0) {
//            return maxPrimary;
//        }
//
//        double ratio = (double) actualSecondary / (double) actualPrimary;
//        int resized = maxPrimary;
//        if (resized * ratio > maxSecondary) {
//            resized = (int) (maxSecondary / ratio);
//        }
//        return resized;
//    }

    @Override
    protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
        // Serialize all decode on a global lock to reduce concurrent heap usage.
        synchronized (sDecodeLock) {
            try {
                return doParse(response);
            } catch (OutOfMemoryError e) {
                VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
                return Response.error(new ParseError(e));
            }
        }
    }
 
Example 12
Source File: ImageRequest.java    From device-database with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 13
Source File: RVImageRequest.java    From RestVolley with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 14
Source File: PatchRequest.java    From swaggy-jenkins with MIT License 5 votes vote down vote up
@Override
public byte[] getBody() throws AuthFailureError {
  if(entity == null) {
      return null;
  }
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
      entity.writeTo(bos);
  }
  catch (IOException e) {
      VolleyLog.e("IOException writing to ByteArrayOutputStream");
  }
  return bos.toByteArray();
}
 
Example 15
Source File: DeleteRequest.java    From swaggy-jenkins with MIT License 5 votes vote down vote up
@Override
public byte[] getBody() throws AuthFailureError {
  if(entity == null) {
    return null;
  }
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
    entity.writeTo(bos);
  }
  catch (IOException e) {
    VolleyLog.e("IOException writing to ByteArrayOutputStream");
  }
  return bos.toByteArray();
}
 
Example 16
Source File: ImageRequest.java    From volley with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 17
Source File: ImageRequest.java    From FeedListViewDemo with MIT License 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s", response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}
 
Example 18
Source File: PatchRequest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] getBody() throws AuthFailureError {
  if(entity == null) {
      return null;
  }
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
      entity.writeTo(bos);
  }
  catch (IOException e) {
      VolleyLog.e("IOException writing to ByteArrayOutputStream");
  }
  return bos.toByteArray();
}
 
Example 19
Source File: BitmapDecoder.java    From volley with Apache License 2.0 5 votes vote down vote up
private static ExifInfo defineExifOrientation(String imageUri) {
    int rotation = 0;
    boolean flip = false;
    try {
        ExifInterface exif = new ExifInterface(imageUri);
        int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        switch (exifOrientation) {
            case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
                flip = true;
            case ExifInterface.ORIENTATION_NORMAL:
                rotation = 0;
                break;
            case ExifInterface.ORIENTATION_TRANSVERSE:
                flip = true;
            case ExifInterface.ORIENTATION_ROTATE_90:
                rotation = 90;
                break;
            case ExifInterface.ORIENTATION_FLIP_VERTICAL:
                flip = true;
            case ExifInterface.ORIENTATION_ROTATE_180:
                rotation = 180;
                break;
            case ExifInterface.ORIENTATION_TRANSPOSE:
                flip = true;
            case ExifInterface.ORIENTATION_ROTATE_270:
                rotation = 270;
                break;
        }
    } catch (IOException e) {
        VolleyLog.e("Can't read EXIF tags from file [%s]", imageUri);
    }
    return new ExifInfo(rotation, flip);
}
 
Example 20
Source File: ImageRequest.java    From TitanjumNote with Apache License 2.0 5 votes vote down vote up
@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
    synchronized (sDecodeLock) {
        try {
            return doParse(response);
        } catch (OutOfMemoryError e) {
            VolleyLog.e("Caught OOM for %d byte image, url=%s",
                    response.data.length, getUrl());
            return Response.error(new ParseError(e));
        }
    }
}