support non-image attachments (closes #434)

bump version
This commit is contained in:
Andrew Dolgov 2012-03-11 09:31:16 +03:00
parent 14769a4019
commit 2b4bc5ef32
3 changed files with 10 additions and 6 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="67" android:versionCode="68"
android:versionName="0.5.3" > android:versionName="0.5.4" >
<uses-sdk android:minSdkVersion="7" /> <uses-sdk android:minSdkVersion="7" />

View File

@ -167,14 +167,16 @@ public class ArticleFragment extends Fragment {
String attachments = "<div class=\"attachments\">" + getString(R.string.attachments) + " "; String attachments = "<div class=\"attachments\">" + getString(R.string.attachments) + " ";
for (Attachment a : m_article.attachments) { for (Attachment a : m_article.attachments) {
if (a.content_type != null && a.content_url != null && a.content_type.indexOf("image") != -1) { if (a.content_type != null && a.content_url != null) {
try { try {
URL url = new URL(a.content_url.trim()); URL url = new URL(a.content_url.trim());
String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName(); String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName();
content += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">"; if (a.content_type.indexOf("image") != -1) {
content += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
}
attachments += "<a href=\""+url.toString().trim().replace("\"", "\\\"") + "\">" + atitle + "</a>, "; attachments += "<a href=\""+url.toString().trim().replace("\"", "\\\"") + "\">" + atitle + "</a>, ";

View File

@ -448,14 +448,16 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
String attachments = "<div style=\"font-size : 70%; margin-top : 1em;\">" + getString(R.string.attachments) + " "; String attachments = "<div style=\"font-size : 70%; margin-top : 1em;\">" + getString(R.string.attachments) + " ";
for (Attachment a : article.attachments) { for (Attachment a : article.attachments) {
if (a.content_type != null && a.content_url != null && a.content_type.indexOf("image") != -1) { if (a.content_type != null && a.content_url != null) {
try { try {
URL url = new URL(a.content_url.trim()); URL url = new URL(a.content_url.trim());
String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName(); String atitle = (a.title != null && a.title.length() > 0) ? a.title : new File(url.getFile()).getName();
articleContent += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">"; if (a.content_type.indexOf("image") != -1) {
articleContent += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
}
attachments += "<a href=\""+url.toString().trim().replace("\"", "\\\"") + "\">" + atitle + "</a>, "; attachments += "<a href=\""+url.toString().trim().replace("\"", "\\\"") + "\">" + atitle + "</a>, ";