/** Shows the specified page of PDF to the screen. */
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  private void showPage() {
    count++;
    if (mPdfRenderer.getPageCount() == (count)) {
      count = 0;
    }
    // Make sure to close the current page before opening another one.
    if (null != mCurrentPage) {
      mCurrentPage.close();
    }
    // Use `openPage` to open a specific page in PDF.
    mCurrentPage = mPdfRenderer.openPage(count);
    // Important: the destination bitmap must be ARGB (not RGB).
    Bitmap bitmap =
        Bitmap.createBitmap(
            mCurrentPage.getWidth(), mCurrentPage.getHeight(), Bitmap.Config.ARGB_8888);
    // Here, we render the page onto the Bitmap.
    // To render a portion of the page, use the second and third parameter. Pass nulls to get
    // the default result.
    // Pass either RENDER_MODE_FOR_DISPLAY or RENDER_MODE_FOR_PRINT for the last parameter.
    mCurrentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
    // We are ready to show the Bitmap to user.
    mImageView.setImageBitmap(bitmap);
    Animation hyperspaceJumpAnimation =
        AnimationUtils.loadAnimation(getActivity(), R.anim.anim_slide_bottom_top);
    mImageView.startAnimation(hyperspaceJumpAnimation);
    //        updateUi();

  }
 /**
  * Closes the {@link android.graphics.pdf.PdfRenderer} and related resources.
  *
  * @throws java.io.IOException When the PDF file cannot be closed.
  */
 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
 private void closeRenderer() throws IOException {
   if (null != mCurrentPage) {
     mCurrentPage.close();
   }
   mPdfRenderer.close();
   mFileDescriptor.close();
 }
 /**
  * Gets the number of pages in the PDF. This method is marked as public for testing.
  *
  * @return The number of pages.
  */
 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
 public int getPageCount() {
   return mPdfRenderer.getPageCount();
 }
 /** Updates the state of 2 control buttons in response to the current page index. */
 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
 private void updateUi() {
   int index = mCurrentPage.getIndex();
   int pageCount = mPdfRenderer.getPageCount();
   //        getActivity().setTitle(getString(R.string.app_name_with_index, index + 1, pageCount));
 }