From d142f7b62fd3942c6f9ab8089c483f9397926e20 Mon Sep 17 00:00:00 2001 From: jaKa Date: Fri, 19 Jan 2018 11:41:31 +0100 Subject: [PATCH 1/5] Support the other 4 exif orientations: horizontally and vertically flipped, transposed and transversed images. --- .../SubsamplingScaleImageView.html | 104 ++++++++--- docs/javadoc/constant-values.html | 58 ++++-- docs/javadoc/index-all.html | 22 ++- .../SubsamplingScaleImageView.java | 169 ++++++++++++++---- 4 files changed, 285 insertions(+), 68 deletions(-) diff --git a/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html b/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html index 0a1ba3e3..df89fc37 100644 --- a/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html +++ b/docs/javadoc/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.html @@ -230,117 +230,135 @@

Field Summary

static int +FLIP_H +
Flip image horizontally
+ + + +static int +FLIP_NONE +
No flipping
+ + + +static int +FLIP_V +
Flip image vertically
+ + + +static int ORIENTATION_0
Display the image file in its native orientation.
- + static int ORIENTATION_180
Rotate the image 180 degrees.
- + static int ORIENTATION_270
Rotate the image 270 degrees clockwise.
- + static int ORIENTATION_90
Rotate the image 90 degrees clockwise.
- + static int ORIENTATION_USE_EXIF
Attempt to use EXIF information on the image to rotate it.
- + static int ORIGIN_ANIM
State change originated from animation.
- + static int ORIGIN_DOUBLE_TAP_ZOOM
State change originated from a double tap zoom anim.
- + static int ORIGIN_FLING
State change originated from a fling momentum anim.
- + static int ORIGIN_TOUCH
State change originated from touch gesture.
- + static int PAN_LIMIT_CENTER
Allows the image to be panned until a corner reaches the center of the screen but no further.
- + static int PAN_LIMIT_INSIDE
Don't allow the image to be panned off screen.
- + static int PAN_LIMIT_OUTSIDE
Allows the image to be panned until it is just off screen, but no further.
- + static int SCALE_TYPE_CENTER_CROP
Scale the image uniformly so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view.
- + static int SCALE_TYPE_CENTER_INSIDE
Scale the image so that both dimensions of the image will be equal to or less than the corresponding dimension of the view.
- + static int SCALE_TYPE_CUSTOM
Scale the image so that both dimensions of the image will be equal to or less than the maxScale and equal to or larger than minScale.
- + static int SCALE_TYPE_START
Scale the image so that both dimensions of the image will be equal to or larger than the corresponding dimension of the view.
- + static int TILE_SIZE_AUTO  - + static int ZOOM_FOCUS_CENTER
During zoom animation, move the point of the image that was tapped to the center of the screen.
- + static int ZOOM_FOCUS_CENTER_IMMEDIATE
Zoom in to and center the tapped point immediately without animating.
- + static int ZOOM_FOCUS_FIXED
During zoom animation, keep the point of the image that was tapped in the same place, and scale the image around it.
@@ -954,6 +972,48 @@

ORIENTATION_270

+ + + + + + + + + + + + @@ -1184,7 +1244,11 @@

ORIGIN_DOUBLE_TAP_ZOOM

diff --git a/docs/javadoc/constant-values.html b/docs/javadoc/constant-values.html index 3f4b7823..f4394117 100644 --- a/docs/javadoc/constant-values.html +++ b/docs/javadoc/constant-values.html @@ -103,117 +103,145 @@

com.davemorrissey.*

1 + + +public static final int +FLIP_H +1 + + + + +public static final int +FLIP_NONE +0 + + + + +public static final int +FLIP_V +2 + + public static final int ORIENTATION_0 0 - + public static final int ORIENTATION_180 180 - + public static final int ORIENTATION_270 270 - + public static final int ORIENTATION_90 90 - + public static final int ORIENTATION_USE_EXIF -1 - + public static final int ORIGIN_ANIM 1 - + public static final int ORIGIN_DOUBLE_TAP_ZOOM 4 - + public static final int ORIGIN_FLING 3 - + public static final int ORIGIN_TOUCH 2 - + public static final int PAN_LIMIT_CENTER 3 - + public static final int PAN_LIMIT_INSIDE 1 - + public static final int PAN_LIMIT_OUTSIDE 2 - + public static final int SCALE_TYPE_CENTER_CROP 2 - + public static final int SCALE_TYPE_CENTER_INSIDE 1 - + public static final int SCALE_TYPE_CUSTOM 3 - + public static final int SCALE_TYPE_START 4 + + + +public static final int +TILE_SIZE_AUTO +2147483647 + diff --git a/docs/javadoc/index-all.html b/docs/javadoc/index-all.html index d390e511..4b8c03ef 100644 --- a/docs/javadoc/index-all.html +++ b/docs/javadoc/index-all.html @@ -67,7 +67,7 @@ -
A B C D E G H I M O P R S T U V W Z  +
A B C D E F G H I M O P R S T U V W Z 

