diff options
author | Andrew Dolgov <[email protected]> | 2014-11-29 20:18:03 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-29 20:18:03 +0300 |
commit | 0615634ce1018a783d3823ad55254e6c2e0015d6 (patch) | |
tree | b057ac1e0a505f289d0e0ea0747ad5711909edec /org.fox.ttrss/src/main/java | |
parent | 225458f60a0633509539809fb7b6d56da25257e8 (diff) |
use excerpt getheadlines field for faster rendering if using api 11
Diffstat (limited to 'org.fox.ttrss/src/main/java')
3 files changed, 20 insertions, 7 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java index f804b3ce..2124feb4 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticlePager.java @@ -222,6 +222,8 @@ public class ArticlePager extends Fragment { put("op", "getHeadlines"); put("sid", sessionId); put("feed_id", String.valueOf(feed.id)); + put("show_excerpt", "true"); + put("excerpt_length", String.valueOf(CommonActivity.EXCERPT_MAX_LENGTH)); put("show_content", "true"); put("include_attachments", "true"); put("limit", String.valueOf(HeadlinesFragment.HEADLINES_REQUEST_SIZE)); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index 34f5dd59..cfae8037 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -538,8 +538,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, skip == 0; Log.d(TAG, "allowForceUpdate=" + allowForceUpdate + " userInitiated=" + userInitiated); - - + req.setOffset(skip); HashMap<String,String> map = new HashMap<String,String>() { @@ -547,6 +546,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, put("op", "getHeadlines"); put("sid", sessionId); put("feed_id", String.valueOf(m_feed.id)); + put("show_excerpt", "true"); + put("excerpt_length", String.valueOf(CommonActivity.EXCERPT_MAX_LENGTH)); put("show_content", "true"); put("include_attachments", "true"); put("view_mode", m_activity.getViewMode()); @@ -838,8 +839,15 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (holder.excerptView != null) { if (!m_prefs.getBoolean("headlines_show_content", true)) { holder.excerptView.setVisibility(View.GONE); - } else if (articleDoc != null) { - String excerpt = articleDoc.text(); + } else { + String excerpt; + + if (m_activity.getApiLevel() >= 11) { + excerpt = article.excerpt != null ? article.excerpt : ""; + excerpt = excerpt.replace("…", ""); + } else { + excerpt = articleDoc.text(); + } if (excerpt.length() > CommonActivity.EXCERPT_MAX_LENGTH) excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_LENGTH) + "…"; diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java index 9beea81a..9c34487b 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/types/Article.java @@ -1,11 +1,11 @@ package org.fox.ttrss.types; -import java.util.ArrayList; -import java.util.List; - import android.os.Parcel; import android.os.Parcelable; +import java.util.ArrayList; +import java.util.List; + // TODO: serialize Labels public class Article implements Parcelable { public int id; @@ -21,6 +21,7 @@ public class Article implements Parcelable { public List<String> tags; public List<Attachment> attachments; public String content; + public String excerpt; public List<List<String>> labels; public String feed_title; public int comments_count; @@ -63,6 +64,7 @@ public class Article implements Parcelable { out.writeInt(feed_id); out.writeStringList(tags); out.writeString(content); + out.writeString(excerpt); out.writeList(attachments); out.writeString(feed_title); out.writeInt(comments_count); @@ -88,6 +90,7 @@ public class Article implements Parcelable { in.readStringList(tags); content = in.readString(); + excerpt = in.readString(); attachments = new ArrayList<Attachment>(); in.readList(attachments, Attachment.class.getClassLoader()); |