diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2015-03-08 22:33:17 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2015-03-08 22:34:13 +0100 |
commit | f44a56394254731f63eb279073f2949b09966aa1 (patch) | |
tree | 9eb5716149d0b4e979ccd69d7c9f030795243100 /main | |
parent | 4d88fbbead7c60b9200f1eb465c23cf6e911143b (diff) | |
download | cgeo-f44a56394254731f63eb279073f2949b09966aa1.zip cgeo-f44a56394254731f63eb279073f2949b09966aa1.tar.gz cgeo-f44a56394254731f63eb279073f2949b09966aa1.tar.bz2 |
fix #4727: images in short description are absent from images tab
Diffstat (limited to 'main')
-rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/Trackable.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/utils/ImageUtils.java | 27 |
3 files changed, 16 insertions, 15 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 8e9485e..67af107 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1682,7 +1682,7 @@ public class Geocache implements IWaypoint { for (final LogEntry log : getLogs()) { result.addAll(log.getLogImages()); } - ImageUtils.addImagesFromHtml(result, getDescription(), geocode); + ImageUtils.addImagesFromHtml(result, geocode, getShortDescription(), getDescription()); return result; } diff --git a/main/src/cgeo/geocaching/Trackable.java b/main/src/cgeo/geocaching/Trackable.java index f93ec7b..d7d2357 100644 --- a/main/src/cgeo/geocaching/Trackable.java +++ b/main/src/cgeo/geocaching/Trackable.java @@ -227,7 +227,7 @@ public class Trackable implements ILogable { if (StringUtils.isNotBlank(image)) { images.add(new Image(image, StringUtils.defaultIfBlank(name, geocode))); } - ImageUtils.addImagesFromHtml(images, getDetails(), geocode); + ImageUtils.addImagesFromHtml(images, geocode, getDetails()); for (final LogEntry log : getLogs()) { images.addAll(log.getLogImages()); } diff --git a/main/src/cgeo/geocaching/utils/ImageUtils.java b/main/src/cgeo/geocaching/utils/ImageUtils.java index 9011ab9..71d5e39 100644 --- a/main/src/cgeo/geocaching/utils/ImageUtils.java +++ b/main/src/cgeo/geocaching/utils/ImageUtils.java @@ -320,26 +320,27 @@ public final class ImageUtils { /** * Add images present in the HTML description to the existing collection. - * - * @param images a collection of images - * @param htmlText the HTML description to be parsed + * @param images a collection of images * @param geocode the common title for images in the description + * @param htmlText the HTML description to be parsed, can be repeated */ - public static void addImagesFromHtml(final Collection<Image> images, final String htmlText, final String geocode) { + public static void addImagesFromHtml(final Collection<Image> images, final String geocode, final String... htmlText) { final Set<String> urls = new LinkedHashSet<>(); for (final Image image : images) { urls.add(image.getUrl()); } - Html.fromHtml(StringUtils.defaultString(htmlText), new ImageGetter() { - @Override - public Drawable getDrawable(final String source) { - if (!urls.contains(source) && canBeOpenedExternally(source)) { - images.add(new Image(source, StringUtils.defaultString(geocode))); - urls.add(source); + for (final String text: htmlText) { + Html.fromHtml(StringUtils.defaultString(text), new ImageGetter() { + @Override + public Drawable getDrawable(final String source) { + if (!urls.contains(source) && canBeOpenedExternally(source)) { + images.add(new Image(source, StringUtils.defaultString(geocode))); + urls.add(source); + } + return null; } - return null; - } - }, null); + }, null); + } } /** |