add menu entry to refresh headlines in small screen mode
This commit is contained in:
parent
94b4aff15f
commit
b100fb6ec1
@ -39,6 +39,12 @@
|
||||
|
||||
<group android:id="@+id/menu_group_headlines" >
|
||||
|
||||
<item
|
||||
android:id="@+id/update_headlines"
|
||||
android:icon="@android:drawable/ic_menu_rotate"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/update_headlines"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/search"
|
||||
android:actionViewClass="android.widget.SearchView"
|
||||
|
@ -24,7 +24,7 @@
|
||||
<string name="loading_message">Loading, please wait…</string>
|
||||
<string name="menu_unread_feeds">Show unread feeds</string>
|
||||
<string name="menu_all_feeds">Show all feeds</string>
|
||||
<string name="update_feeds">Refresh feeds</string>
|
||||
<string name="update_feeds">Refresh</string>
|
||||
<string name="share_article">Share article</string>
|
||||
<string name="catchup">Mark read</string>
|
||||
<string name="sort_feeds_by_unread">Sort feeds by unread count</string>
|
||||
@ -128,4 +128,5 @@
|
||||
<string name="notify_article_published">Article published</string>
|
||||
<string name="notify_article_unpublished">Article unpublished</string>
|
||||
<string name="notify_article_note_set">Article note saved</string>
|
||||
<string name="update_headlines">Refresh</string>
|
||||
</resources>
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user