public void setPreviews(PostElement holder, Post post) { holder.previews.setVisibility(View.GONE); for (int i = 0; i < holder.preview.length; i++) { holder.preview[i].setVisibility(View.GONE); } for (int i = 0; (i < post.getAttachFiles().size()) && (i < holder.preview.length); i++) { holder.previews.setVisibility(View.VISIBLE); holder.preview[i].setVisibility(View.VISIBLE); holder.preview[i].setTag(i + ""); imageLoader.DisplayImage( (Activity) context, ImageLoader.UrlType.ATTACH_FILE, ImageLoader.ImageSize.SMALL, holder.preview[i], post.getAttachFiles().get(i).getId()); } }
private void setOnClickListener() { if (post != null) { GotoUserMainAction action1 = new GotoUserMainAction(getContext(), post.getUser()); GotoStoreMainAction action2 = new GotoStoreMainAction(getContext(), post.getStore()); GotoImageSliderAction action3 = new GotoImageSliderAction(getContext(), post.getAttachFiles()); holder.profile.setOnClickListener(action1); holder.nickText.setOnClickListener(action1); holder.storeNameText.setOnClickListener(action2); holder.likeCountText.setOnClickListener(new LikeUserListListener(getContext(), post)); holder.menu.setOnClickListener(new PostHeaderQuickActionDialog()); holder.menu.setTag(holder.menu); for (int i = 0; i < previewWrapperIds.length; i++) { holder.preview[i].setOnClickListener(action3); } } }
/** * Delete 요청 * * @param post Delete할 이야기 */ public void deleteRequest(Post post) { // Alert 창 띄우기. if (!manager.isRunning()) { if (request == null || !(request instanceof PostHttpRequest)) { request = new PostHttpRequest(context); } ((PostHttpRequest) request).actionDelete(post.getId()); manager.request( context, spinnerContainer, request, HttpRequestManager.POST_DELETE_REQUEST, this); } }
private void setViewData() { setPreviews(holder, post); Store store = post.getStore(); User user = post.getUser(); if (store != null) { holder.nickText.setMaxWidth(MatjiConstants.dimenInt(R.dimen.default_nick_max_width_half)); holder.atText.setVisibility(View.VISIBLE); holder.storeNameText.setText(" " + store.getName()); } else { holder.nickText.setMaxWidth(9999); holder.atText.setVisibility(View.GONE); holder.storeNameText.setText(""); } ArrayList<SimpleTag> tags = post.getTags(); String tagResult = ""; if (tags.size() > 0) { tagResult += tags.get(0).getTag(); for (int i = 1; i < tags.size(); i++) { tagResult += ", " + tags.get(i).getTag(); } holder.tagText.setText(tagResult); holder.tagText.setVisibility(View.VISIBLE); } else { holder.tagText.setVisibility(View.GONE); } holder.profile.setUserId(user.getId()); holder.nickText.setText(user.getNick() + " "); holder.postText.setText(post.getPost().trim()); holder.dateAgoText.setText(TimeUtil.getAgoFromSecond(post.getAgo())); holder.commentCountText.setText(post.getCommentCount() + ""); holder.likeCountText.setText(post.getLikeCount() + ""); if (session.isLogin() && session.isCurrentUser(post.getUser())) { holder.menu.setVisibility(View.VISIBLE); } else { holder.menu.setVisibility(View.GONE); } }
/** * 파라미터로 전달받은 {@link Post}가 현재 로그인 된 {@link User}의 {@link Post}인지 확인한다. * * @param post 확인 할 {@link Post} * @return 전달받은 {@link Post}가 로그인 된 {@link User}의 {@link Post}일 때 true */ public boolean isMine(Post post) { return session.isLogin() && session.getCurrentUser().getId() == post.getUserId(); }