/** * 设置转发的数据 * * @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); } } }
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); } }); }
private void hideImageGridView() { if (mImageGv != null) { mImageGv.setAdapter(new FeedImageAdapter(mContext)); mImageGv.setVisibility(View.GONE); } }