Skip to content

Commit

Permalink
Fixed some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
davemorrissey committed Dec 3, 2017
1 parent 3b0a9d1 commit da5fff7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.annotation.Keep;
import android.text.TextUtils;

import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
Expand All @@ -28,10 +29,13 @@ public class SkiaImageDecoder implements ImageDecoder {

private final Bitmap.Config bitmapConfig;

@Keep
@SuppressWarnings("unused")
public SkiaImageDecoder() {
this(null);
}

@SuppressWarnings("WeakerAccess")
public SkiaImageDecoder(Bitmap.Config bitmapConfig) {
Bitmap.Config globalBitmapConfig = SubsamplingScaleImageView.getPreferredBitmapConfig();
if (bitmapConfig != null) {
Expand Down Expand Up @@ -86,7 +90,7 @@ public Bitmap decode(Context context, Uri uri) throws Exception {
bitmap = BitmapFactory.decodeStream(inputStream, null, options);
} finally {
if (inputStream != null) {
try { inputStream.close(); } catch (Exception e) { }
try { inputStream.close(); } catch (Exception e) { /* Ignore */ }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.graphics.*;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.Keep;
import android.text.TextUtils;

import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
Expand Down Expand Up @@ -40,10 +41,13 @@ public class SkiaImageRegionDecoder implements ImageRegionDecoder {

private final Bitmap.Config bitmapConfig;

@Keep
@SuppressWarnings("unused")
public SkiaImageRegionDecoder() {
this(null);
}

@SuppressWarnings("WeakerAccess")
public SkiaImageRegionDecoder(Bitmap.Config bitmapConfig) {
Bitmap.Config globalBitmapConfig = SubsamplingScaleImageView.getPreferredBitmapConfig();
if (bitmapConfig != null) {
Expand Down Expand Up @@ -95,7 +99,7 @@ public Point init(Context context, Uri uri) throws Exception {
decoder = BitmapRegionDecoder.newInstance(inputStream, false);
} finally {
if (inputStream != null) {
try { inputStream.close(); } catch (Exception e) { }
try { inputStream.close(); } catch (Exception e) { /* Ignore */ }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.Keep;
import android.text.TextUtils;
import android.util.Log;

Expand Down Expand Up @@ -74,10 +75,13 @@ public class SkiaPooledImageRegionDecoder implements ImageRegionDecoder {
private Point imageDimensions = new Point(0, 0);
private final AtomicBoolean lazyInited = new AtomicBoolean(false);

@Keep
@SuppressWarnings("unused")
public SkiaPooledImageRegionDecoder() {
this(null);
}

@SuppressWarnings("WeakerAccess")
public SkiaPooledImageRegionDecoder(Bitmap.Config bitmapConfig) {
Bitmap.Config globalBitmapConfig = SubsamplingScaleImageView.getPreferredBitmapConfig();
if (bitmapConfig != null) {
Expand Down Expand Up @@ -214,7 +218,7 @@ private void initialiseDecoder() throws Exception {
}
} finally {
if (inputStream != null) {
try { inputStream.close(); } catch (Exception e) { }
try { inputStream.close(); } catch (Exception e) { /* Ignore */ }
}
}
}
Expand Down Expand Up @@ -308,6 +312,7 @@ public synchronized void recycle() {
* @param fileLength the size of the image file in bytes. Creating another decoder will use approximately this much native memory.
* @return true if another decoder can be created.
*/
@SuppressWarnings("WeakerAccess")
protected boolean allowAdditionalDecoder(int numberOfDecoders, long fileLength) {
if (numberOfDecoders >= 4) {
debug("No additional decoders allowed, reached hard limit (4)");
Expand Down

0 comments on commit da5fff7

Please sign in to comment.