public void onClick(View view) { if (view == backLayout) { this.finish(); } else if (view == noteForwardButton) { forwardNoteView(); } else if (view == noteCommentButton) { commentNoteView(); } else if (view == favoriteLayout) { if (noteDetail == null) return; FDNutritionMealWrapper studentWrapper = new FDNutritionMealWrapper(context); int favoriteEanble = noteDetail.getIsCollected() == 0 ? 1 : 0; studentWrapper.setStudentFavoriteNote( noteDetail.getContentId(), favoriteEanble, new FDCallback() { public void onCallback(Object callback) { if (callback == null) return; int status = (Integer) callback; if (status == 0) { FDViewUtil.showTaggleToast(context, noteDetail.getIsCollected(), "收藏"); loadFavoriteNoteDetail(); } } }); } }
/** 评论帖子 */ public void commentNoteView() { if (noteDetail == null) return; FDCommonComment noteComment = new FDCommonComment(); noteComment.setContentId(noteDetail.getContentId()); noteComment.setContentTitle(noteDetail.getContentTitle()); Intent intent = new Intent(this, FDCommonCommentNoteActivity.class); intent.putExtra("fd.common.comment.key", noteComment); startActivityForResult(intent, 100); }
/** * 微信朋友圈分享参数 * * <p>WechatMoment share params */ private WechatMoments.ShareParams getWechatMomentsShareParams() { if (noteDetail == null) return null; WechatMoments.ShareParams sp = new WechatMoments.ShareParams(); // 任何分享类型都需要title和text sp.title = noteDetail.getContentTitle(); sp.text = noteDetail.getContentTextData(); sp.shareType = Platform.SHARE_TEXT; return sp; }
/** 设置帖子详情 */ private void setFavoriteNoteDetailView() { if (noteDetail == null) return; noteDetailTitleView.setText(noteDetail.getContentTitle()); noteDetailContentView.setText(noteDetail.getContentTextData()); noteDetailNameView.setText(noteDetail.getCreateUsername()); noteDetailDateView.setText(noteDetail.getCreateDate()); if (noteDetail.getIsCollected() == 0) { noteDetaiFavoriteView.setImageResource(R.drawable.fd_restaurant_collection_disable); } else if (noteDetail.getIsCollected() == 1) { noteDetaiFavoriteView.setImageResource(R.drawable.fd_restaurant_collection_enable); } // noteForwardCountView.setText("转发("+noteDetail.getCollectCount()+")"); noteFavoriteCountView.setText("收藏(" + noteDetail.getCollectCount() + ")"); List<FDImage> noteDetailImages = noteDetail.getPicList(); if (noteDetailImages != null && noteDetailImages.size() > 0) { noteDetailImageView.setVisibility(View.VISIBLE); FDHorizontalListViewAdapter photoAdapter = new FDHorizontalListViewAdapter(this, noteDetailImages, false); noteDetailImageView.setAdapter(photoAdapter); } else { noteDetailImageView.setVisibility(View.GONE); } }