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: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 <LinearLayout
android:id="@+id/loading_container" android:id="@+id/loading_container"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -4,6 +4,13 @@
android:layout_height="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 <LinearLayout
android:id="@+id/loading_container" android:id="@+id/loading_container"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -4,6 +4,13 @@
android:layout_height="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 <LinearLayout
android:id="@+id/loading_container" android:id="@+id/loading_container"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -35,7 +35,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
GlobalState.getInstance().load(savedInstanceState); GlobalState.getInstance().load(savedInstanceState);
@ -140,9 +140,9 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
if (m_menu != null && getSessionId() != null) { if (m_menu != null && getSessionId() != null) {
m_menu.setGroupVisible(R.id.menu_group_feeds, false); 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); ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);

View File

@ -38,7 +38,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setSmallScreen(findViewById(R.id.headlines_fragment) == null); setSmallScreen(findViewById(R.id.sw600dp_anchor) == null);
if (isPortrait()) { if (isPortrait()) {
findViewById(R.id.headlines_fragment).setVisibility(View.GONE); findViewById(R.id.headlines_fragment).setVisibility(View.GONE);
@ -139,9 +139,9 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
if (m_menu != null) { if (m_menu != null) {
m_menu.setGroupVisible(R.id.menu_group_feeds, false); 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); Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);