@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = (QKActivity) getActivity(); setHasOptionsMenu(true); mAdapter = new ConversationListAdapter(mContext); mAdapter.setItemClickListener(this); mAdapter.setMultiSelectListener(this); mLayoutManager = new LinearLayoutManager(mContext); mConversationDetailsDialog = new ConversationDetailsDialog(mContext, getFragmentManager()); LiveViewManager.registerView(this); LiveViewManager.registerPreference(this, SettingsFragment.THEME); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Make sure we're only touching the conversation menu if (menu.findItem(R.id.menu_search) != null) { if (mAdapter.isInMultiSelectMode()) { menu.findItem(R.id.menu_search).setVisible(false); menu.findItem(R.id.menu_delete).setVisible(true); menu.findItem(R.id.menu_mark_read).setVisible(true); } else { menu.findItem(R.id.menu_search).setVisible(true); menu.findItem(R.id.menu_delete).setVisible(false); menu.findItem(R.id.menu_mark_read).setVisible(false); } } else { mAdapter.disableMultiSelectMode(false); } }
@Override public void onDestroy() { super.onDestroy(); LiveViewManager.unregisterView(this); }