From c33708a1cfd75e067ec97c825557c526721404eb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 21 Feb 2012 09:04:10 +0300 Subject: support attachments in combined mode, fix french translation, bump version --- src/org/fox/ttrss/ArticleFragment.java | 6 +++--- src/org/fox/ttrss/HeadlinesFragment.java | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index d79998db..071ffba5 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -153,7 +153,7 @@ public class ArticleFragment extends Fragment { "" + articleContent; if (m_article.attachments != null && m_article.attachments.size() != 0) { - String attachments = "
Attachments: "; + String attachments = "
" + getString(R.string.attachments) + " "; for (Attachment a : m_article.attachments) { if (a.content_type != null && a.content_url != null && a.content_type.indexOf("image") != -1) { @@ -163,9 +163,9 @@ public class ArticleFragment extends Fragment { String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName(); - content += "
"; + content += "
"; - attachments += "" + atitle + ", "; + attachments += "" + atitle + ", "; } catch (MalformedURLException e) { // diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 72006654..1adbeff1 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -1,6 +1,9 @@ package org.fox.ttrss; +import java.io.File; import java.lang.reflect.Type; +import java.net.MalformedURLException; +import java.net.URL; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -441,6 +444,33 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (m_combinedMode) { content.setMovementMethod(LinkMovementMethod.getInstance()); + if (article.attachments != null && article.attachments.size() != 0) { + String attachments = "
" + getString(R.string.attachments) + " "; + + for (Attachment a : article.attachments) { + if (a.content_type != null && a.content_url != null && a.content_type.indexOf("image") != -1) { + + try { + URL url = new URL(a.content_url.trim()); + + String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName(); + + articleContent += "
"; + + attachments += "" + atitle + ", "; + + } catch (MalformedURLException e) { + // + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + articleContent += attachments.replaceAll(", $", ""); + articleContent += "
"; + } + //content.setText(Html.fromHtml(article.content, new URLImageGetter(content, getActivity()), null)); content.setText(Html.fromHtml(articleContent, m_dummyGetter, null)); -- cgit v1.2.3-54-g00ecf