aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/ui/HtmlImageCounter.java19
-rw-r--r--main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java43
2 files changed, 3 insertions, 59 deletions
diff --git a/main/src/cgeo/geocaching/ui/HtmlImageCounter.java b/main/src/cgeo/geocaching/ui/HtmlImageCounter.java
deleted file mode 100644
index 24b70ea..0000000
--- a/main/src/cgeo/geocaching/ui/HtmlImageCounter.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cgeo.geocaching.ui;
-
-import android.graphics.drawable.Drawable;
-import android.text.Html;
-
-public class HtmlImageCounter implements Html.ImageGetter {
-
- private int imageCount = 0;
-
- @Override
- public Drawable getDrawable(String url) {
- imageCount++;
- return null;
- }
-
- public int getImageCount() {
- return imageCount;
- }
-} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
index e951394..9532946 100644
--- a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
@@ -4,13 +4,11 @@ import cgeo.geocaching.ImagesActivity;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
import cgeo.geocaching.activity.AbstractActivity;
-import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.ui.AbstractCachingListViewPageViewCreator;
import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod;
import cgeo.geocaching.ui.DecryptTextClickListener;
-import cgeo.geocaching.ui.HtmlImageCounter;
import cgeo.geocaching.ui.UserActionsClickListener;
import cgeo.geocaching.utils.Formatter;
import cgeo.geocaching.utils.TextUtils;
@@ -18,9 +16,7 @@ import cgeo.geocaching.utils.UnknownTagsHandler;
import org.apache.commons.lang3.StringEscapeUtils;
-import android.os.AsyncTask;
import android.text.Html;
-import android.text.Spanned;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
@@ -88,17 +84,10 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre
String logText = log.log;
if (TextUtils.containsHtml(logText)) {
logText = log.getDisplayText();
- // Fast preview: parse only HTML without loading any images
- final HtmlImageCounter imageCounter = new HtmlImageCounter();
final UnknownTagsHandler unknownTagsHandler = new UnknownTagsHandler();
- holder.text.setText(Html.fromHtml(logText, imageCounter, unknownTagsHandler), TextView.BufferType.SPANNABLE);
- if (imageCounter.getImageCount() > 0) {
- // Complete view: parse again with loading images - if necessary ! If there are any images causing problems the user can see at least the preview
- final LogImageLoader loader = new LogImageLoader(holder);
- loader.execute(logText);
- }
- }
- else {
+ holder.text.setText(Html.fromHtml(logText, new HtmlImage(getGeocode(), false, StoredList.STANDARD_LIST_ID, false, holder.text),
+ unknownTagsHandler), TextView.BufferType.SPANNABLE);
+ } else {
holder.text.setText(logText, TextView.BufferType.SPANNABLE);
}
@@ -146,30 +135,4 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre
abstract protected boolean isValid();
- /** Loads the Log Images outside the UI thread. */
-
- private class LogImageLoader extends AsyncTask<String, Progress, Spanned> {
- final private LogViewHolder holder;
- final private int position;
-
- public LogImageLoader(final LogViewHolder holder) {
- this.holder = holder;
- this.position = holder.getPosition();
- }
-
- @Override
- protected Spanned doInBackground(final String... logtext) {
- return Html.fromHtml(logtext[0], new HtmlImage(getGeocode(), false, StoredList.STANDARD_LIST_ID, false), null); //, TextView.BufferType.SPANNABLE)
- }
-
- @Override
- protected void onPostExecute(final Spanned result) {
- // Ensure that this holder and its view still references the right item before updating the text.
- if (position == holder.getPosition()) {
- holder.text.setText(result);
- }
- }
-
- }
-
}