Exemple #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle != null && mDrawerToggle.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);
    // 好友分组
    else if (item.getItemId() == R.id.friendGroups) GroupSortFragment.lanuch(this);
    // 搜索用户或者微博
    //        else if (item.getItemId() == R.id.search)
    //            SearchActivity.launch(this);
    // 退出
    else if (item.getItemId() == R.id.exitapp) finish();
    // 新微博
    else if (item.getItemId() == R.id.publish) PublishActivity.publishStatus(this, null);
    // 搜人
    else if (item.getItemId() == R.id.search_user) SearchUserFragment.launch(this);
    // 搜微博
    else if (item.getItemId() == R.id.search_status) SearchTopicsFragment.launch(this);
    // 开始离线
    else if (item.getItemId() == R.id.toggle_offline) OfflineUtils.toggleOffline(this);

    return super.onOptionsItemSelected(item);
  }
Exemple #2
0
 public static void onMenuClicked(ABaseFragment fragment, int menuId, StatusContent status) {
   switch (menuId) {
     case R.id.comment:
       BizFragment.getBizFragment(fragment).commentCreate(status);
       break;
     case R.id.repost:
       BizFragment.getBizFragment(fragment).statusRepost(status);
       break;
     case R.id.fav:
       BizFragment.getBizFragment(fragment).favorityCreate(status.getId() + "", null);
       break;
     case R.id.fav_destory:
       BizFragment.getBizFragment(fragment).favorityDestory(status.getId() + "", null);
       break;
     case R.id.copy:
       copyToClipboard(status.getText());
       ViewUtils.showMessage(R.string.msg_text_copyed);
       break;
     case R.id.delete:
       deleteStatus(fragment, status);
       break;
     case R.id.weiguan:
       PublishActivity.publishStatusRepostAndWeiguan(fragment.getActivity(), null, status);
       break;
     case R.id.share:
       break;
   }
 }
Exemple #3
0
  public static void timelineMenuSelected(
      final ABaseFragment fragment, String selectedItem, final StatusContent status) {
    final String[] timelineMenuArr =
        GlobalContext.getInstance().getResources().getStringArray(R.array.timeline_menus);

    try {
      int position = 0;
      for (int i = 0; i < timelineMenuArr.length; i++) {
        if (timelineMenuArr[i].equals(selectedItem)) {
          position = i;
          break;
        }
      }

      switch (position) {
          // 原微博
        case 0:
          TimelineCommentFragment.launch(fragment.getActivity(), status.getRetweeted_status());
          break;
          // 复制
        case 1:
          AisenUtils.copyToClipboard(status.getText());

          ViewUtils.showMessage(R.string.msg_text_copyed);
          break;
          // 转发
        case 2:
          BizFragment.getBizFragment(fragment).statusRepost(status);
          break;
          // 评论
        case 3:
          BizFragment.getBizFragment(fragment).commentCreate(status);
          break;
          // 收藏
        case 4:
          BizFragment.getBizFragment(fragment).favorityCreate(status.getId() + "", null);
          break;
          // 取消收藏
        case 5:
          BizFragment.getBizFragment(fragment).favorityDestory(status.getId() + "", null);
          break;
          // 删除微博
        case 6:
          deleteStatus(fragment, status);
          break;
          // 屏蔽微博
        case 7:
          shieldStatus(fragment, status);
          break;
          // 围观
        case 8:
          PublishActivity.publishStatusRepostAndWeiguan(fragment.getActivity(), null, status);
          break;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  @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);
  }
Exemple #5
0
 void fabBtnCLicked(View v) {
   if (AppSettings.getFabBtnType() == 0) {
     PublishActivity.publishStatus(this, null);
   } else {
     Fragment fragment = getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
     if (fragment != null && fragment instanceof AStripTabsFragment) {
       fragment = ((AStripTabsFragment) fragment).getCurrentFragment();
       if (fragment != null && fragment instanceof ARefreshFragment) {
         ((ARefreshFragment) fragment).setRefreshingRequestData();
       }
     }
   }
 }