Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ff8cf3d
explicit imports
mcginty Apr 3, 2015
2ddee9b
use factory pattern for decoders
mcginty Apr 3, 2015
9df94ef
Merge pull request #60 from mcginty/factory
davemorrissey May 11, 2015
529ab3e
Added File Locker to HOF
davemorrissey Jun 6, 2015
3d5296f
#78 Fixed NPE and incorrect initialisation of tile map when using pre…
davemorrissey Jun 14, 2015
c431b2a
#72 Throw an exception if decoder returns a null bitmap, so listeners…
davemorrissey Jun 14, 2015
1a28c3c
Release 3.1.4
davemorrissey Jun 14, 2015
952218f
Updating README file to point to new 3.1.4 version
enderminh Jun 16, 2015
7421e93
Merge pull request #80 from enderminh/master
davemorrissey Jun 16, 2015
ee67ed7
Added TransitMe to HOF
davemorrissey Jun 16, 2015
86af5fa
Update README.md
ed-george Jun 29, 2015
8d1ff91
Merge pull request #1 from ed-george/readme-patch
ed-george Jun 29, 2015
f2ee07e
Merge pull request #84 from ed-george/master
davemorrissey Jun 30, 2015
e7e9a6a
Added Mr Whipped Comics to HOF
davemorrissey Jun 30, 2015
d80b2ac
Added Mr Whipped Comics to HOF (markdown fix)
davemorrissey Jun 30, 2015
8e5d246
Add boolean flag to determine if an external image cache loader is us…
Jul 17, 2015
57034ad
remove use of FloatMath class, use Math instead
Aug 25, 2015
74156f6
Modified cached flag implementation - use static initialiser on Image…
davemorrissey Aug 30, 2015
29d2988
Merge branch 'omgnuts-master'
davemorrissey Aug 30, 2015
c3d8c2d
Merge pull request #106 from Yarikx/remove_floatmath
davemorrissey Aug 30, 2015
42591b0
Release 3.2.0
davemorrissey Aug 30, 2015
ada0984
Support EXIF rotation for content URIs
davemorrissey Sep 3, 2015
2424a7c
Tweaked log message
davemorrissey Sep 3, 2015
7aea923
Fix for #110 - avoid recycling cached bitmap
davemorrissey Sep 24, 2015
8dc5497
Skip loading of tiles that have gone off screen while queued for loading
davemorrissey Sep 25, 2015
3a9a3cf
#114 If file does not exist, try URL decoding it to allow for URIs cr…
davemorrissey Sep 30, 2015
8bd084a
#120 Option to use AsyncTask.THREAD_POOL_EXECUTOR to load tiles
davemorrissey Sep 30, 2015
e6a9d21
Release 3.3.0
davemorrissey Sep 30, 2015
6b188ed
Release 3.3.0
davemorrissey Sep 30, 2015
65b75a0
If the whole image is required at native resolution, use BitmapDecode…
davemorrissey Oct 3, 2015
6d1bba3
Merge branch 'master' of github.com:davemorrissey/subsampling-scale-i…
davemorrissey Oct 3, 2015
7f1a51c
Release 3.4.0
davemorrissey Oct 3, 2015
801fa4a
Merge tag 'v3.4.0' of https://github.com/davemorrissey/subsampling-sc…
Feb 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Version 3.x.x includes breaking changes. Please view the [migration guide](https

**Are you using this library in your app? Let me know and I'll add it to this list.**

| [![Fourth Mate](https://lh3.ggpht.com/2ALnL-05ILKLwP9U8Dfy7n4iI54OlXeZG-rHf31FP5l8Bup9wws9wnSlyX56ShgzlQ=w100)](https://play.google.com/store/apps/details?id=com.sleetworks.serenity.android) | [![Sync for reddit](https://lh5.ggpht.com/eOcmQUHHFCXM5uiajTkTsak5sIB5eTLKXaKSGGGWi8TJ3edYtqz8EtvjlOto5eFYvoLb=w100)](https://play.google.com/store/apps/details?id=com.laurencedawson.reddit_sync) | [![Journey](https://lh3.ggpht.com/Mz6YqxKsLfVbjYVHj_3nfUxLe5Yvl9W4KO2sKnwud6hZl5mnGitm55PnILT2jx4Hafv6=w100)](https://play.google.com/store/apps/details?id=com.journey.app) |
|---|---|---|
| **Fourth Mate** | **Sync for reddit** | **Journal** |
| [![Clover](https://lh5.ggpht.com/Q8vw6LLyj3AjRev4ID3uvFUxnMp4ca4eBEaPlkupcK7cNn2xtVg-wIxVsKSJ-IIFaUM=w100)](https://play.google.com/store/apps/details?id=org.floens.chan) | [![Tag Gallery](https://lh5.ggpht.com/mKch3_fgPYswBPmZ-qEvp91_fPKdbvN2UubCvUTDqy1sAaLJBzfFYETb-sJgPfCvDg=w100)](https://play.google.com/store/apps/details?id=me.snapdiary.us.taggallery) | [![nycTrans.it](https://lh5.ggpht.com/eDe_bnb2KVXd6fwjJDroWYfEs7Qy-ity93s4LnOwei3S8AGZIeJy8wwmjllt1TKciD4=w100)](https://play.google.com/store/apps/details?id=com.nyctrans.it) |
| **Clover** | **Tag Gallery** | **nycTrans.it** |
| [![Fourth Mate](https://lh3.ggpht.com/2ALnL-05ILKLwP9U8Dfy7n4iI54OlXeZG-rHf31FP5l8Bup9wws9wnSlyX56ShgzlQ=w100)](https://play.google.com/store/apps/details?id=com.sleetworks.serenity.android) | [![Sync for reddit](https://lh5.ggpht.com/eOcmQUHHFCXM5uiajTkTsak5sIB5eTLKXaKSGGGWi8TJ3edYtqz8EtvjlOto5eFYvoLb=w100)](https://play.google.com/store/apps/details?id=com.laurencedawson.reddit_sync) | [![Journey](https://lh3.ggpht.com/Mz6YqxKsLfVbjYVHj_3nfUxLe5Yvl9W4KO2sKnwud6hZl5mnGitm55PnILT2jx4Hafv6=w100)](https://play.google.com/store/apps/details?id=com.journey.app) | [![Clover](https://lh5.ggpht.com/Q8vw6LLyj3AjRev4ID3uvFUxnMp4ca4eBEaPlkupcK7cNn2xtVg-wIxVsKSJ-IIFaUM=w100)](https://play.google.com/store/apps/details?id=org.floens.chan) | [![Tag Gallery](https://lh5.ggpht.com/mKch3_fgPYswBPmZ-qEvp91_fPKdbvN2UubCvUTDqy1sAaLJBzfFYETb-sJgPfCvDg=w100)](https://play.google.com/store/apps/details?id=me.snapdiary.us.taggallery) |
|---|---|---|---|---|
| **Fourth Mate** | **Sync for reddit** | **Journal** | **Clover** | **Tag Gallery** |
| [![nycTrans.it](https://lh5.ggpht.com/eDe_bnb2KVXd6fwjJDroWYfEs7Qy-ity93s4LnOwei3S8AGZIeJy8wwmjllt1TKciD4=w100)](https://play.google.com/store/apps/details?id=com.nyctrans.it) | [![RR File Locker](https://lh4.ggpht.com/taUucj91wLM_uLq-XMLo-9Urk4SeQYW1WO4oquJ_ynyJPrX7S0j0xoQ8k6q66ZElFg=w100)](https://play.google.com/store/apps/details?id=com.redrabbitsw.android.locker) | [![TransitMe NYC](https://lh3.googleusercontent.com/aErQHPHTn6TeqmGRHybIZoEE7uF1MwTXTN4upuIsMpJurwWGuF_9tAhaxspMvTBdGaqG=w100)](https://play.google.com/store/apps/details?id=com.transitme.app) | [![Mr Whipped Comics](https://lh3.googleusercontent.com/1Wtvc4dM8ZBeUWB1dFqjrn_mrwq12xVbsux9QMXQrPL3VdZi2v6OuFQ7N0k5iT7tQw=w100)](https://play.google.com/store/apps/details?id=com.pst.mrwhipped) | |
| **nycTrans.it** | **RR File Locker** | **TransitMe NYC** | **Mr Whipped Comics** | |

## Features

Expand Down Expand Up @@ -83,7 +83,7 @@ Version 3.x.x includes breaking changes. Please view the [migration guide](https

## Quick start

**1)** Add `com.davemorrissey.labs:subsampling-scale-image-view:3.1.3` as a dependency in your build.gradle file.
**1)** Add `com.davemorrissey.labs:subsampling-scale-image-view:3.4.0` as a dependency in your build.gradle file.

**2)** Add the view to your layout XML.

Expand All @@ -96,7 +96,7 @@ Version 3.x.x includes breaking changes. Please view the [migration guide](https
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>
</LinearLayout>

**3)** Now, in your fragment or activity, set the image resource, asset name or file path.

Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'signing'

group = 'com.davemorrissey.labs'
archivesBaseName = 'subsampling-scale-image-view'
version = '3.1.3'
version = '3.4.0'

signing {
required { has("release") && gradle.taskGraph.hasTask("uploadArchives") }
Expand Down
39 changes: 37 additions & 2 deletions library/src/com/davemorrissey/labs/subscaleview/ImageSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import android.graphics.Rect;
import android.net.Uri;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

/**
* Helper class used to set the source and additional attributes from a variety of sources. Supports
* use of a bitmap, asset, resource, external file or any other URI.
Expand All @@ -23,17 +27,31 @@ public final class ImageSource {
private int sWidth;
private int sHeight;
private Rect sRegion;
private boolean cached;

private ImageSource(Bitmap bitmap) {
private ImageSource(Bitmap bitmap, boolean cached) {
this.bitmap = bitmap;
this.uri = null;
this.resource = null;
this.tile = false;
this.sWidth = bitmap.getWidth();
this.sHeight = bitmap.getHeight();
this.cached = cached;
}

private ImageSource(Uri uri) {
// #114 If file doesn't exist, attempt to url decode the URI and try again
String uriString = uri.toString();
if (uriString.startsWith(FILE_SCHEME)) {
File uriFile = new File(uriString.substring(FILE_SCHEME.length() - 1));
if (!uriFile.exists()) {
try {
uri = Uri.parse(URLDecoder.decode(uriString, "UTF-8"));
} catch (UnsupportedEncodingException e) {
// Fallback to encoded URI. This exception is not expected.
}
}
}
this.bitmap = null;
this.uri = uri;
this.resource = null;
Expand Down Expand Up @@ -103,7 +121,20 @@ public static ImageSource bitmap(Bitmap bitmap) {
if (bitmap == null) {
throw new NullPointerException("Bitmap must not be null");
}
return new ImageSource(bitmap);
return new ImageSource(bitmap, false);
}

/**
* Provide a loaded and cached bitmap for display. This bitmap will not be recycled when it is no
* longer needed. Use this method if you loaded the bitmap with an image loader such as Picasso
* or Volley.
* @param bitmap bitmap to be displayed.
*/
public static ImageSource cachedBitmap(Bitmap bitmap) {
if (bitmap == null) {
throw new NullPointerException("Bitmap must not be null");
}
return new ImageSource(bitmap, true);
}

/**
Expand Down Expand Up @@ -195,4 +226,8 @@ protected final int getSHeight() {
protected final Rect getSRegion() {
return sRegion;
}

protected final boolean isCached() {
return cached;
}
}
Loading