diff --git a/res/layout/article_fragment.xml b/res/layout/article_fragment.xml index 48b597de..dde2265d 100644 --- a/res/layout/article_fragment.xml +++ b/res/layout/article_fragment.xml @@ -6,8 +6,16 @@ android:layout_width="match_parent" android:layout_weight="1" android:layout_height="match_parent" android:orientation="vertical"> - - + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 6441033b..b951c291 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -29,6 +29,7 @@ Show unread feeds Show all feeds Refresh feeds - Close article + Close article Share article + Could not decode content (UnsupportedEncodingException) diff --git a/src/org/fox/ttrss/ArticleFragment.java b/src/org/fox/ttrss/ArticleFragment.java index 7e1d528f..511932bc 100644 --- a/src/org/fox/ttrss/ArticleFragment.java +++ b/src/org/fox/ttrss/ArticleFragment.java @@ -1,6 +1,9 @@ package org.fox.ttrss; +import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.Date; import android.app.Activity; import android.app.Fragment; @@ -37,8 +40,8 @@ public class ArticleFragment extends Fragment { TextView title = (TextView)view.findViewById(R.id.title); if (title != null) { - title.setText(Html.fromHtml("" + m_article.title + "")); title.setMovementMethod(LinkMovementMethod.getInstance()); + title.setText(Html.fromHtml("" + m_article.title + "")); } WebView web = (WebView)view.findViewById(R.id.content); @@ -47,13 +50,36 @@ public class ArticleFragment extends Fragment { // this is ridiculous // TODO white on black style for dark theme - String content = URLEncoder.encode("" + - "" + - "" + m_article.content + "").replace('+', ' '); + String content; + try { + content = URLEncoder.encode("" + + "" + + "" + // wtf, google? + "" + + "" + + "" + m_article.content + "", "utf-8").replace('+', ' '); + } catch (UnsupportedEncodingException e) { + content = getString(R.string.could_not_decode_content); + e.printStackTrace(); + } web.loadData(content, "text/html", "utf-8"); } + TextView dv = (TextView)view.findViewById(R.id.date); + + if (dv != null) { + Date d = new Date(m_article.updated * 1000L); + SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy, HH:mm"); + dv.setText(df.format(d)); + } + + TextView cv = (TextView)view.findViewById(R.id.comments); + + // comments are not currently returned by the API + if (cv != null) { + cv.setVisibility(View.GONE); + } } return view;