@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); }
@Override public void onResult(final int status) { if (mPresenter.isUpdateFansCountTextView()) { CommonUtils.runOnUIThread( UserInfoActivity.this, new Runnable() { @Override public void run() { mFansCountTextView.setText(String.valueOf(status)); } }); } }
@Override protected void onDestroy() { mPresenter.onDestroy(); BroadcastUtils.unRegisterBroadcast(getApplicationContext(), mReceiver); super.onDestroy(); }