@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (drawerToggle != null && drawerToggle.onOptionsItemSelected(item)) return true;

    if (android.R.id.home == item.getItemId()) {
      if (mDrawerLayout.isDrawerVisible(GravityCompat.START)) mDrawerLayout.closeDrawers();
      else mDrawerLayout.openDrawer(GravityCompat.START);

      return true;
    }

    // 关于
    //        if (item.getItemId() == R.id.about)
    //            AboutWebFragment.launchAbout(this);
    // 意见反馈
    //        else if (item.getItemId() == R.id.feedback)
    //            PublishActivity.publishFeedback(this);
    // 退出
    if (item.getItemId() == R.id.exitapp) {
      finish();

      MobclickAgent.onEvent(this, "exitapp");
    }
    // 新微博
    else if (item.getItemId() == R.id.publish) PublishActivity.publishStatus(this, null);
    // 开始离线
    else if (item.getItemId() == R.id.toggle_offline) {
      OfflineUtils.toggleOffline(this);

      MobclickAgent.onEvent(this, "toggle_offline");
    }
    // 停止离线
    else if (item.getItemId() == R.id.stop_offline) {
      OfflineService.stopOffline();

      MobclickAgent.onEvent(this, "stop_offline");
    }
    // 通知设置
    else if (item.getItemId() == R.id.notification_settings)
      NotificationSettingsFragment.launch(this);
    // 搜索
    else if (item.getItemId() == R.id.search) {
      new IAction(
          MainActivity.this,
          new WebLoginAction(MainActivity.this, BizFragment.createBizFragment(this))) {

        @Override
        public void doAction() {
          SearchFragment.launch(MainActivity.this, "");

          MobclickAgent.onEvent(MainActivity.this, "toggle_search");
        }
      }.run();
    }

    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    menu.findItem(R.id.publish).setVisible(AppSettings.getFabBtnType() == 1);

    if (OfflineService.getInstance() == null
        || OfflineService.getInstance().getStatus() == OfflineService.OfflineStatus.init
        || OfflineService.getInstance().getStatus() == OfflineService.OfflineStatus.finished) {
      menu.findItem(R.id.toggle_offline).setVisible(true);
      menu.findItem(R.id.stop_offline).setVisible(false);
    } else {
      menu.findItem(R.id.toggle_offline).setVisible(false);
      menu.findItem(R.id.stop_offline).setVisible(true);
    }
    menu.findItem(R.id.notification_settings)
        .setVisible(menuFragment.getSelectedId() == MenuFragment.MENU_NOTIFICATION);

    return super.onPrepareOptionsMenu(menu);
  }