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);
|
refresh(false);
|
||||||
|
|
||||||
m_activity.initMenu();
|
m_activity.initMenu();
|
||||||
|
m_activity.setTitle(R.string.app_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,23 +67,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
protected void initMenu() {
|
protected void initMenu() {
|
||||||
super.initMenu();
|
super.initMenu();
|
||||||
|
|
||||||
Log.d(TAG, "initMenu: " + m_menu);
|
|
||||||
|
|
||||||
if (m_menu != null && m_sessionId != null) {
|
if (m_menu != null && m_sessionId != null) {
|
||||||
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||||
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
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, hf != null && hf.isAdded() && 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_selection, hf != null && hf.isAdded() && hf.getSelectedArticles().size() != 0);
|
||||||
|
|
||||||
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
MenuItem item = m_menu.findItem(R.id.show_feeds);
|
||||||
|
|
||||||
@ -92,7 +87,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
} else {
|
} else {
|
||||||
item.setTitle(R.string.menu_unread_feeds);
|
item.setTitle(R.string.menu_unread_feeds);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +95,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
FragmentTransaction ft = getSupportFragmentManager()
|
FragmentTransaction ft = getSupportFragmentManager()
|
||||||
.beginTransaction();
|
.beginTransaction();
|
||||||
|
|
||||||
|
TinyApplication.getInstance().m_loadedArticles.clear();
|
||||||
|
|
||||||
HeadlinesFragment hf = new HeadlinesFragment(feed);
|
HeadlinesFragment hf = new HeadlinesFragment(feed);
|
||||||
|
|
||||||
if (isSmallScreen()) {
|
if (isSmallScreen()) {
|
||||||
@ -171,7 +167,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loginSuccess() {
|
protected void loginSuccess() {
|
||||||
setLoadingStatus(R.string.blank, false);
|
setLoadingStatus(R.string.blank, false);
|
||||||
@ -188,6 +184,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
initMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -205,6 +205,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
|
|||||||
refresh(false);
|
refresh(false);
|
||||||
|
|
||||||
m_activity.initMenu();
|
m_activity.initMenu();
|
||||||
|
m_activity.setTitle(R.string.app_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,7 +61,6 @@ private final String TAG = this.getClass().getSimpleName();
|
|||||||
ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
|
ft.replace(R.id.article_fragment, af, FRAG_ARTICLE);
|
||||||
|
|
||||||
ft.commit();
|
ft.commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,6 +308,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
notifyUpdated();
|
notifyUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_activity.setTitle(m_feed.title);
|
||||||
m_activity.initMenu();
|
m_activity.initMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,8 +738,6 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
|
|
||||||
|
|
||||||
protected void initMenu() {
|
protected void initMenu() {
|
||||||
Log.d(TAG, "initMenu:" + m_menu);
|
|
||||||
|
|
||||||
if (m_menu != null) {
|
if (m_menu != null) {
|
||||||
if (m_sessionId != null) {
|
if (m_sessionId != null) {
|
||||||
m_menu.setGroupVisible(R.id.menu_group_logged_in, true);
|
m_menu.setGroupVisible(R.id.menu_group_logged_in, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user