Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS-for-Honeycomb

This commit is contained in:
Andrew Dolgov 2012-10-10 13:28:27 +04:00
commit 171461be53
5 changed files with 48 additions and 1 deletions

View File

@ -22,6 +22,15 @@
android:text="There are many variations of passages of Lorem Ipsum available" android:text="There are many variations of passages of Lorem Ipsum available"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView
android:id="@+id/comments"
android:textColor="?linkColor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="24 comments"
android:textSize="13sp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -145,4 +145,5 @@
<string name="error_ssl_hostname_rejected">Error: SSL hostname not verified</string> <string name="error_ssl_hostname_rejected">Error: SSL hostname not verified</string>
<string name="offline_oldest_first">Show oldest articles first</string> <string name="offline_oldest_first">Show oldest articles first</string>
<string name="prefs_dim_status_bar">Dim status bar when reading</string> <string name="prefs_dim_status_bar">Dim status bar when reading</string>
<string name="article_comments">%1$d comments</string>
</resources> </resources>

View File

@ -141,6 +141,35 @@ public class ArticleFragment extends Fragment {
registerForContextMenu(title); registerForContextMenu(title);
} }
TextView comments = (TextView)view.findViewById(R.id.comments);
if (comments != null) {
if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) {
String commentsTitle = getString(R.string.article_comments, m_article.comments_count);
comments.setText(commentsTitle);
comments.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
comments.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
String link = (m_article.comments_link != null && m_article.comments_link.length() > 0) ?
m_article.comments_link : m_article.link;
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(link.trim()));
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
m_activity.toast(R.string.error_other_error);
}
}
});
} else {
comments.setVisibility(View.GONE);
}
}
WebView web = (WebView)view.findViewById(R.id.content); WebView web = (WebView)view.findViewById(R.id.content);
if (web != null) { if (web != null) {

View File

@ -143,6 +143,12 @@ public class OfflineArticleFragment extends Fragment {
registerForContextMenu(title); registerForContextMenu(title);
} }
TextView comments = (TextView)view.findViewById(R.id.comments);
if (comments != null) {
comments.setVisibility(View.GONE);
}
WebView web = (WebView)view.findViewById(R.id.content); WebView web = (WebView)view.findViewById(R.id.content);
if (web != null) { if (web != null) {

View File

@ -21,7 +21,9 @@ public class Article implements Parcelable {
public List<Attachment> attachments; public List<Attachment> attachments;
public String content; public String content;
public List<List<String>> labels; public List<List<String>> labels;
public String feed_title; public String feed_title;
public int comments_count;
public String comments_link;
public Article(Parcel in) { public Article(Parcel in) {
readFromParcel(in); readFromParcel(in);