From 88c87fefea76d930f1a97e8f3ea56f8b252c66fe Mon Sep 17 00:00:00 2001 From: misaochan Date: Thu, 7 Jul 2016 19:32:03 +1200 Subject: [PATCH] Always load image from Internet --- .../fr/free/nrw/commons/media/MediaDetailFragment.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java b/app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java index 5edb71e47..c425e32ed 100644 --- a/app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/media/MediaDetailFragment.java @@ -183,7 +183,8 @@ public class MediaDetailFragment extends Fragment { } private void displayMediaDetails(final Media media) { - String actualUrl = (media.getLocalUri() != null && !TextUtils.isEmpty(media.getLocalUri().toString())) ? media.getLocalUri().toString() : media.getThumbnailUrl(640); + //Always load image from Internet to allow viewing the desc, license, and cats + String actualUrl = media.getThumbnailUrl(640); if(actualUrl.startsWith("http")) { Log.d("Volley", "Actual URL starts with http and is: " + actualUrl); @@ -222,7 +223,7 @@ public class MediaDetailFragment extends Fragment { if (success.booleanValue()) { extractor.fill(media); - // Fill some fields + // Set text of desc, license, and categories desc.setText(prettyDescription(media)); license.setText(prettyLicense(media)); @@ -243,7 +244,8 @@ public class MediaDetailFragment extends Fragment { }; Utils.executeAsyncTask(detailFetchTask); } else { - //FIXME: This branch does not display desc, categories, and license + //This should not usually happen, image along with associated details should always be loaded from Internet, but keeping this for now for backup. + //Even if image is loaded from device storage, it will display, albeit with empty desc and cat. Log.d("Volley", "Actual URL does not start with http and is: " + actualUrl); com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(actualUrl, image, displayOptions, new ImageLoadingListener() { public void onLoadingStarted(String s, View view) { @@ -264,7 +266,6 @@ public class MediaDetailFragment extends Fragment { } // Set text of desc, license, and categories - // FIXME: This reveals the desc, license, and categories fields, but displays the wrong desc and categories desc.setText(prettyDescription(media)); license.setText(prettyLicense(media));