diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index c3279196..76471811 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -1,70 +1,95 @@ + - - - - - + - - - - - - + - - - - - + - - - + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index f989791e..02677b38 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -542,8 +542,54 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe public void initMainMenu() { if (m_menu != null) { - if (m_sessionId != null) { + m_menu.setGroupVisible(R.id.menu_group_logged_in, true); + m_menu.setGroupVisible(R.id.menu_group_logged_out, false); + + if (m_activeFeed != null) { + m_menu.findItem(R.id.load_more_articles).setVisible(m_canLoadMore); + m_menu.findItem(R.id.show_all_articles).setVisible(true); + } else { + m_menu.setGroupVisible(R.id.menu_group_headlines, false); + } + + if (m_selectedArticle != null) { + m_menu.setGroupVisible(R.id.menu_group_article, true); + + m_menu.findItem(R.id.update_feeds).setVisible(false); + m_menu.findItem(R.id.show_feeds).setVisible(false); + m_menu.findItem(R.id.back_to_categories).setVisible(false); + + if (m_smallScreenMode) { + m_menu.setGroupVisible(R.id.menu_group_headlines, false); + } else { + m_menu.setGroupVisible(R.id.menu_group_headlines, true); + } + + } else { + m_menu.setGroupVisible(R.id.menu_group_article, false); + + if (!m_smallScreenMode || m_activeFeed == null) { + m_menu.findItem(R.id.show_feeds).setVisible(true); + m_menu.findItem(R.id.update_feeds).setVisible(true); + } else { + m_menu.findItem(R.id.show_feeds).setVisible(false); + m_menu.findItem(R.id.update_feeds).setVisible(false); + } + + m_menu.findItem(R.id.back_to_categories).setVisible(m_activeCategory != null); + + if (m_activeFeed != null) { + m_menu.setGroupVisible(R.id.menu_group_headlines, true); + } + } + + } else { + m_menu.setGroupVisible(R.id.menu_group_logged_in, false); + m_menu.setGroupVisible(R.id.menu_group_logged_out, true); + } + + /* if (m_sessionId != null) { m_menu.findItem(R.id.login).setVisible(false); m_menu.findItem(R.id.logout).setVisible(m_activeFeed == null && m_selectedArticle == null); @@ -598,7 +644,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe m_menu.findItem(R.id.update_feeds).setVisible(false); m_menu.findItem(R.id.show_feeds).setVisible(false); - } + } */ } }