// TODO: Error
private synchronized Bitmap getBitmapFromEntryIfNeeded(String entryName, boolean recycle)
  {
    Bitmap bitmap = null;
    ImageState status = imageState.get(entryName);
    if (status == null || status.equals(ImageState.UNKNOWN))
    {
      ZipEntry entry = mZip.getEntry(entryName);
      try
      {
        File file = extract(entry, entry.getName());
        BitmapFactory.decodeFile(file.getPath(), bounds);
        if (bounds.outWidth == -1)
        {
          // TODO: Error
        }
        int width = bounds.outWidth;
        int height = bounds.outHeight;
        boolean landscape = height > width;
        int maxHeight = getMaxHeight(landscape);
        int maxWidth = getMaxWidth(landscape);
        boolean withinBounds = width <= maxWidth && height <= maxHeight;
        if (withinBounds)
        {
          imageState.put(entryName, ImageState.ORIGINAL);
        }
        else
        {
          bitmap = resampleAndSave(entryName, width, height);
        }
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }
    if (bitmap != null && recycle)
    {
      bitmap.recycle();
      return null;
    }
    else
    {
      return bitmap;
    }
  }
if (bounds.outWidth == -1)
{
// TODO: Error
}
int width = bounds.outWidth;
ImageState status = imageState.get(entryName);
if (status == null || status.equals(ImageState.UNKNOWN))
{
ZipEntry entry = mZip.getEntry(entryName);
try
{
File file = extract(entry, entry.getName());
BitmapFactory.decodeFile(file.getPath(), bounds);
if (bounds.outWidth == -1)
{
// TODO: Error
}
int width = bounds.outWidth;
int height = bounds.outHeight;
boolean landscape = height > width;
int maxHeight = getMaxHeight(landscape);
int maxWidth = getMaxWidth(landscape);
boolean withinBounds = width <= maxWidth && height <= maxHeight;
if (withinBounds)
{
imageState.put(entryName, ImageState.ORIGINAL);
private synchronized Bitmap getBitmapFromEntryIfNeeded(String entryName, boolean recycle)
{
Bitmap bitmap = null;
ImageState status = imageState.get(entryName);
if (status == null || status.equals(ImageState.UNKNOWN))
{
ZipEntry entry = mZip.getEntry(entryName);
try
{
File file = extract(entry, entry.getName());
BitmapFactory.decodeFile(file.getPath(), bounds);
if (bounds.outWidth == -1)
{
// TODO: Error
}
int width = bounds.outWidth;
int height = bounds.outHeight;
boolean landscape = height > width;
int maxHeight = getMaxHeight(landscape);
int maxWidth = getMaxWidth(landscape);
boolean withinBounds = width <= maxWidth && height <= maxHeight;
if (withinBounds)
{
imageState.put(entryName, ImageState.ORIGINAL);
}
else
{
bitmap = resampleAndSave(entryName, width, height);
}
}
catch (Exception e)
{
e.printStackTrace();
}