@Override
  public boolean onActionItemClicked(ActionMode mode, MenuItem item) {

    switch (item.getItemId()) {
      case R.id.menu_at:
        Intent intent = new Intent(getActivity(), WriteWeiboActivity.class);
        intent.putExtra("token", GlobalContext.getInstance().getSpecialToken());
        intent.putExtra("content", "@" + bean.getScreen_name());
        intent.putExtra("account", GlobalContext.getInstance().getAccountBean());
        getActivity().startActivity(intent);
        listView.clearChoices();
        mode.finish();
        break;
      case R.id.menu_follow:
        if (followOrUnfollowTask == null
            || followOrUnfollowTask.getStatus() == MyAsyncTask.Status.FINISHED) {
          followOrUnfollowTask = new FollowTask();
          followOrUnfollowTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        }
        listView.clearChoices();
        mode.finish();
        break;
      case R.id.menu_unfollow:
        if (followOrUnfollowTask == null
            || followOrUnfollowTask.getStatus() == MyAsyncTask.Status.FINISHED) {
          followOrUnfollowTask = new UnFollowTask();
          followOrUnfollowTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
        }
        listView.clearChoices();
        mode.finish();
        break;
    }

    return true;
  }
Exemplo n.º 2
0
    @Override
    protected UserBean doInBackground(Object... params) {
      if (!isCancelled()) {
        ShowUserDao dao = new ShowUserDao(GlobalContext.getInstance().getSpecialToken());
        boolean haveId = !TextUtils.isEmpty(bean.getId());
        boolean haveName = !TextUtils.isEmpty(bean.getScreen_name());
        if (haveId) {
          dao.setUid(bean.getId());
        } else if (haveName) {
          dao.setScreen_name(bean.getScreen_name());
        } else {
          cancel(true);
          return null;
        }

        UserBean user = null;
        try {
          user = dao.getUserInfo();
        } catch (WeiboException e) {
          this.e = e;
          cancel(true);
        }
        if (user != null) {
          bean = user;
        } else {
          cancel(true);
        }
        return user;
      } else {
        return null;
      }
    }
Exemplo n.º 3
0
 @Override
 protected ArrayList<String> doInBackground(Void... params) {
   UserTopicListDao dao =
       new UserTopicListDao(GlobalContext.getInstance().getSpecialToken(), bean.getId());
   try {
     return dao.getGSONMsgList();
   } catch (WeiboException e) {
     this.e = e;
     cancel(true);
     return null;
   }
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.actionbar_menu_browserweibomsgactivity, menu);

    if (msg.getUser() != null
        && msg.getUser().getId().equals(GlobalContext.getInstance().getCurrentAccountId())) {
      menu.findItem(R.id.menu_delete).setVisible(true);
    }

    MenuItem item = menu.findItem(R.id.menu_share);
    mShareActionProvider = (ShareActionProvider) item.getActionProvider();
    buildShareActionMenu();
    return super.onCreateOptionsMenu(menu);
  }
    @Override
    protected UserBean doInBackground(Void... params) {

      FriendshipsDao dao = new FriendshipsDao(GlobalContext.getInstance().getSpecialToken());
      if (!TextUtils.isEmpty(bean.getId())) {
        dao.setUid(bean.getId());
      } else {
        dao.setScreen_name(bean.getScreen_name());
      }
      try {
        return dao.followIt();
      } catch (WeiboException e) {
        AppLogger.e(e.getError());
        this.e = e;
        cancel(true);
        return null;
      }
    }