move excerpt cleanup to Article class
This commit is contained in:
parent
614612a8e1
commit
7c0b223f6d
|
@ -1094,11 +1094,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
String excerpt;
|
String excerpt;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (m_activity.getApiLevel() >= 11) {
|
if (article.excerpt != null) {
|
||||||
excerpt = article.excerpt != null ? article.excerpt : "";
|
excerpt = article.excerpt;
|
||||||
excerpt = excerpt.replace("…", "…");
|
|
||||||
excerpt = excerpt.replace("]]>", "");
|
|
||||||
excerpt = Jsoup.parse(excerpt).text();
|
|
||||||
} else {
|
} else {
|
||||||
excerpt = article.articleDoc.text();
|
excerpt = article.articleDoc.text();
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,14 @@ public class Article implements Parcelable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cleanupExcerpt() {
|
||||||
|
if (excerpt != null) {
|
||||||
|
excerpt = excerpt.replace("…", "…");
|
||||||
|
excerpt = excerpt.replace("]]>", "");
|
||||||
|
excerpt = Jsoup.parse(excerpt).text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void collectMediaInfo() {
|
public void collectMediaInfo() {
|
||||||
articleDoc = Jsoup.parse(content);
|
articleDoc = Jsoup.parse(content);
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ public class HeadlinesRequest extends ApiRequest {
|
||||||
for (Article f : articles)
|
for (Article f : articles)
|
||||||
if (!m_articles.containsId(f.id)) {
|
if (!m_articles.containsId(f.id)) {
|
||||||
f.collectMediaInfo();
|
f.collectMediaInfo();
|
||||||
|
f.cleanupExcerpt();
|
||||||
m_articles.add(f);
|
m_articles.add(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user