misc optimization, do not embed duplicate enclosure images in
ArticleFragment
This commit is contained in:
parent
c9c3aa3d36
commit
dcea7f0e85
@ -211,9 +211,10 @@ public class ArticleFragment extends Fragment {
|
||||
|
||||
try {
|
||||
URL url = new URL(a.content_url.trim());
|
||||
String strUrl = url.toString().trim();
|
||||
|
||||
if (a.content_type.indexOf("image") != -1) {
|
||||
content += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
|
||||
if (a.content_type.indexOf("image") != -1 && !articleContent.contains(strUrl)) {
|
||||
content += "<br/><img src=\"" + strUrl.replace("\"", "\\\"") + "\">";
|
||||
}
|
||||
|
||||
spinnerArray.add(a);
|
||||
|
@ -288,7 +288,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadlinesLoaded() {
|
||||
public void onHeadlinesLoaded(boolean appended) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
@ -148,14 +148,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
|
||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||
|
||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||
|
||||
af.setActiveArticle(article);
|
||||
|
||||
hf.notifyUpdated();
|
||||
|
||||
ft.commit();
|
||||
} else {
|
||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||
@ -169,11 +164,14 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeadlinesLoaded() {
|
||||
public void onHeadlinesLoaded(boolean appended) {
|
||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||
|
||||
if (hf != null) {
|
||||
Article article = hf.getAllArticles().get(0);
|
||||
if (hf != null && !appended) {
|
||||
Article article = hf.getActiveArticle();
|
||||
|
||||
if (article == null) {
|
||||
article = hf.getAllArticles().get(0);
|
||||
|
||||
hf.setActiveArticle(article);
|
||||
|
||||
@ -187,4 +185,5 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
||||
ft.commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,5 +7,5 @@ public interface HeadlinesEventListener {
|
||||
void onArticleListSelectionChange(ArticleList m_selectedArticles);
|
||||
void onArticleSelected(Article article);
|
||||
void onArticleSelected(Article article, boolean open);
|
||||
void onHeadlinesLoaded();
|
||||
void onHeadlinesLoaded(boolean appended);
|
||||
}
|
||||
|
@ -353,24 +353,26 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
if (m_activity != null) {
|
||||
m_refreshInProgress = true;
|
||||
|
||||
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
||||
append = false;
|
||||
}
|
||||
|
||||
final boolean fappend = append;
|
||||
final String sessionId = m_activity.getSessionId();
|
||||
final boolean showUnread = m_activity.getUnreadArticlesOnly();
|
||||
final boolean isCat = m_feed.is_cat;
|
||||
|
||||
HeadlinesRequest req = new HeadlinesRequest(getActivity().getApplicationContext(), m_activity) {
|
||||
protected void onPostExecute(JsonElement result) {
|
||||
super.onPostExecute(result);
|
||||
m_refreshInProgress = false;
|
||||
m_adapter.notifyDataSetChanged();
|
||||
m_listener.onHeadlinesLoaded();
|
||||
m_listener.onHeadlinesLoaded(fappend);
|
||||
}
|
||||
};
|
||||
|
||||
final String sessionId = m_activity.getSessionId();
|
||||
final boolean showUnread = m_activity.getUnreadArticlesOnly();
|
||||
final boolean isCat = m_feed.is_cat;
|
||||
int skip = 0;
|
||||
|
||||
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
||||
append = false;
|
||||
}
|
||||
|
||||
if (append) {
|
||||
for (Article a : m_articles) {
|
||||
if (a.unread) ++skip;
|
||||
|
Loading…
Reference in New Issue
Block a user