replace manual initmenu calls with invalidateoptionsmenu now that it is available pre-HC

This commit is contained in:
Andrew Dolgov 2014-11-04 17:50:14 +03:00
parent baa45f6455
commit 56e0d4bf65
11 changed files with 29 additions and 35 deletions

View File

@ -279,7 +279,7 @@ public class ArticlePager extends Fragment {
GlobalState.getInstance().m_activeFeed = m_feed; GlobalState.getInstance().m_activeFeed = m_feed;
} }
m_activity.initMenu(); m_activity.invalidateOptionsMenu();
if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) { if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) {
getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

View File

@ -257,7 +257,7 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
refresh(false); refresh(false);
m_activity.initMenu(); m_activity.invalidateOptionsMenu();
} }
@Override @Override

View File

@ -353,7 +353,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
return true; return true;
case R.id.show_feeds: case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly()); setUnreadOnly(!getUnreadOnly());
initMenu(); invalidateOptionsMenu();
refresh(); refresh();
return true; return true;
case R.id.update_feeds: case R.id.update_feeds:
@ -373,7 +373,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override @Override
protected void loginSuccess(boolean refresh) { protected void loginSuccess(boolean refresh) {
initMenu(); invalidateOptionsMenu();
if (refresh) refresh(); if (refresh) refresh();
} }
@ -390,12 +390,12 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
initMenu(); invalidateOptionsMenu();
} }
@Override @Override
public void onArticleListSelectionChange(ArticleList m_selectedArticles) { public void onArticleListSelectionChange(ArticleList m_selectedArticles) {
initMenu(); invalidateOptionsMenu();
} }
public void openFeedArticles(Feed feed) { public void openFeedArticles(Feed feed) {
@ -428,7 +428,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
overridePendingTransition(R.anim.right_slide_in, 0); overridePendingTransition(R.anim.right_slide_in, 0);
} else { } else {
initMenu(); invalidateOptionsMenu();
} }
} }

View File

@ -350,7 +350,7 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
refresh(false); refresh(false);
m_activity.initMenu(); m_activity.invalidateOptionsMenu();
} }
@Override @Override

View File

@ -151,7 +151,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
protected void loginSuccess(boolean refresh) { protected void loginSuccess(boolean refresh) {
Log.d(TAG, "loginSuccess"); Log.d(TAG, "loginSuccess");
initMenu(); invalidateOptionsMenu();
if (refresh) refresh(); if (refresh) refresh();
} }
@ -221,7 +221,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
@Override @Override
public void onArticleListSelectionChange(ArticleList m_selectedArticles) { public void onArticleListSelectionChange(ArticleList m_selectedArticles) {
initMenu(); invalidateOptionsMenu();
} }
@Override @Override
@ -267,7 +267,7 @@ public class HeadlinesActivity extends OnlineActivity implements HeadlinesEventL
GlobalState.getInstance().m_activeArticle = article; GlobalState.getInstance().m_activeArticle = article;
initMenu(); invalidateOptionsMenu();
} }

View File

@ -377,7 +377,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
notifyUpdated(); notifyUpdated();
} }
m_activity.initMenu(); m_activity.invalidateOptionsMenu();
} }
@Override @Override

View File

