aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-08-23 15:14:03 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-08-23 15:14:03 +0200
commita3efd8b0018b59f5bbb83b5e136272802c3c7dcf (patch)
tree054dd5a12ba4215cabb809cffefa614796b6edce
parentd8985edef29db7260854226bd61bda30c77a1e30 (diff)
downloadcgeo-a3efd8b0018b59f5bbb83b5e136272802c3c7dcf.zip
cgeo-a3efd8b0018b59f5bbb83b5e136272802c3c7dcf.tar.gz
cgeo-a3efd8b0018b59f5bbb83b5e136272802c3c7dcf.tar.bz2
move image related constant out of geocache class
-rw-r--r--main/src/cgeo/geocaching/Geocache.java6
-rw-r--r--main/src/cgeo/geocaching/utils/ImageUtils.java8
2 files changed, 9 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index 16a5023..61f13b9 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -161,10 +161,6 @@ public class Geocache implements ICache, IWaypoint {
private Handler changeNotificationHandler = null;
- // Images whose URL contains one of those patterns will not be available on the Images tab
- // for opening into an external application.
- private final static String[] NO_EXTERNAL = new String[]{"geocheck.org"};
-
/**
* Create a new cache. To be used everywhere except for the GPX parser
*/
@@ -1706,7 +1702,7 @@ public class Geocache implements ICache, IWaypoint {
Html.fromHtml(getDescription(), new ImageGetter() {
@Override
public Drawable getDrawable(final String source) {
- if (!urls.contains(source) && !ImageUtils.containsPattern(source, NO_EXTERNAL)) {
+ if (!urls.contains(source) && ImageUtils.canBeOpenedExternally(source)) {
images.add(new Image(source, geocode));
urls.add(source);
}
diff --git a/main/src/cgeo/geocaching/utils/ImageUtils.java b/main/src/cgeo/geocaching/utils/ImageUtils.java
index d2edfc6..d25d5a4 100644
--- a/main/src/cgeo/geocaching/utils/ImageUtils.java
+++ b/main/src/cgeo/geocaching/utils/ImageUtils.java
@@ -49,6 +49,10 @@ public final class ImageUtils {
private static final int[] ROTATION = new int[] { 90, 180, 270 };
private static final int MAX_DISPLAY_IMAGE_XY = 800;
+ // Images whose URL contains one of those patterns will not be available on the Images tab
+ // for opening into an external application.
+ private final static String[] NO_EXTERNAL = new String[] { "geocheck.org" };
+
private ImageUtils() {
// Do not let this class be instantiated, this is a utility class.
}
@@ -341,4 +345,8 @@ public final class ImageUtils {
drawableObservable.observeOn(AndroidSchedulers.mainThread()).subscribe(this);
}
}
+
+ public static boolean canBeOpenedExternally(final String source) {
+ return !containsPattern(source, NO_EXTERNAL);
+ }
}