diff options
| author | lpetrus <ladislav.petrus@rt.sk> | 2012-09-02 15:10:57 +0200 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2012-09-02 19:14:16 +0400 |
| commit | 416d155e85ec4fbc2562c804beec7a70a06f72e7 (patch) | |
| tree | 0e60e05057b07cfed2847b835d2dd8257946be46 /src/org/fox/ttrss/MainActivity.java | |
| parent | d5c0f015e589aa612582eaef55b47666da1e4330 (diff) | |
Small tablet support (< 8")
* Portrait mode
** feed list is now smaller and article list is bigger
* Landscape mode
** small tablets display always only two columns
Diffstat (limited to 'src/org/fox/ttrss/MainActivity.java')
| -rw-r--r-- | src/org/fox/ttrss/MainActivity.java | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index ce49b77a..4a4c3eee 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -645,6 +645,8 @@ public class MainActivity extends CommonActivity implements OnlineServices { setContentView(R.layout.main); setSmallScreen(findViewById(R.id.headlines_fragment) == null); + + setupSmallTabletFlag(); IntentFilter filter = new IntentFilter(); filter.addAction(OfflineDownloadService.INTENT_ACTION_SUCCESS); @@ -662,7 +664,7 @@ public class MainActivity extends CommonActivity implements OnlineServices { if (!isCompatMode()) { if (!isSmallScreen()) { - findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null && isPortrait() ? View.GONE : View.VISIBLE); + findViewById(R.id.feeds_fragment).setVisibility(m_selectedArticle != null && (isPortrait() || isSmallTablet()) ? View.GONE : View.VISIBLE); findViewById(R.id.article_fragment).setVisibility(m_selectedArticle != null ? View.VISIBLE : View.GONE); } @@ -998,8 +1000,8 @@ public class MainActivity extends CommonActivity implements OnlineServices { if (m_selectedArticle != null) { closeArticle(); refresh(); - /* } else if (m_activeFeed != null) { - closeFeed(); */ + } else if (m_activeFeed != null) { + closeFeed(); } else if (m_activeCategory != null) { closeCategory(); } else if (allowQuit) { @@ -1008,6 +1010,28 @@ public class MainActivity extends CommonActivity implements OnlineServices { } } + + private void closeFeed() { + if (m_activeFeed != null) { + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); + ft.replace(R.id.headlines_fragment, new DummyFragment(), ""); + ft.commit(); + + if (m_activeFeed.is_cat) { + FeedCategoriesFragment cats = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS); + cats.setSelectedCategory(null); + } else { + FeedsFragment feeds = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS); + feeds.setSelectedFeed(null); + } + + m_activeFeed = null; + + initMainMenu(); + } + } + + @SuppressWarnings("unchecked") @Override public boolean onOptionsItemSelected(MenuItem item) { @@ -1864,7 +1888,7 @@ public class MainActivity extends CommonActivity implements OnlineServices { ft.hide(getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES)); ft.add(R.id.fragment_container, frag, FRAG_ARTICLE); } else { - findViewById(R.id.feeds_fragment).setVisibility(isPortrait() ? View.GONE : View.VISIBLE); + findViewById(R.id.feeds_fragment).setVisibility(isPortrait() || isSmallTablet() ? View.GONE : View.VISIBLE); findViewById(R.id.article_fragment).setVisibility(View.VISIBLE); ft.replace(R.id.article_fragment, frag, FRAG_ARTICLE); |