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;
|
||||
|
||||
try {
|
||||
if (m_activity.getApiLevel() >= 11) {
|
||||
excerpt = article.excerpt != null ? article.excerpt : "";
|
||||
excerpt = excerpt.replace("…", "…");
|
||||
excerpt = excerpt.replace("]]>", "");
|
||||
excerpt = Jsoup.parse(excerpt).text();
|
||||
if (article.excerpt != null) {
|
||||
excerpt = article.excerpt;
|
||||
} else {
|
||||
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() {
|
||||
articleDoc = Jsoup.parse(content);
|
||||
|
||||
|
@ -95,6 +95,7 @@ public class HeadlinesRequest extends ApiRequest {
|
||||
for (Article f : articles)
|
||||
if (!m_articles.containsId(f.id)) {
|
||||
f.collectMediaInfo();
|
||||
f.cleanupExcerpt();
|
||||
m_articles.add(f);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user