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;
    }
  }
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)
        {
         
        }
        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;
    }
  }
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) { } 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; } }