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,13 +148,8 @@ 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 {
|
||||
@ -169,22 +164,26 @@ 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);
|
||||
hf.setActiveArticle(article);
|
||||
|
||||
ArticlePager af = new ArticlePager(article);
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
ArticlePager af = new ArticlePager(article);
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
|
||||
ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
|
||||
|
||||
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 onArticleSelected(Article article);
|
||||
void onArticleSelected(Article article, boolean open);
|
||||
void onHeadlinesLoaded();
|
||||
void onHeadlinesLoaded(boolean appended);
|
||||
}
|
||||
|
@ -352,25 +352,27 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
public void refresh(boolean append) {
|
||||
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