diff --git a/PdfView/src/main/java/com/sun/pdfview/PDFPage.java b/PdfView/src/main/java/com/sun/pdfview/PDFPage.java
index 8c3f1dd..118991b 100644
--- a/PdfView/src/main/java/com/sun/pdfview/PDFPage.java
+++ b/PdfView/src/main/java/com/sun/pdfview/PDFPage.java
@@ -216,7 +216,7 @@ public class PDFPage {
info.bgColor = Color.WHITE;
}
- image = Bitmap.createBitmap(width, height, Config.RGB_565);
+ image = Bitmap.createBitmap(width, height, Config.ARGB_8888);
renderer = new PDFRenderer(this, info, image);
// if (cache != null) {
diff --git a/PdfView/src/main/java/net/sf/andpdf/pdfviewer/PdfViewerFragment.java b/PdfView/src/main/java/net/sf/andpdf/pdfviewer/PdfViewerFragment.java
index 8689dcd..780d641 100644
--- a/PdfView/src/main/java/net/sf/andpdf/pdfviewer/PdfViewerFragment.java
+++ b/PdfView/src/main/java/net/sf/andpdf/pdfviewer/PdfViewerFragment.java
@@ -7,9 +7,6 @@ import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
@@ -45,7 +42,6 @@ import com.sun.pdfview.decrypt.PDFPassword;
import com.sun.pdfview.font.PDFFont;
import net.sf.andpdf.nio.ByteBuffer;
-import net.sf.andpdf.pdfviewer.gui.FullScrollView;
import net.sf.andpdf.refs.HardReference;
import java.io.IOException;
@@ -434,7 +430,7 @@ public class PdfViewerFragment extends Fragment {
dialogFragment.show(getFragmentManager(), dialogFragment.getClass().getName() + ";" + DIALOG_FRAGMENT_TAG_MARK);
}
- private class GraphView extends FullScrollView {
+ private class GraphView extends FrameLayout {
public Bitmap mBi;
public ImageView pdfZoomedImageView;
public PhotoViewAttacher photoViewAttacher;
@@ -463,6 +459,7 @@ public class PdfViewerFragment extends Fragment {
linearLayout.gravity = Gravity.CENTER;
pdfZoomedImageView = new ImageView(context);
pdfZoomedImageView.setLayoutParams(linearLayout);
+ pdfZoomedImageView.setBackgroundColor(getContext().getResources().getColor(R.color.zoomed_image_view_background));
photoViewAttacher = new PhotoViewAttacher(pdfZoomedImageView);
setPageBitmap(null);
@@ -650,8 +647,7 @@ public class PdfViewerFragment extends Fragment {
}
}
- Bitmap bitmap = mPdfPage.getImage(calculatedWidth, calculatedHeight, null, true, true);
- //bitmap = getBitmapWithoutQualityLose(bitmap, maxWidthToPopulate, maxHeightToPopulate);
+ final Bitmap bitmap = mPdfPage.getImage(calculatedWidth, calculatedHeight, null, true, true);
mGraphView.setPageBitmap(bitmap);
mGraphView.updateImage();
} catch (Throwable e) {
@@ -662,26 +658,6 @@ public class PdfViewerFragment extends Fragment {
}
- @NonNull
- public Bitmap getBitmapWithoutQualityLose(@NonNull final Bitmap bitmap, int newWidth, int newHeight) {
- final Bitmap scaledBitmap = Bitmap.createBitmap(newWidth, newHeight, Bitmap.Config.ARGB_8888);
-
- float ratioX = newWidth / (float) bitmap.getWidth();
- float ratioY = newHeight / (float) bitmap.getHeight();
- float middleX = newWidth / 2.0f;
- float middleY = newHeight / 2.0f;
-
- final Matrix scaleMatrix = new Matrix();
- scaleMatrix.setScale(ratioX, ratioY, middleX, middleY);
-
- final Canvas canvas = new Canvas(scaledBitmap);
- canvas.setMatrix(scaleMatrix);
- canvas.drawBitmap(bitmap, middleX - bitmap.getWidth() / 2, middleY - bitmap.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG));
-
- return scaledBitmap;
-
- }
-
private void hideProgressBar() {
if (progress != null) {
progress.dismiss();
diff --git a/PdfView/src/main/java/net/sf/andpdf/pdfviewer/UiUtils.java b/PdfView/src/main/java/net/sf/andpdf/pdfviewer/UiUtils.java
deleted file mode 100644
index 1abe265..0000000
--- a/PdfView/src/main/java/net/sf/andpdf/pdfviewer/UiUtils.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package net.sf.andpdf.pdfviewer;
-/*
- * Copyright (c) 2015 RoboSwag (Gavriil Sitnikov, Vsevolod Ivanov)
- *
- * This file is part of RoboSwag library.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import android.app.Activity;
-import android.app.Application;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.os.Build;
-import android.os.Handler;
-import android.os.Looper;
-import android.support.annotation.IdRes;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.util.DisplayMetrics;
-import android.util.TypedValue;
-import android.view.Display;
-import android.view.KeyCharacterMap;
-import android.view.KeyEvent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-public final class UiUtils {
-
-
-
- private UiUtils() {
- }
-
- /**
- * Utilities methods related to metrics.
- */
- public static class OfMetrics {
-
- private static final int MAX_METRICS_TRIES_COUNT = 5;
-
- /**
- * Returns right metrics with non-zero height/width.
- * It is common bug when metrics are calling at {@link Application#onCreate()} method and it returns metrics with zero height/width.
- *
- * @param context {@link Context} of metrics;
- * @return {@link DisplayMetrics}.
- */
- @SuppressWarnings("BusyWait")
- @NonNull
- public static DisplayMetrics getDisplayMetrics(@NonNull final Context context) {
- DisplayMetrics result = context.getResources().getDisplayMetrics();
- // it is needed to avoid bug with invalid metrics when user restore application from other application
- int metricsTryNumber = 0;
- while (metricsTryNumber < MAX_METRICS_TRIES_COUNT && (result.heightPixels <= 0 || result.widthPixels <= 0)) {
- try {
- Thread.sleep(500);
- } catch (final InterruptedException ignored) {
- return result;
- }
- result = context.getResources().getDisplayMetrics();
- metricsTryNumber++;
- }
- return result;
- }
-
- /**
- * Simply converts DP to pixels.
- *
- * @param context {@link Context} of metrics;
- * @param sizeInDp Size in DP;
- * @return Size in pixels.
- */
- public static float dpToPixels(@NonNull final Context context, final float sizeInDp) {
- return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, sizeInDp, getDisplayMetrics(context));
- }
-
- private OfMetrics() {
- }
-
- }
-}
-
diff --git a/PdfView/src/main/res/values/color.xml b/PdfView/src/main/res/values/color.xml
index 7e3907f..9e1dc64 100644
--- a/PdfView/src/main/res/values/color.xml
+++ b/PdfView/src/main/res/values/color.xml
@@ -4,4 +4,6 @@
#000000
#000000FF
#9370DB
+
+ #1d2022