/** * 设置普通feed视图的可见性 * * @param viewHolder */ private void setCommFeedViewVisibility(FeedItem item) { // 修改转发视图的背景为透明 mForwardLayout.setBackgroundColor(Color.TRANSPARENT); // mForwardLayout.setVisibility(View.GONE); mForwardLayout.setPadding(0, 0, 0, 0); if (mImageGv != null) { mImageGv.setPadding(0, 0, 0, 0); } // 隐藏转发视图 mForwardTextTv.setVisibility(View.GONE); // 显示时间视图 mTimeTv.setVisibility(View.VISIBLE); // 昵称 mUserNameTv.setVisibility(View.VISIBLE); // 加载头像视图设置为可见 mProfileImgView.setVisibility(View.VISIBLE); }
/** * 设置用户相关的信息 </br> * * @param user */ public void setupUserInfo(CommUser user) { if (!user.id.equals(mUser.id)) { return; } mUser = user; mUserNameTv.setText(user.name); if (user.gender == Gender.MALE) { mGenderImageView.setImageDrawable(ResFinder.getDrawable("umeng_comm_gender_male")); } else if (user.gender == Gender.FEMALE) { mGenderImageView.setImageDrawable(ResFinder.getDrawable("umeng_comm_gender_female")); } ImgDisplayOption option = ImgDisplayOption.getOptionByGender(mUser.gender); // 设置用户头像 mHeaderImageView.setImageUrl(user.iconUrl, option); ImageLoaderManager.getInstance().getCurrentSDK().resume(); if (isHideFollowStatus()) { mFollowToggleButton.setVisibility(View.GONE); } else { mFollowToggleButton.setVisibility(View.VISIBLE); mFollowToggleButton.setChecked(mUser.isFollowed); } }
@SuppressWarnings("deprecation") private void initUIComponents() { // 设置Fragment addFragment(ResFinder.getId("umeng_comm_user_info_fragment_container"), mPostedFragment); // 选中的某个tab时的文字颜色 mSelectedColor = ResFinder.getColor("umeng_comm_text_topic_light_color"); // 初始化feed、好友、粉丝、back、设置的listener findViewById(ResFinder.getId("umeng_comm_posted_layout")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_follow_user_layout")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_my_fans_layout")).setOnClickListener(this); findViewById(ResFinder.getId("umeng_comm_setting_back")).setOnClickListener(this); // 举报用户的Dialog mReportDialog = new UserReportDialog(this); mReportDialog.setTargetUid(mUser.id); Button settingButton = (Button) findViewById(ResFinder.getId("umeng_comm_save_bt")); settingButton.setBackgroundDrawable(ResFinder.getDrawable("umeng_comm_more")); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) settingButton.getLayoutParams(); params.width = DeviceUtils.dp2px(this, 20); params.height = DeviceUtils.dp2px(this, 20); params.rightMargin = DeviceUtils.dp2px(getApplicationContext(), 10); settingButton.setLayoutParams(params); settingButton.setOnClickListener( new LoginOnViewClickListener() { @Override protected void doAfterLogin(View v) { mReportDialog.show(); } }); // 如果是用户自己,则不显示设置菜单按钮【目前菜单只有举报功能,即自己不能举报自己】 if (mUser.id.equals(CommConfig.getConfig().loginedUser.id) || mUser.permisson == Permisson.SUPPER_ADMIN) { settingButton.setVisibility(View.GONE); } TextView titleTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_setting_title")); titleTextView.setText(ResFinder.getString("umeng_comm_user_center")); // mPostedTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_posted_msg_tv")); mPostedTv.setTextColor(mSelectedColor); // mPostedCountTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_posted_count_tv")); mPostedCountTv.setTextColor(mSelectedColor); mFollowedUserTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_followed_user_tv")); mFollowedUserCountTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_follow_user_count_tv")); mFansTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_my_fans_tv")); mFansCountTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_fans_count_tv")); // 昵称 mUserNameTv = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_name_tv")); mUserNameTv.setText(mUser.name); mHeaderImageView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_header")); ImgDisplayOption option = ImgDisplayOption.getOptionByGender(mUser.gender); mHeaderImageView.setImageUrl(mUser.iconUrl, option); // 用户性别 mGenderImageView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_gender")); // 关注按钮 mFollowToggleButton = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_follow")); mFollowToggleButton.setOnClickListener( new Listeners.LoginOnViewClickListener() { @Override protected void doAfterLogin(View v) { mFollowToggleButton.setClickable(false); // true为选中状态为已关注,此时显示文本为“取消关注”;false代表未关注,此时显示文本为“关注” if (mFollowToggleButton.isChecked()) { mPresenter.followUser(mResultListener); } else { mPresenter.cancelFollowUser(mResultListener); } } }); mAlbumTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_albums_tv")); mAlbumTextView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { jumpToActivityWithUid(AlbumActivity.class); } }); mTopicTextView = mViewFinder.findViewById(ResFinder.getId("umeng_comm_user_topic_tv")); mTopicTextView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { jumpToActivityWithUid(FollowedTopicActivity.class); } }); // 用户自己(在未登录的情况下,点击设置跳转到登录,此时传递进来的uid是空的情况),隐藏关注按钮,显示设置按钮 // // 如果是超级管理员且已经关注,则隐藏取消关注按钮 if (isHideFollowStatus()) { mFollowToggleButton.setVisibility(View.GONE); } initCommentView(); }