コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(ResFinder.getLayout("umeng_comm_user_info_layout"));
    mUser = getIntent().getExtras().getParcelable(Constants.TAG_USER);
    if (mUser == null) {
      return;
    }
    mPresenter = new UserInfoPresenter(this, this, mUser);

    mPostedFragment = PostedFeedsFragment.newInstance(mUser);
    mPostedFragment.setOnAnimationResultListener(mListener);
    // 视图查找器
    mViewFinder = new ViewFinder(getWindow().getDecorView());

    mPostedFragment.setCurrentUser(mUser);
    mPostedFragment.setOnDeleteListener(
        new OnDeleteListener() {

          @Override
          public void onDelete(BaseBean item) {
            mPresenter.decreaseFeedCount(1);
          }
        });
    // 初始化UI
    initUIComponents();
    mPresenter.onCreate(savedInstanceState);
    // 设置用户信息View的显示内容
    setupUserInfo(mUser);
    initHeaderView();
    BroadcastUtils.registerFeedBroadcast(getApplicationContext(), mReceiver);
    BroadcastUtils.registerUserBroadcast(getApplicationContext(), mReceiver);
  }
コード例 #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();
 }