From b100fb6ec1f64d1b88cb1309fffba179741cbe10 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 18 Sep 2012 13:16:03 +0400 Subject: [PATCH] add menu entry to refresh headlines in small screen mode --- res/menu/main_menu.xml | 6 ++++++ res/values/strings.xml | 3 ++- src/org/fox/ttrss/FeedsActivity.java | 25 +++++-------------------- src/org/fox/ttrss/OnlineActivity.java | 21 +++++++++++++++++++++ 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index da47144d..8ca15d3e 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -39,6 +39,12 @@ + + Loading, please wait… Show unread feeds Show all feeds - Refresh feeds + Refresh Share article Mark read Sort feeds by unread count @@ -128,4 +128,5 @@ Article published Article unpublished Article note saved + Refresh \ No newline at end of file diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 0d40da4a..86c3dfae 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -121,6 +121,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe 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.isAdded() && hf.getSelectedArticles().size() != 0); + m_menu.findItem(R.id.update_headlines).setVisible(hf != null && hf.isAdded()); + MenuItem item = m_menu.findItem(R.id.show_feeds); if (getUnreadOnly()) { @@ -191,26 +193,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe onCatSelected(cat, m_prefs.getBoolean("browse_cats_like_feeds", false)); } - private void refresh() { - FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS); - - if (cf != null) { - cf.refresh(false); - } - - FeedsFragment ff = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS); - - if (ff != null) { - ff.refresh(false); - } - - HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); - - if (hf != null) { - hf.refresh(false); - } - } - @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { @@ -222,6 +204,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe case R.id.update_feeds: refresh(); return true; + case R.id.update_headlines: + refresh(); + return true; default: Log.d(TAG, "onOptionsItemSelected, unhandled id=" + item.getItemId()); return super.onOptionsItemSelected(item); diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index 20871563..8ecb08de 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -1079,6 +1079,7 @@ public class OnlineActivity extends CommonActivity { m_menu.findItem(R.id.set_labels).setEnabled(m_apiLevel >= 1); m_menu.findItem(R.id.article_set_note).setEnabled(m_apiLevel >= 1); + m_menu.findItem(R.id.update_headlines).setVisible(false); MenuItem search = m_menu.findItem(R.id.search); search.setEnabled(m_apiLevel >= 2); @@ -1145,6 +1146,26 @@ public class OnlineActivity extends CommonActivity { } } + protected void refresh() { + FeedCategoriesFragment cf = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS); + + if (cf != null) { + cf.refresh(false); + } + + FeedsFragment ff = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS); + + if (ff != null) { + ff.refresh(false); + } + + HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); + + if (hf != null) { + hf.refresh(false); + } + } + private class LoginRequest extends ApiRequest { public LoginRequest(Context context) { super(context);