fix options menu disappearing on refresh
This commit is contained in:
parent
c580d8225a
commit
721c98ce98
@ -180,6 +180,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
|
||||
refresh(false);
|
||||
|
||||
m_activity.initMenu();
|
||||
m_activity.setTitle(R.string.app_name);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,23 +67,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
protected void initMenu() {
|
||||
super.initMenu();
|
||||
|
||||
Log.d(TAG, "initMenu: " + m_menu);
|
||||
|
||||
if (m_menu != null && m_sessionId != null) {
|
||||
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||
|
||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||
|
||||
Log.d(TAG, "ff/cf/af/hf " + ff + " " + cf + " " + af + " " + hf);
|
||||
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
|
||||
|
||||
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isVisible()) || (cf != null && cf.isVisible()));
|
||||
m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isAdded());
|
||||
|
||||
m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isVisible());
|
||||
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isVisible() && hf.getSelectedArticles().size() == 0);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, hf != null && hf.isVisible() && hf.getSelectedArticles().size() != 0);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && hf.getSelectedArticles().size() == 0);
|
||||
m_menu.setGroupVisible(R.id.menu_group_headlines_selection, hf != null && hf.isAdded() && hf.getSelectedArticles().size() != 0);
|
||||
|
||||
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
||||
|
||||
@ -92,7 +87,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
} else {
|
||||
item.setTitle(R.string.menu_unread_feeds);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +95,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
|
||||
TinyApplication.getInstance().m_loadedArticles.clear();
|
||||
|
||||
HeadlinesFragment hf = new HeadlinesFragment(feed);
|
||||
|
||||
if (isSmallScreen()) {
|
||||
@ -188,6 +184,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
initMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -205,6 +205,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
||||
refresh(false);
|
||||
|
||||
m_activity.initMenu();
|
||||
m_activity.setTitle(R.string.app_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +61,6 @@ private final String TAG = this.getClass().getSimpleName();
|
||||
ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
|
||||
|
||||
ft.commit();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,6 +308,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
notifyUpdated();
|
||||
}
|
||||
|
||||
m_activity.setTitle(m_feed.title);
|
||||
m_activity.initMenu();
|
||||
}
|
||||
|
||||
|
@ -738,8 +738,6 @@ public class OnlineActivity extends CommonActivity {
|
||||
|
||||
|
||||
protected void initMenu() {
|
||||
Log.d(TAG, "initMenu:" + m_menu);
|
||||
|
||||
if (m_menu != null) {
|
||||
if (m_sessionId != null) {
|
||||
m_menu.setGroupVisible(R.id.menu_group_logged_in, true);
|
||||
|
Loading…
Reference in New Issue
Block a user