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;
}
m_activity.initMenu();
m_activity.invalidateOptionsMenu();
if (!m_activity.isCompatMode() && m_prefs.getBoolean("dim_status_bar", false)) {
getView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -113,7 +113,7 @@ public class OnlineActivity extends CommonActivity {
ArticleList selected = hf.getSelectedArticles();
if (selected.size() > 0) {
selected.clear();
initMenu();
invalidateOptionsMenu();
hf.notifyUpdated();
}
}
@ -908,7 +908,7 @@ public class OnlineActivity extends CommonActivity {
break;
}
dialog.cancel();
initMenu();
invalidateOptionsMenu();
}
});
@ -934,7 +934,7 @@ public class OnlineActivity extends CommonActivity {
ArticleList selected = hf.getSelectedArticles();
if (selected.size() > 0) {
selected.clear();
initMenu();
invalidateOptionsMenu();
hf.notifyUpdated();
}
}
@ -949,7 +949,7 @@ public class OnlineActivity extends CommonActivity {
toggleArticlesUnread(selected);
hf.notifyUpdated();
initMenu();
invalidateOptionsMenu();
}
}
return true;
@ -963,7 +963,7 @@ public class OnlineActivity extends CommonActivity {
toggleArticlesMarked(selected);
hf.notifyUpdated();
initMenu();
invalidateOptionsMenu();
}
}
return true;
@ -977,7 +977,7 @@ public class OnlineActivity extends CommonActivity {
toggleArticlesPublished(selected);
hf.notifyUpdated();
initMenu();
invalidateOptionsMenu();
}
}
return true;
@ -1008,7 +1008,7 @@ public class OnlineActivity extends CommonActivity {
if (tmp.size() > 0) {
toggleArticlesUnread(tmp);
hf.notifyUpdated();
initMenu();
invalidateOptionsMenu();
}
}
}
@ -1331,7 +1331,7 @@ public class OnlineActivity extends CommonActivity {
ApiRequest req = new ApiRequest(getApplicationContext()) {
protected void onPostExecute(JsonElement result) {
//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()) {
protected void onPostExecute(JsonElement result) {
//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);
initMenu();
invalidateOptionsMenu();
Intent intent = getIntent();
@ -389,7 +389,7 @@ public class OfflineActivity extends CommonActivity {
int which) {
selectArticles(ohf.getFeedId(), ohf.getFeedIsCat(), which);
initMenu();
invalidateOptionsMenu();
refresh();
dialog.cancel();
@ -788,7 +788,7 @@ public class OfflineActivity extends CommonActivity {
ohf.refresh();
}
initMenu();
invalidateOptionsMenu();
}
public void catchupFeed(int feedId, boolean isCat) {

View File

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

View File

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

View File

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