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 {
|
try {
|
||||||
URL url = new URL(a.content_url.trim());
|
URL url = new URL(a.content_url.trim());
|
||||||
|
String strUrl = url.toString().trim();
|
||||||
|
|
||||||
if (a.content_type.indexOf("image") != -1) {
|
if (a.content_type.indexOf("image") != -1 && !articleContent.contains(strUrl)) {
|
||||||
content += "<br/><img src=\"" + url.toString().trim().replace("\"", "\\\"") + "\">";
|
content += "<br/><img src=\"" + strUrl.replace("\"", "\\\"") + "\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
spinnerArray.add(a);
|
spinnerArray.add(a);
|
||||||
|
@ -288,7 +288,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHeadlinesLoaded() {
|
public void onHeadlinesLoaded(boolean appended) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,14 +148,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
FragmentTransaction ft = getSupportFragmentManager()
|
FragmentTransaction ft = getSupportFragmentManager()
|
||||||
.beginTransaction();
|
.beginTransaction();
|
||||||
|
|
||||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
|
||||||
|
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
af.setActiveArticle(article);
|
af.setActiveArticle(article);
|
||||||
|
|
||||||
hf.notifyUpdated();
|
|
||||||
|
|
||||||
ft.commit();
|
ft.commit();
|
||||||
} else {
|
} else {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
@ -169,22 +164,26 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHeadlinesLoaded() {
|
public void onHeadlinesLoaded(boolean appended) {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
|
||||||
if (hf != null) {
|
if (hf != null && !appended) {
|
||||||
Article article = hf.getAllArticles().get(0);
|
Article article = hf.getActiveArticle();
|
||||||
|
|
||||||
hf.setActiveArticle(article);
|
if (article == null) {
|
||||||
|
article = hf.getAllArticles().get(0);
|
||||||
|
|
||||||
ArticlePager af = new ArticlePager(article);
|
hf.setActiveArticle(article);
|
||||||
|
|
||||||
FragmentTransaction ft = getSupportFragmentManager()
|
ArticlePager af = new ArticlePager(article);
|
||||||
.beginTransaction();
|
|
||||||
|
|
||||||
ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
|
FragmentTransaction ft = getSupportFragmentManager()
|
||||||
|
.beginTransaction();
|
||||||
|
|
||||||
ft.commit();
|
ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
|
||||||
|
|
||||||
|
ft.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,5 @@ public interface HeadlinesEventListener {
|
|||||||
void onArticleListSelectionChange(ArticleList m_selectedArticles);
|
void onArticleListSelectionChange(ArticleList m_selectedArticles);
|
||||||
void onArticleSelected(Article article);
|
void onArticleSelected(Article article);
|
||||||
void onArticleSelected(Article article, boolean open);
|
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) {
|
if (m_activity != null) {
|
||||||
m_refreshInProgress = true;
|
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) {
|
HeadlinesRequest req = new HeadlinesRequest(getActivity().getApplicationContext(), m_activity) {
|
||||||
protected void onPostExecute(JsonElement result) {
|
protected void onPostExecute(JsonElement result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
m_refreshInProgress = false;
|
m_refreshInProgress = false;
|
||||||
m_adapter.notifyDataSetChanged();
|
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;
|
int skip = 0;
|
||||||
|
|
||||||
if (!m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
|
||||||
append = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (append) {
|
if (append) {
|
||||||
for (Article a : m_articles) {
|
for (Article a : m_articles) {
|
||||||
if (a.unread) ++skip;
|
if (a.unread) ++skip;
|
||||||
|
Loading…
Reference in New Issue
Block a user