use excerpt getheadlines field for faster rendering if using api 11

This commit is contained in:
Andrew Dolgov 2014-11-29 20:18:03 +03:00
parent 225458f60a
commit 0615634ce1
4 changed files with 22 additions and 9 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="291"
android:versionName="1.82" >
android:versionCode="292"
android:versionName="1.83" >
<uses-sdk
android:minSdkVersion="10"

View File

@ -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));

View File

@ -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("&hellip;", "");
} else {
excerpt = articleDoc.text();
}
if (excerpt.length() > CommonActivity.EXCERPT_MAX_LENGTH)
excerpt = excerpt.substring(0, CommonActivity.EXCERPT_MAX_LENGTH) + "";

View File

@ -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());