Beispiel #1
0
 private void recyclePages() {
   if (LengthUtils.isNotEmpty(pages)) {
     final List<Bitmaps> bitmapsToRecycle = new ArrayList<Bitmaps>();
     for (final Page page : pages) {
       page.recycle(bitmapsToRecycle);
     }
     BitmapManager.release(bitmapsToRecycle);
     BitmapManager.release();
   }
   pages = EMPTY_PAGES;
 }
 @Override
 protected void onPostExecute(final RectF result) {
   if (progressDialog != null) {
     try {
       progressDialog.dismiss();
     } catch (final Throwable th) {
     }
   }
   if (result != null) {
     final RectF newRect = new RectF(result);
     final SearchControls sc = getManagedComponent().getSearchControls();
     final int controlsHeight = 3 + sc.getActualHeight();
     final float pageHeight = targetPage.getBounds(getZoomModel().getZoom()).height();
     newRect.offset(0, -(controlsHeight / pageHeight));
     getDocumentController()
         .goToLink(
             targetPage.index.docIndex, newRect, AppSettings.current().storeSearchGotoHistory);
   } else {
     Toast.makeText(getManagedComponent(), R.string.msg_no_text_found, Toast.LENGTH_LONG).show();
   }
   getDocumentController().redrawView();
 }
Beispiel #3
0
  public void createBookThumbnail(final BookSettings bs, final Page page, final boolean override) {
    final ThumbnailFile thumbnailFile = CacheManager.getThumbnailFile(bs.fileName);
    if (!override && thumbnailFile.exists()) {
      return;
    }

    int width = 200, height = 200;
    final RectF bounds = page.getBounds(1.0f);
    final float pageWidth = bounds.width();
    final float pageHeight = bounds.height();

    if (pageHeight > pageWidth) {
      width = (int) (200 * pageWidth / pageHeight);
    } else {
      height = (int) (200 * pageHeight / pageWidth);
    }

    BitmapRef image =
        decodeService.createThumbnail(
            width, height, page.index.docIndex, page.type.getInitialRect());
    thumbnailFile.setImage(image != null ? image.getBitmap() : null);
    BitmapManager.release(image);
  }