From 7ca2f559d1a357bc88f33bce4b590619fe9f4c0b Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Fri, 16 Nov 2012 20:40:39 +0100 Subject: [PATCH] Save references to description and contentEncoded in description fragment --- .../fragment/ItemDescriptionFragment.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index 0f13e8fd6..8452f24c1 100644 --- a/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/src/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -33,6 +33,9 @@ public class ItemDescriptionFragment extends SherlockFragment { private FeedItem item; private AsyncTask webViewLoader; + + private String descriptionRef; + private String contentEncodedRef; public static ItemDescriptionFragment newInstance(FeedItem item) { ItemDescriptionFragment f = new ItemDescriptionFragment(); @@ -109,12 +112,17 @@ public class ItemDescriptionFragment extends SherlockFragment { public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (item != null) { - if (item.getDescription() == null && item.getContentEncoded() == null) { + if (item.getDescription() == null + && item.getContentEncoded() == null) { Log.i(TAG, "Loading data"); FeedManager.getInstance().loadExtraInformationOfItem( getActivity(), item, new FeedManager.TaskCallback() { @Override public void onCompletion(Cursor result) { + if (item.getDescription() == null + && item.getContentEncoded() == null) { + Log.e(TAG, "No description found"); + } startLoader(); } }); @@ -134,6 +142,8 @@ public class ItemDescriptionFragment extends SherlockFragment { @SuppressLint("NewApi") private void startLoader() { + contentEncodedRef = item.getContentEncoded(); + descriptionRef = item.getDescription(); webViewLoader = createLoader(); if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD_MR1) { webViewLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); @@ -185,12 +195,11 @@ public class ItemDescriptionFragment extends SherlockFragment { if (AppConfig.DEBUG) Log.d(TAG, "Loading Webview"); data = ""; - if (item.getContentEncoded() == null - && item.getDescription() != null) { - data = item.getDescription(); + if (contentEncodedRef == null + && descriptionRef != null) { + data = descriptionRef; } else { - data = StringEscapeUtils.unescapeHtml4(item - .getContentEncoded()); + data = StringEscapeUtils.unescapeHtml4(contentEncodedRef); } data = WEBVIEW_STYLE + data;