better approach to hiding headlines menu when it is unneded (refs #712)

This commit is contained in:
Andrew Dolgov 2013-06-11 08:57:25 +04:00
parent fa3ee0b886
commit fde20a4500
5 changed files with 29 additions and 8 deletions

View File

@ -4,6 +4,13 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/sw600dp_anchor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"

View File

@ -2,7 +2,14 @@
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:orientation="vertical">
<FrameLayout
android:id="@+id/sw600dp_anchor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"

View File

@ -4,6 +4,13 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@+id/sw600dp_anchor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" >
</FrameLayout>
<LinearLayout
android:id="@+id/loading_container"
android:layout_width="match_parent"

View File

@ -35,7 +35,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState);
@ -140,9 +140,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
if (m_menu != null && getSessionId() != null) {
m_menu.setGroupVisible(R.id.menu_group_feeds, false);
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
//HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && hf != null && hf.isAdded() && hf.isVisible());
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen());
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);

View File

@ -38,7 +38,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null);
setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
if (isPortrait()) {
findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
@ -135,13 +135,13 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
@Override
protected void initMenu() {
super.initMenu();
if (m_menu != null) {
m_menu.setGroupVisible(R.id.menu_group_feeds, false);
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
//OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && hf != null && hf.isAdded() && hf.isVisible());
m_menu.setGroupVisible(R.id.menu_group_headlines, !isPortrait() && !isSmallScreen());
Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);