Updated method of setting menu items based on master

This commit is contained in:
Moez Bhatti
2015-10-18 22:56:53 -04:00
parent 0dac7dbcc0
commit 3555397c95
2 changed files with 7 additions and 9 deletions
@@ -263,8 +263,7 @@ public class MainActivity extends QKActivity implements SlidingMenu.OnOpenListen
if (mSlidingMenu.isMenuShowing() || mContent == null) { if (mSlidingMenu.isMenuShowing() || mContent == null) {
showBackButton(false); showBackButton(false);
setTitle(mConversationList.getTitleId()); mConversationList.inflateToolbar(menu, inflater, this);
inflater.inflate(R.menu.coversation_list, menu);
} else { } else {
showBackButton(true); showBackButton(true);
mContent.inflateToolbar(menu, inflater, this); mContent.inflateToolbar(menu, inflater, this);
@@ -2,6 +2,7 @@ package com.moez.QKSMS.ui.conversationlist;
import android.app.Fragment; import android.app.Fragment;
import android.app.LoaderManager; import android.app.LoaderManager;
import android.content.Context;
import android.content.CursorLoader; import android.content.CursorLoader;
import android.content.Loader; import android.content.Loader;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@@ -121,9 +122,9 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
return view; return view;
} }
@Override public void inflateToolbar(Menu menu, MenuInflater inflater, Context context) {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.coversation_list, menu);
super.onCreateOptionsMenu(menu, inflater); mContext.setTitle(mShowBlocked ? R.string.title_blocked : R.string.title_conversation_list);
// Make sure we're only touching the conversation menu // Make sure we're only touching the conversation menu
if (menu.findItem(R.id.menu_search) != null) { if (menu.findItem(R.id.menu_search) != null) {
@@ -142,6 +143,8 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
mBlockedItem = menu.findItem(R.id.menu_blocked); mBlockedItem = menu.findItem(R.id.menu_blocked);
BlockedConversationHelper.bindBlockedMenuItem(mContext, mPrefs, mBlockedItem, mShowBlocked); BlockedConversationHelper.bindBlockedMenuItem(mContext, mPrefs, mBlockedItem, mShowBlocked);
super.onCreateOptionsMenu(menu, inflater);
} }
@Override @Override
@@ -166,10 +169,6 @@ public class ConversationListFragment extends QKFragment implements LoaderManage
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
public int getTitleId() {
return mShowBlocked ? R.string.title_blocked : R.string.title_conversation_list;
}
public boolean isShowingBlocked() { public boolean isShowingBlocked() {
return mShowBlocked; return mShowBlocked;
} }