various tablet-mode refresh fixes
This commit is contained in:
parent
d3e0ce0f83
commit
9d283da0f0
@ -85,6 +85,8 @@ public class ArticlePager extends Fragment {
|
||||
|
||||
int position = m_articles.indexOf(m_article);
|
||||
|
||||
m_listener.onArticleSelected(m_article, false);
|
||||
|
||||
pager.setAdapter(m_adapter);
|
||||
pager.setCurrentItem(position);
|
||||
pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@ -149,9 +151,8 @@ public class ArticlePager extends Fragment {
|
||||
if (result != null) {
|
||||
m_adapter.notifyDataSetChanged();
|
||||
|
||||
if (m_article.id == 0) {
|
||||
if (m_article.id == 0 || m_articles.indexOf(m_article) == -1) {
|
||||
if (m_articles.size() > 0) {
|
||||
Log.d(TAG, "blank id on refresh");
|
||||
m_article = m_articles.get(0);
|
||||
m_listener.onArticleSelected(m_article, false);
|
||||
}
|
||||
@ -235,8 +236,6 @@ public class ArticlePager extends Fragment {
|
||||
if (m_articles.size() == 0 || !m_feed.equals(GlobalState.getInstance().m_activeFeed)) {
|
||||
refresh(false);
|
||||
GlobalState.getInstance().m_activeFeed = m_feed;
|
||||
} else {
|
||||
m_adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
m_activity.initMenu();
|
||||
@ -247,6 +246,7 @@ public class ArticlePager extends Fragment {
|
||||
}
|
||||
|
||||
public void setActiveArticle(Article article) {
|
||||
if (m_article != article) {
|
||||
m_article = article;
|
||||
|
||||
int position = m_articles.indexOf(m_article);
|
||||
@ -255,4 +255,5 @@ public class ArticlePager extends Fragment {
|
||||
|
||||
pager.setCurrentItem(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
|
||||
public void onHeadlinesLoaded(boolean appended) {
|
||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||
|
||||
if (hf != null && !appended) {
|
||||
if (hf != null) {
|
||||
Article article = hf.getActiveArticle();
|
||||
|
||||
if (article == null) {
|
||||
|
@ -374,6 +374,10 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
|
||||
if (result != null) {
|
||||
m_refreshInProgress = false;
|
||||
|
||||
if (m_articles.indexOf(m_activeArticle) == -1)
|
||||
m_activeArticle = null;
|
||||
|
||||
m_adapter.notifyDataSetChanged();
|
||||
m_listener.onHeadlinesLoaded(fappend);
|
||||
} else {
|
||||
@ -817,6 +821,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
}
|
||||
|
||||
public void setActiveArticle(Article article) {
|
||||
if (article != m_activeArticle) {
|
||||
m_activeArticle = article;
|
||||
m_adapter.notifyDataSetChanged();
|
||||
|
||||
@ -827,6 +832,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
list.setSelection(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelection(ArticlesSelection select) {
|
||||
m_selectedArticles.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user