コード例 #1
0
 @Override
 public void onReceiveUser(Intent intent) {
   CommUser newUser = getUser(intent);
   BroadcastUtils.BROADCAST_TYPE type = getType(intent);
   boolean follow = true;
   if (type == BroadcastUtils.BROADCAST_TYPE.TYPE_USER_FOLLOW) {
     follow = true;
   } else if (type == BroadcastUtils.BROADCAST_TYPE.TYPE_USER_CANCEL_FOLLOW) {
     follow = false;
   }
   if (mFansFragment != null) {
     mFansFragment.updateFansList(newUser.id, follow);
   }
 }
コード例 #2
0
 @Override
 public void onClick(View v) {
   int id = v.getId();
   if (id == ResFinder.getId("umeng_comm_posted_layout")) { // 已发消息
     if (mCurrentFragment instanceof PostedFeedsFragment) { // 已经处于当前页面,判断是否需要滚动到起始位置
       mPostedFragment.executeScrollToTop();
     } else {
       showFragment(mPostedFragment);
     }
   } else if (id == ResFinder.getId("umeng_comm_follow_user_layout")) { // 关注用户
     if (mFolloweredUserFragment == null) {
       mFolloweredUserFragment = FollowedUserFragment.newInstance(mUser.id);
       mFolloweredUserFragment.setOnAnimationResultListener(mListener);
       mFolloweredUserFragment.setOnResultListener(mFollowListener);
     }
     if (mCurrentFragment instanceof FollowedUserFragment
         && !(mCurrentFragment instanceof FansFragment)) {
       mFolloweredUserFragment.executeScrollTop();
     } else {
       showFragment(mFolloweredUserFragment);
     }
   } else if (id == ResFinder.getId("umeng_comm_my_fans_layout")) { // 我的粉丝
     if (mFansFragment == null) {
       mFansFragment = FansFragment.newFansFragment(mUser.id);
       mFansFragment.setOnAnimationResultListener(mListener);
       mFansFragment.setOnResultListener(mFansListener);
     }
     if (mCurrentFragment instanceof FansFragment) {
       mFansFragment.executeScrollTop();
     } else {
       showFragment(mFansFragment);
     }
   } else if (id == ResFinder.getId("umeng_comm_setting_back")) { // 返回
     this.finish();
   }
   changeSelectedText();
 }