/** * 设置转发的数据 * * @param viewHolder 视图Holder * @param item 转发的feed item */ private void setForwardItemData(FeedItem item) { // @原始feed的创建者 atOriginFeedCreator(item.sourceFeed); // 大于等于2表示该feed已经被删除 if (item.sourceFeed.status >= FeedItem.STATUS_SPAM || isDeleted(item.sourceFeed)) { mForwardTextTv.setGravity(Gravity.CENTER); mForwardTextTv.setText(ResFinder.getString("umeng_comm_feed_deleted")); if (mImageGv != null) { mImageGv.setVisibility(View.GONE); } // 如果该feed是收藏,且转发feed、原feed都被删除,则不显示原feed的状态 if (item.status >= FeedItem.STATUS_SPAM && item.sourceFeed.status >= FeedItem.STATUS_SPAM) { mForwardLayout.setVisibility(View.GONE); } else { // 删除被转发的feed deleteInvalidateFeed(item.sourceFeed); } } else { mForwardTextTv.setGravity(Gravity.LEFT | Gravity.CENTER); // 解析被转发的@和话题 FeedViewRender.parseTopicsAndFriends(mForwardTextTv, item.sourceFeed); if (mImageGv != null) { mImageGv.setVisibility(View.VISIBLE); } } }
/** 设置转发feed的视图的可见性 */ private void setForwardViewVisibility(FeedItem item) { // 显示转发视图 mForwardLayout.setVisibility(View.VISIBLE); mForwardLayout.setPadding(10, 10, 10, 10); mForwardLayout.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { mPresenter.clickOriginFeedItem(mFeedItem); } }); if (mImageGv != null) { mImageGv.setPadding(10, 2, 10, 10); } // 转发视图的背景 mForwardLayout.setBackgroundDrawable(ResFinder.getDrawable("umeng_comm_forward_bg")); // 被转发的文本 mForwardTextTv.setVisibility(View.VISIBLE); mForwardTextTv.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { mPresenter.clickOriginFeedItem(mFeedItem); } }); // 隐藏位置图标 mLocationImgView.setVisibility(View.GONE); mLocationTv.setVisibility(View.GONE); }
public void showImageGridView() { // 显示转发的布局 mForwardLayout.setVisibility(View.VISIBLE); if (mImageGvViewStub.getVisibility() == View.GONE) { mImageGvViewStub.setVisibility(View.VISIBLE); // gridview布局umeng_comm_images_gc.xml int imageGvResId = ResFinder.getId("umeng_comm_msg_gridview"); mImageGv = (WrapperGridView) this.findViewById(imageGvResId); mImageGv.hasScrollBar = true; } mImageGv.setBackgroundColor(Color.TRANSPARENT); mImageGv.setVisibility(View.VISIBLE); // adapter FeedImageAdapter gridviewAdapter = new FeedImageAdapter(mContext); gridviewAdapter.addDatasOnly(mFeedItem.getImages()); // 设置图片 mImageGv.setAdapter(gridviewAdapter); // 计算列数 mImageGv.updateColumns(3); // 图片GridView mImageGv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { mPresenter.jumpToImageBrowser(mFeedItem.getImages(), pos); } }); }
/** * 设置普通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); }
private void hideImageGridView() { if (mImageGv != null) { mImageGv.setAdapter(new FeedImageAdapter(mContext)); mImageGv.setVisibility(View.GONE); } }