@Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (!mSlidingMenu.isMenuShowing()) { Fragment category = getFragmentManager().findFragmentByTag(SettingsFragment.CATEGORY_TAG); if (category != null) { getFragmentManager() .beginTransaction() .replace(R.id.content_frame, SettingsFragment.newInstance(R.xml.settings_main)) .commit(); } else { mSlidingMenu.showMenu(); } return true; } else { if (mConversationList.isShowingBlocked()) { mConversationList.setShowingBlocked(false); } else { finish(); } } } return false; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onKeyUp(KeyEvent.KEYCODE_BACK, null); break; case R.id.menu_settings: switchContent(SettingsFragment.newInstance(R.xml.settings_main), true); break; case R.id.menu_search: switchContent(new SearchFragment(), true); break; case R.id.menu_changelog: DialogHelper.showChangelog(this); break; case R.id.menu_donate: DonationManager.getInstance(this).showDonateDialog(); break; } return super.onOptionsItemSelected(item); }