A

@@ -182,6 +182,24 @@

E

Quadratic ease out.
+ + + +

F

+
+
FLIP_H - Static variable in class com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
+
+
Flip image horizontally
+
+
FLIP_NONE - Static variable in class com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
+
+
No flipping
+
+
FLIP_V - Static variable in class com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
+
+
Flip image vertically
+
+
@@ -892,7 +910,7 @@

Z

During zoom animation, keep the point of the image that was tapped in the same place, and scale the image around it.
-A B C D E G H I M O P R S T U V W Z 
+A B C D E F G H I M O P R S T U V W Z 
diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index 3a1410ea..df045434 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -83,7 +83,19 @@ public class SubsamplingScaleImageView extends View { /** Rotate the image 270 degrees clockwise. */ public static final int ORIENTATION_270 = 270; - private static final List VALID_ORIENTATIONS = Arrays.asList(ORIENTATION_0, ORIENTATION_90, ORIENTATION_180, ORIENTATION_270, ORIENTATION_USE_EXIF); + /** No flipping */ + public static final int FLIP_NONE = 0; + /** Flip image horizontally */ + public static final int FLIP_H = 1; + /** Flip image vertically */ + public static final int FLIP_V = 2; + + private static final List VALID_ORIENTATIONS = Arrays.asList( + ORIENTATION_0, + ORIENTATION_90, + ORIENTATION_180, + ORIENTATION_270, + ORIENTATION_USE_EXIF); /** During zoom animation, keep the point of the image that was tapped in the same place, and scale the image around it. */ public static final int ZOOM_FOCUS_FIXED = 1; @@ -154,6 +166,9 @@ public class SubsamplingScaleImageView extends View { // Image orientation setting private int orientation = ORIENTATION_0; + // Image flip setting + private int flip = FLIP_NONE; + // Max scale allowed (prevent infinite zoom) private float maxScale = 2F; @@ -450,9 +465,9 @@ public final void setImage(ImageSource imageSource, ImageSource previewSource, I } if (imageSource.getBitmap() != null && imageSource.getSRegion() != null) { - onImageLoaded(Bitmap.createBitmap(imageSource.getBitmap(), imageSource.getSRegion().left, imageSource.getSRegion().top, imageSource.getSRegion().width(), imageSource.getSRegion().height()), ORIENTATION_0, false); + onImageLoaded(Bitmap.createBitmap(imageSource.getBitmap(), imageSource.getSRegion().left, imageSource.getSRegion().top, imageSource.getSRegion().width(), imageSource.getSRegion().height()), ORIENTATION_0, FLIP_NONE, false); } else if (imageSource.getBitmap() != null) { - onImageLoaded(imageSource.getBitmap(), ORIENTATION_0, imageSource.isCached()); + onImageLoaded(imageSource.getBitmap(), ORIENTATION_0, FLIP_NONE, imageSource.isCached()); } else { sRegion = imageSource.getSRegion(); uri = imageSource.getUri(); @@ -1082,23 +1097,63 @@ protected void onDraw(Canvas canvas) { float xScale = scale, yScale = scale; if (bitmapIsPreview) { - xScale = scale * ((float)sWidth/bitmap.getWidth()); - yScale = scale * ((float)sHeight/bitmap.getHeight()); + xScale = scale*((float)sWidth/bitmap.getWidth()); + yScale = scale*((float)sHeight/bitmap.getHeight()); + } + + float dirX = 1, dirY = 1; + if (flip == FLIP_H) { + dirX = -1; + } else if(flip == FLIP_V) { + dirY = -1; + } + + if (matrix == null) { + matrix = new Matrix(); } - if (matrix == null) { matrix = new Matrix(); } + int rot = getRequiredRotation(); matrix.reset(); - matrix.postScale(xScale, yScale); - matrix.postRotate(getRequiredRotation()); - matrix.postTranslate(vTranslate.x, vTranslate.y); + matrix.postRotate(rot); + matrix.postScale(dirX*xScale, dirY*yScale); - if (getRequiredRotation() == ORIENTATION_180) { - matrix.postTranslate(scale * sWidth, scale * sHeight); - } else if (getRequiredRotation() == ORIENTATION_90) { - matrix.postTranslate(scale * sHeight, 0); - } else if (getRequiredRotation() == ORIENTATION_270) { - matrix.postTranslate(0, scale * sWidth); + float tx = vTranslate.x; + float ty = vTranslate.y; + + if (rot == ORIENTATION_180) { + tx += xScale*sWidth; + ty += yScale*sHeight; + if(dirX < 0) { + tx += xScale*sWidth; + } + if(dirY < 0) { + ty = yScale*sHeight; + } + } else if (rot == ORIENTATION_90) { + tx += yScale*sHeight; + if(dirX < 0) { + tx += -yScale*sHeight; + } + if(dirY < 0) { + ty += -xScale*sWidth; + } + } else if (rot == ORIENTATION_270) { + ty += xScale*sWidth; + if(dirX < 0) { + tx += yScale*sHeight; + } + if(dirY < 0) { + ty += xScale*sWidth; + } + } else { + if(dirX < 0) { + tx += xScale*sWidth; + } + if(dirY < 0) { + ty += yScale*sHeight; + } } + matrix.postTranslate(tx, ty); if (tileBgPaint != null) { if (sRect == null) { sRect = new RectF(); } @@ -1553,7 +1608,7 @@ protected int[] doInBackground(Void... params) { Point dimensions = decoder.init(context, source); int sWidth = dimensions.x; int sHeight = dimensions.y; - int exifOrientation = view.getExifOrientation(context, sourceUri); + int[] exifOrientation = view.getExifOrientation(context, sourceUri); if (view.sRegion != null) { view.sRegion.left = Math.max(0, view.sRegion.left); view.sRegion.top = Math.max(0, view.sRegion.top); @@ -1562,7 +1617,7 @@ protected int[] doInBackground(Void... params) { sWidth = view.sRegion.width(); sHeight = view.sRegion.height(); } - return new int[] { sWidth, sHeight, exifOrientation }; + return new int[] { sWidth, sHeight, exifOrientation[0], exifOrientation[1] }; } } catch (Exception e) { Log.e(TAG, "Failed to initialise bitmap decoder", e); @@ -1575,8 +1630,8 @@ protected int[] doInBackground(Void... params) { protected void onPostExecute(int[] xyo) { final SubsamplingScaleImageView view = viewRef.get(); if (view != null) { - if (decoder != null && xyo != null && xyo.length == 3) { - view.onTilesInited(decoder, xyo[0], xyo[1], xyo[2]); + if (decoder != null && xyo != null && xyo.length == 4) { + view.onTilesInited(decoder, xyo[0], xyo[1], xyo[2], xyo[3]); } else if (exception != null && view.onImageEventListener != null) { view.onImageEventListener.onImageLoadError(exception); } @@ -1587,7 +1642,7 @@ protected void onPostExecute(int[] xyo) { /** * Called by worker task when decoder is ready and image size and EXIF orientation is known. */ - private synchronized void onTilesInited(ImageRegionDecoder decoder, int sWidth, int sHeight, int sOrientation) { + private synchronized void onTilesInited(ImageRegionDecoder decoder, int sWidth, int sHeight, int sOrientation, int sFlip) { debug("onTilesInited sWidth=%d, sHeight=%d, sOrientation=%d", sWidth, sHeight, orientation); // If actual dimensions don't match the declared size, reset everything. if (this.sWidth > 0 && this.sHeight > 0 && (this.sWidth != sWidth || this.sHeight != sHeight)) { @@ -1608,6 +1663,7 @@ private synchronized void onTilesInited(ImageRegionDecoder decoder, int sWidth, this.sWidth = sWidth; this.sHeight = sHeight; this.sOrientation = sOrientation; + this.flip = sFlip; checkReady(); if (!checkImageLoaded() && maxTileWidth > 0 && maxTileWidth != TILE_SIZE_AUTO && maxTileHeight > 0 && maxTileHeight != TILE_SIZE_AUTO && getWidth() > 0 && getHeight() > 0) { initialiseBaseLayer(new Point(maxTileWidth, maxTileHeight)); @@ -1708,7 +1764,7 @@ private synchronized void onTileLoaded() { /** * Async task used to load bitmap without blocking the UI thread. */ - private static class BitmapLoadTask extends AsyncTask { + private static class BitmapLoadTask extends AsyncTask { private final WeakReference viewRef; private final WeakReference contextRef; private final WeakReference> decoderFactoryRef; @@ -1726,7 +1782,7 @@ private static class BitmapLoadTask extends AsyncTask { } @Override - protected Integer doInBackground(Void... params) { + protected int[] doInBackground(Void... params) { try { String sourceUri = source.toString(); Context context = contextRef.get(); @@ -1748,14 +1804,14 @@ protected Integer doInBackground(Void... params) { } @Override - protected void onPostExecute(Integer orientation) { + protected void onPostExecute(int[] orientation) { SubsamplingScaleImageView subsamplingScaleImageView = viewRef.get(); if (subsamplingScaleImageView != null) { if (bitmap != null && orientation != null) { if (preview) { subsamplingScaleImageView.onPreviewLoaded(bitmap); } else { - subsamplingScaleImageView.onImageLoaded(bitmap, orientation, false); + subsamplingScaleImageView.onImageLoaded(bitmap, orientation[0], orientation[1], false); } } else if (exception != null && subsamplingScaleImageView.onImageEventListener != null) { if (preview) { @@ -1792,7 +1848,7 @@ private synchronized void onPreviewLoaded(Bitmap previewBitmap) { /** * Called by worker task when full size image bitmap is ready (tiling is disabled). */ - private synchronized void onImageLoaded(Bitmap bitmap, int sOrientation, boolean bitmapIsCached) { + private synchronized void onImageLoaded(Bitmap bitmap, int sOrientation, int sFlip, boolean bitmapIsCached) { debug("onImageLoaded"); // If actual dimensions don't match the declared size, reset everything. if (this.sWidth > 0 && this.sHeight > 0 && (this.sWidth != bitmap.getWidth() || this.sHeight != bitmap.getHeight())) { @@ -1812,6 +1868,7 @@ private synchronized void onImageLoaded(Bitmap bitmap, int sOrientation, boolean this.sWidth = bitmap.getWidth(); this.sHeight = bitmap.getHeight(); this.sOrientation = sOrientation; + this.flip = sFlip; boolean ready = checkReady(); boolean imageLoaded = checkImageLoaded(); if (ready || imageLoaded) { @@ -1823,10 +1880,12 @@ private synchronized void onImageLoaded(Bitmap bitmap, int sOrientation, boolean /** * Helper method for load tasks. Examines the EXIF info on the image file to determine the orientation. * This will only work for external files, not assets, resources or other URIs. + * Return rotation and flip. */ @AnyThread - private int getExifOrientation(Context context, String sourceUri) { + private int[] getExifOrientation(Context context, String sourceUri) { int exifOrientation = ORIENTATION_0; + int exifFlip = FLIP_NONE; if (sourceUri.startsWith(ContentResolver.SCHEME_CONTENT)) { Cursor cursor = null; try { @@ -1861,6 +1920,18 @@ private int getExifOrientation(Context context, String sourceUri) { exifOrientation = ORIENTATION_180; } else if (orientationAttr == ExifInterface.ORIENTATION_ROTATE_270) { exifOrientation = ORIENTATION_270; + } else if (orientationAttr == ExifInterface.ORIENTATION_FLIP_HORIZONTAL) { + exifOrientation = ORIENTATION_0; + exifFlip = FLIP_H; + } else if (orientationAttr == ExifInterface.ORIENTATION_FLIP_VERTICAL) { + exifOrientation = ORIENTATION_0; + exifFlip = FLIP_V; + } else if (orientationAttr == ExifInterface.ORIENTATION_TRANSPOSE) { + exifOrientation = ORIENTATION_90; + exifFlip = FLIP_H; + } else if (orientationAttr == ExifInterface.ORIENTATION_TRANSVERSE) { + exifOrientation = ORIENTATION_270; + exifFlip = FLIP_H; } else { Log.w(TAG, "Unsupported EXIF orientation: " + orientationAttr); } @@ -1868,7 +1939,7 @@ private int getExifOrientation(Context context, String sourceUri) { Log.w(TAG, "Could not get EXIF orientation of image"); } } - return exifOrientation; + return new int[] { exifOrientation, exifFlip }; } private void execute(AsyncTask asyncTask) { @@ -2039,7 +2110,16 @@ public void recycle() { */ private float viewToSourceX(float vx) { if (vTranslate == null) { return Float.NaN; } - return (vx - vTranslate.x)/scale; + int rot = getRequiredRotation(); + if(flip == FLIP_H) { + if(rot == ORIENTATION_0 || rot == ORIENTATION_180) { + return getSWidth() - (vx - vTranslate.x) / scale; + } else { + return getSHeight() - (vx - vTranslate.x) / scale; + } + } else { + return (vx - vTranslate.x) / scale; + } } /** @@ -2047,7 +2127,16 @@ private float viewToSourceX(float vx) { */ private float viewToSourceY(float vy) { if (vTranslate == null) { return Float.NaN; } - return (vy - vTranslate.y)/scale; + int rot = getRequiredRotation(); + if(flip == FLIP_V) { + if(rot == ORIENTATION_0 || rot == ORIENTATION_180) { + return getSHeight() - (vy - vTranslate.y) / scale; + } else { + return getSWidth() - (vy - vTranslate.y) / scale; + } + } else { + return (vy - vTranslate.y) / scale; + } } /** @@ -2146,7 +2235,16 @@ public final PointF viewToSourceCoord(float vx, float vy, PointF sTarget) { */ private float sourceToViewX(float sx) { if (vTranslate == null) { return Float.NaN; } - return (sx * scale) + vTranslate.x; + int rot = getRequiredRotation(); + if(flip == FLIP_H) { + if(rot == ORIENTATION_0 || rot == ORIENTATION_180) { + return (getSWidth() - sx) * scale + vTranslate.x; + } else { + return (getSHeight() - sx) * scale + vTranslate.x; + } + } else { + return sx*scale + vTranslate.x; + } } /** @@ -2154,7 +2252,16 @@ private float sourceToViewX(float sx) { */ private float sourceToViewY(float sy) { if (vTranslate == null) { return Float.NaN; } - return (sy * scale) + vTranslate.y; + int rot = getRequiredRotation(); + if(flip == FLIP_V) { + if(rot == ORIENTATION_0 || rot == ORIENTATION_180) { + return (getSHeight() - sy) * scale + vTranslate.y; + } else { + return (getSWidth() - sy) * scale + vTranslate.y; + } + } else { + return (sy * scale) + vTranslate.y; + } } /** From 685261c01b3257fb0e01298a2cb117ff912c5a6a Mon Sep 17 00:00:00 2001 From: jaKa Date: Mon, 29 Jan 2018 17:38:03 +0100 Subject: [PATCH 2/5] Catch exceptions from task execution. Better warn than crash. --- .../labs/subscaleview/SubsamplingScaleImageView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index df045434..9a7cf87d 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -47,6 +47,7 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.Executor; +import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -1943,7 +1944,11 @@ private int[] getExifOrientation(Context context, String sourceUri) { } private void execute(AsyncTask asyncTask) { - asyncTask.executeOnExecutor(executor); + try { + asyncTask.executeOnExecutor(executor); + } catch(RejectedExecutionException ex) { + Log.w(TAG, "Task execution rejected: " + asyncTask, ex); + } } private static class Tile { From 7d20ebb496a6ec226320f8650e374699580657a7 Mon Sep 17 00:00:00 2001 From: jaKa Date: Thu, 12 Jul 2018 11:35:48 +0200 Subject: [PATCH 3/5] Moved to new gradle. Use non-support exif interface. --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 3 ++- .../labs/subscaleview/SubsamplingScaleImageView.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 8e05d424..36559ce9 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,6 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.1.3' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 590f0e81..a2f67b72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Thu Jul 12 11:22:06 CEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index 9a7cf87d..a6986b1e 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -14,7 +14,7 @@ import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; -import android.support.media.ExifInterface; +import android.media.ExifInterface; import android.net.Uri; import android.os.AsyncTask; import android.os.Handler; From 94a094e053d8588fa8cc0c12412715d89522e670 Mon Sep 17 00:00:00 2001 From: jaKa Date: Tue, 25 Aug 2020 14:39:47 +0200 Subject: [PATCH 4/5] Ported to androidx + target API 29. Version bump. --- build.gradle | 2 +- gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 14 ++++--- library/src/main/AndroidManifest.xml | 1 - .../SubsamplingScaleImageView.java | 4 +- .../decoder/CompatDecoderFactory.java | 2 +- .../decoder/SkiaImageDecoder.java | 2 +- .../decoder/SkiaImageRegionDecoder.java | 2 +- .../decoder/SkiaPooledImageRegionDecoder.java | 2 +- sample/build.gradle | 7 +++- sample/src/main/AndroidManifest.xml | 39 +++++++++---------- .../test/AbstractFragmentsActivity.java | 4 +- .../test/AbstractPagesActivity.java | 4 +- .../test/animation/AnimationActivity.java | 2 +- .../basicfeatures/BasicFeaturesActivity.java | 2 +- .../configuration/ConfigurationActivity.java | 2 +- .../test/extension/ExtensionActivity.java | 2 +- .../extension/ExtensionCircleFragment.java | 4 +- .../extension/ExtensionFreehandFragment.java | 4 +- .../test/extension/ExtensionPinFragment.java | 4 +- .../test/extension/views/FreehandView.java | 2 +- .../imagedisplay/ImageDisplayActivity.java | 2 +- .../ImageDisplayLargeFragment.java | 4 +- .../ImageDisplayRegionFragment.java | 4 +- .../ImageDisplayRotateFragment.java | 4 +- .../test/viewpager/VerticalViewPager.java | 4 +- .../test/viewpager/ViewPagerActivity.java | 8 ++-- .../test/viewpager/ViewPagerFragment.java | 4 +- sample/src/main/res/layout/view_pager.xml | 2 +- 30 files changed, 73 insertions(+), 68 deletions(-) diff --git a/build.gradle b/build.gradle index 36559ce9..68630a64 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,6 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:4.0.1' } } diff --git a/gradle.properties b/gradle.properties index aac7c9b4..9e6fce10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a2f67b72..6161dbd0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index f83d5958..fe08c4c3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -2,12 +2,14 @@ apply plugin: 'com.android.library' group = 'com.davemorrissey.labs' archivesBaseName = 'subsampling-scale-image-view' -version = '3.9.0' +version = '3.9.1' android { - compileSdkVersion 27 + compileSdkVersion 29 defaultConfig { + minSdkVersion 21 + targetSdkVersion 29 consumerProguardFiles 'proguard-rules.txt' } } @@ -17,10 +19,10 @@ configurations { } dependencies { - javadocs 'com.android.support:support-annotations:27.0.2' - javadocs 'com.android.support:exifinterface:27.0.2' - implementation 'com.android.support:support-annotations:27.0.2' - implementation 'com.android.support:exifinterface:27.0.2' + javadocs 'androidx.annotation:annotation:1.0.0' + javadocs 'androidx.exifinterface:exifinterface:1.0.0' + implementation 'androidx.annotation:annotation:1.0.0' + implementation 'androidx.exifinterface:exifinterface:1.0.0' } task javadoc(type: Javadoc) { diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 203f218b..619d9c08 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -3,5 +3,4 @@ package="com.davemorrissey.labs.subscaleview" android:versionCode="1" android:versionName="1.0"> - diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index a6986b1e..9c44a0a1 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -20,8 +20,8 @@ import android.os.Handler; import android.os.Message; import android.provider.MediaStore; -import android.support.annotation.AnyThread; -import android.support.annotation.NonNull; +import androidx.annotation.AnyThread; +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/CompatDecoderFactory.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/CompatDecoderFactory.java index 870489ff..7df23be0 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/CompatDecoderFactory.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/CompatDecoderFactory.java @@ -1,7 +1,7 @@ package com.davemorrissey.labs.subscaleview.decoder; import android.graphics.Bitmap; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.java index be1cd32b..78750ea9 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageDecoder.java @@ -7,7 +7,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; -import android.support.annotation.Keep; +import androidx.annotation.Keep; import android.text.TextUtils; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.java index eebe2bb5..a1fa77c0 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaImageRegionDecoder.java @@ -8,7 +8,7 @@ import android.graphics.*; import android.net.Uri; import android.os.Build; -import android.support.annotation.Keep; +import androidx.annotation.Keep; import android.text.TextUtils; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java index 80e415b9..bb666590 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/SkiaPooledImageRegionDecoder.java @@ -14,7 +14,7 @@ import android.graphics.Rect; import android.net.Uri; import android.os.Build; -import android.support.annotation.Keep; +import androidx.annotation.Keep; import android.text.TextUtils; import android.util.Log; diff --git a/sample/build.gradle b/sample/build.gradle index f1096a7e..6fa78a29 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,8 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 27 + compileSdkVersion 29 + defaultConfig { + minSdkVersion 21 + targetSdkVersion 29 applicationId "com.davemorrissey.labs.subscaleview.test" } @@ -15,5 +18,5 @@ android { dependencies { implementation project(':library') - implementation 'com.android.support:support-v4:27.0.2' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index f49b08f4..ec7dd4cc 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -5,24 +5,23 @@ android:versionCode="4" android:versionName="3.1.0" android:hardwareAccelerated="true"> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractFragmentsActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractFragmentsActivity.java index 154c2e48..fc5166d5 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractFragmentsActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractFragmentsActivity.java @@ -2,8 +2,8 @@ import android.app.ActionBar; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; import android.view.MenuItem; import java.util.List; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractPagesActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractPagesActivity.java index 4ce36de5..b5b711c8 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractPagesActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/AbstractPagesActivity.java @@ -2,8 +2,8 @@ import android.app.ActionBar; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; +import androidx.annotation.Nullable; +import androidx.fragment.app.FragmentActivity; import android.view.MenuItem; import android.view.View; import android.widget.TextView; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/animation/AnimationActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/animation/AnimationActivity.java index 41666987..98c9ba05 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/animation/AnimationActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/animation/AnimationActivity.java @@ -2,7 +2,7 @@ import android.graphics.PointF; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.view.View; import com.davemorrissey.labs.subscaleview.ImageSource; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/basicfeatures/BasicFeaturesActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/basicfeatures/BasicFeaturesActivity.java index ad8b6006..0a2fa3ed 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/basicfeatures/BasicFeaturesActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/basicfeatures/BasicFeaturesActivity.java @@ -1,7 +1,7 @@ package com.davemorrissey.labs.subscaleview.test.basicfeatures; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/configuration/ConfigurationActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/configuration/ConfigurationActivity.java index 22965815..66973a40 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/configuration/ConfigurationActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/configuration/ConfigurationActivity.java @@ -2,7 +2,7 @@ import android.graphics.PointF; import android.os.Bundle; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionActivity.java index 89b4344c..b05e96d1 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionActivity.java @@ -1,6 +1,6 @@ package com.davemorrissey.labs.subscaleview.test.extension; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.util.Log; import com.davemorrissey.labs.subscaleview.test.AbstractFragmentsActivity; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionCircleFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionCircleFragment.java index 47edf074..a60f7f39 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionCircleFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionCircleFragment.java @@ -1,8 +1,8 @@ package com.davemorrissey.labs.subscaleview.test.extension; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionFreehandFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionFreehandFragment.java index 5ea14679..98acade5 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionFreehandFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionFreehandFragment.java @@ -1,8 +1,8 @@ package com.davemorrissey.labs.subscaleview.test.extension; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionPinFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionPinFragment.java index c7f52f14..cfe9d3dc 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionPinFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/ExtensionPinFragment.java @@ -2,8 +2,8 @@ import android.graphics.PointF; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/views/FreehandView.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/views/FreehandView.java index f4f14035..a0c92a9e 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/views/FreehandView.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/extension/views/FreehandView.java @@ -4,7 +4,7 @@ import android.graphics.*; import android.graphics.Paint.Cap; import android.graphics.Paint.Style; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayActivity.java index 9900e34a..06ff5286 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayActivity.java @@ -1,6 +1,6 @@ package com.davemorrissey.labs.subscaleview.test.imagedisplay; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.util.Log; import com.davemorrissey.labs.subscaleview.test.AbstractFragmentsActivity; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayLargeFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayLargeFragment.java index 70d34459..c53da11a 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayLargeFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayLargeFragment.java @@ -1,8 +1,8 @@ package com.davemorrissey.labs.subscaleview.test.imagedisplay; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRegionFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRegionFragment.java index 566e144e..d1798137 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRegionFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRegionFragment.java @@ -3,8 +3,8 @@ import android.graphics.Bitmap; import android.graphics.Rect; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRotateFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRotateFragment.java index 46465c41..d9ecd564 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRotateFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/imagedisplay/ImageDisplayRotateFragment.java @@ -1,8 +1,8 @@ package com.davemorrissey.labs.subscaleview.test.imagedisplay; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/VerticalViewPager.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/VerticalViewPager.java index 71131ea3..5bccd9ba 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/VerticalViewPager.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/VerticalViewPager.java @@ -1,8 +1,8 @@ package com.davemorrissey.labs.subscaleview.test.viewpager; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.v4.view.ViewPager; +import androidx.annotation.NonNull; +import androidx.viewpager.widget.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerActivity.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerActivity.java index 3f9a79d0..307c6d38 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerActivity.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerActivity.java @@ -1,10 +1,10 @@ package com.davemorrissey.labs.subscaleview.test.viewpager; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.view.ViewPager; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; +import androidx.viewpager.widget.ViewPager; import android.view.View; import com.davemorrissey.labs.subscaleview.test.AbstractPagesActivity; diff --git a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerFragment.java b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerFragment.java index 03e7155e..d33bcaaa 100644 --- a/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerFragment.java +++ b/sample/src/main/java/com/davemorrissey/labs/subscaleview/test/viewpager/ViewPagerFragment.java @@ -1,8 +1,8 @@ package com.davemorrissey.labs.subscaleview.test.viewpager; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/sample/src/main/res/layout/view_pager.xml b/sample/src/main/res/layout/view_pager.xml index 61880970..88567cc6 100644 --- a/sample/src/main/res/layout/view_pager.xml +++ b/sample/src/main/res/layout/view_pager.xml @@ -13,7 +13,7 @@ - + From 98b53569e33fedd8c1c90a665508026c2f796ce4 Mon Sep 17 00:00:00 2001 From: Jaka Mocnik Date: Wed, 30 Mar 2022 12:41:57 +0200 Subject: [PATCH 5/5] Brought deps up to date. --- library/build.gradle | 12 ++++++------ .../labs/subscaleview/SubsamplingScaleImageView.java | 5 +++-- sample/build.gradle | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index fe08c4c3..c61a9636 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,11 +5,11 @@ archivesBaseName = 'subsampling-scale-image-view' version = '3.9.1' android { - compileSdkVersion 29 + compileSdkVersion 31 defaultConfig { minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 31 consumerProguardFiles 'proguard-rules.txt' } } @@ -19,10 +19,10 @@ configurations { } dependencies { - javadocs 'androidx.annotation:annotation:1.0.0' - javadocs 'androidx.exifinterface:exifinterface:1.0.0' - implementation 'androidx.annotation:annotation:1.0.0' - implementation 'androidx.exifinterface:exifinterface:1.0.0' + javadocs 'androidx.annotation:annotation:1.3.0' + javadocs 'androidx.exifinterface:exifinterface:1.3.3' + implementation 'androidx.annotation:annotation:1.3.0' + implementation 'androidx.exifinterface:exifinterface:1.3.3' } task javadoc(type: Javadoc) { diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java index 9c44a0a1..e56b82f8 100644 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java @@ -14,9 +14,10 @@ import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; -import android.media.ExifInterface; +import androidx.exifinterface.media.ExifInterface; import android.net.Uri; import android.os.AsyncTask; +import android.os.Build; import android.os.Handler; import android.os.Message; import android.provider.MediaStore; @@ -1887,7 +1888,7 @@ private synchronized void onImageLoaded(Bitmap bitmap, int sOrientation, int sFl private int[] getExifOrientation(Context context, String sourceUri) { int exifOrientation = ORIENTATION_0; int exifFlip = FLIP_NONE; - if (sourceUri.startsWith(ContentResolver.SCHEME_CONTENT)) { + if (sourceUri.startsWith(ContentResolver.SCHEME_CONTENT) && Build.VERSION.SDK_INT >= 29) { Cursor cursor = null; try { String[] columns = { MediaStore.Images.Media.ORIENTATION }; diff --git a/sample/build.gradle b/sample/build.gradle index 6fa78a29..523dcc36 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 + compileSdkVersion 31 defaultConfig { minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 31 applicationId "com.davemorrissey.labs.subscaleview.test" }