@ -113,7 +113,7 @@ public class OnlineActivity extends CommonActivity {
ArticleList selected = hf.getSelectedArticles(); ArticleList selected = hf.getSelectedArticles();
if (selected.size() > 0) { if (selected.size() > 0) {
selected.clear(); selected.clear();
initMenu(); invalidateOptionsMenu();
hf.notifyUpdated(); hf.notifyUpdated();
} }
} }
@ -908,7 +908,7 @@ public class OnlineActivity extends CommonActivity {
break; break;
} }
dialog.cancel(); dialog.cancel();
initMenu(); invalidateOptionsMenu();
} }
}); });
@ -934,7 +934,7 @@ public class OnlineActivity extends CommonActivity {
ArticleList selected = hf.getSelectedArticles(); ArticleList selected = hf.getSelectedArticles();
if (selected.size() > 0) { if (selected.size() > 0) {
selected.clear(); selected.clear();
initMenu(); invalidateOptionsMenu();
hf.notifyUpdated(); hf.notifyUpdated();
} }
} }
@ -949,7 +949,7 @@ public class OnlineActivity extends CommonActivity {
toggleArticlesUnread(selected); toggleArticlesUnread(selected);
hf.notifyUpdated(); hf.notifyUpdated();
initMenu(); invalidateOptionsMenu();
} }
} }
return true; return true;
@ -963,7 +963,7 @@ public class OnlineActivity extends CommonActivity {
toggleArticlesMarked(selected); toggleArticlesMarked(selected);
hf.notifyUpdated(); hf.notifyUpdated();
initMenu(); invalidateOptionsMenu();
} }
} }
return true; return true;
@ -977,7 +977,7 @@ public class OnlineActivity extends CommonActivity {
toggleArticlesPublished(selected); toggleArticlesPublished(selected);
hf.notifyUpdated(); hf.notifyUpdated();
initMenu(); invalidateOptionsMenu();
} }
} }
return true; return true;
@ -1008,7 +1008,7 @@ public class OnlineActivity extends CommonActivity {
if (tmp.size() > 0) { if (tmp.size() > 0) {
toggleArticlesUnread(tmp); toggleArticlesUnread(tmp);
hf.notifyUpdated(); hf.notifyUpdated();
initMenu(); invalidateOptionsMenu();
} }
} }
} }
@ -1331,7 +1331,7 @@ public class OnlineActivity extends CommonActivity {
ApiRequest req = new ApiRequest(getApplicationContext()) { ApiRequest req = new ApiRequest(getApplicationContext()) {
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
//toast(article.marked ? R.string.notify_article_marked : R.string.notify_article_unmarked); //toast(article.marked ? R.string.notify_article_marked : R.string.notify_article_unmarked);
initMenu(); invalidateOptionsMenu();
} }
}; };
@ -1354,7 +1354,7 @@ public class OnlineActivity extends CommonActivity {
ApiRequest req = new ApiRequest(getApplicationContext()) { ApiRequest req = new ApiRequest(getApplicationContext()) {
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
//toast(article.published ? R.string.notify_article_published : R.string.notify_article_unpublished); //toast(article.published ? R.string.notify_article_published : R.string.notify_article_unpublished);
initMenu(); invalidateOptionsMenu();
} }
}; };

View File

@ -171,7 +171,7 @@ public class OfflineActivity extends CommonActivity {
setContentView(R.layout.login); setContentView(R.layout.login);
initMenu(); invalidateOptionsMenu();
Intent intent = getIntent(); Intent intent = getIntent();
@ -389,7 +389,7 @@ public class OfflineActivity extends CommonActivity {
int which) { int which) {
selectArticles(ohf.getFeedId(), ohf.getFeedIsCat(), which); selectArticles(ohf.getFeedId(), ohf.getFeedIsCat(), which);
initMenu(); invalidateOptionsMenu();
refresh(); refresh();
dialog.cancel(); dialog.cancel();
@ -788,7 +788,7 @@ public class OfflineActivity extends CommonActivity {
ohf.refresh(); ohf.refresh();
} }
initMenu(); invalidateOptionsMenu();
} }
public void catchupFeed(int feedId, boolean isCat) { public void catchupFeed(int feedId, boolean isCat) {

View File

@ -104,8 +104,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.commit(); ft.commit();
} }
initMenu();
} }
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
@ -184,7 +182,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
return true; return true;
case R.id.show_feeds: case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly()); setUnreadOnly(!getUnreadOnly());
initMenu(); invalidateOptionsMenu();
refresh(); refresh();
return true; return true;
default: default:
@ -323,7 +321,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
stmt.close(); stmt.close();
} }
initMenu(); invalidateOptionsMenu();
if (open) { if (open) {
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
@ -341,8 +339,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
refresh(); refresh();
} }
initMenu();
} }
@Override @Override

View File

@ -116,8 +116,6 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
} }
} }
initMenu();
} }
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
@ -172,7 +170,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
GlobalState.getInstance().m_selectedArticleId = articleId; GlobalState.getInstance().m_selectedArticleId = articleId;
initMenu(); invalidateOptionsMenu();
refresh(); refresh();
} }

View File

@ -245,7 +245,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
refresh(); refresh();
m_activity.initMenu(); m_activity.invalidateOptionsMenu();
} }
public void refresh() { public void refresh() {
@ -658,7 +658,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
refresh(); refresh();
m_activity.initMenu(); m_activity.invalidateOptionsMenu();
} }
}); });