diff --git a/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java b/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java index 3ca722c6f..465885796 100644 --- a/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/UserCommunityAdapter.java @@ -30,14 +30,16 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { private List commentBeanList; private Context mContext; private onItemClickListener onItemClickListener; + private boolean isMe; public void setOnItemClickListener(UserCommunityAdapter.onItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; } - public UserCommunityAdapter(Context content, List commentBeanList) { + public UserCommunityAdapter(Context content, List commentBeanList, boolean isMe) { this.mContext = content; this.commentBeanList = commentBeanList; + this.isMe = isMe; } @NonNull @@ -69,6 +71,7 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { private TextView likeCount; private TextView comCount; private TextView shareCount; + private ImageView more_del; public CommentViewHolder(@NonNull View itemView) { super(itemView); @@ -82,11 +85,21 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { likeCount = itemView.findViewById(R.id.likeCount); comCount = itemView.findViewById(R.id.comCount); shareCount = itemView.findViewById(R.id.shareCount); - + more_del = itemView.findViewById(R.id.more_del); + more_del.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (onItemClickListener != null) { + onItemClickListener.onItemMore((ActiveOtherBean) v.getTag(), getPosition()); + } + } + }); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - onItemClickListener.onImgItem((ActiveOtherBean) v.getTag(), getPosition()); + if (onItemClickListener != null) { + onItemClickListener.onImgItem((ActiveOtherBean) v.getTag(), getPosition()); + } } }); } @@ -95,6 +108,10 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { public void setData(ActiveOtherBean bean) { itemView.setTag(bean); mAvatar.setTag(bean); + more_del.setTag(bean); + if (isMe) { + more_del.setVisibility(View.VISIBLE); + } ImgLoader.display(mContext, bean.getUser_avatar(), mAvatar); userName.setText(bean.getUser_name()); time.setText(bean.getCreate_time()); @@ -146,6 +163,6 @@ public class UserCommunityAdapter extends RecyclerView.Adapter { public interface onItemClickListener { void onImgItem(ActiveOtherBean activeBean, int position); - void onVideoItem(String activeBean, int position); + void onItemMore(ActiveOtherBean activeBean, int position); } } diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 41fd80336..a20832448 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -606,7 +606,7 @@ public class CommonHttpUtil { } /** - * 动态-删除 + * 动态-评论-删除 */ public static void delCom(String comment_id, HttpCallback callback) { HttpClient.getInstance().get("Pdlcommunity.delComment", "Pdlcommunity.delComment") @@ -651,6 +651,15 @@ public class CommonHttpUtil { .params("home_banner_url_ary", imgs) .execute(callback); } + + /** + * 动态-删除 + */ + public static void delActive(String dynamic_id, HttpCallback callback) { + HttpClient.getInstance().get("Pdlcommunity.delDynamic", "Pdlcommunity.delDynamic") + .params("dynamic_id", dynamic_id) + .execute(callback); + } } diff --git a/common/src/main/res/layout/activity_user_community_item.xml b/common/src/main/res/layout/activity_user_community_item.xml index 7a9ec2837..330a6eed8 100644 --- a/common/src/main/res/layout/activity_user_community_item.xml +++ b/common/src/main/res/layout/activity_user_community_item.xml @@ -49,6 +49,14 @@ + + See more close Time cannot be greater than the current time + Do you confirm deletion? \ No newline at end of file diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index f9997b3ba..9c66b8c6b 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1493,4 +1493,5 @@ 查看更多 收起 时间不能大于当前时间 + 是否確認刪除? diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 200bff418..f3c973a42 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1493,4 +1493,5 @@ 查看更多 收起 时间不能大于当前时间 + 是否確認刪除? diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 2d15a99f7..c65241125 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1491,4 +1491,5 @@ 查看更多 收起 时间不能大于当前时间 + 是否確認刪除? diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 94d835b22..75ba5ab5a 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1513,6 +1513,7 @@ Limited ride And limited avatar frame 查看更多 收起 时间不能大于当前时间 + 是否確認刪除? diff --git a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java index 432696150..b62aafbdb 100644 --- a/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/UserHomeActivity.java @@ -141,6 +141,7 @@ public class UserHomeActivity extends AbsActivity { private LinearLayout bottomEditLayout; private UploadQnImpl mUploadStrategy; private List videoList = new ArrayList<>(); + List beanList = new ArrayList<>(); private UserHomeImgsViewHolder userHomeImgsViewHolder; @@ -171,27 +172,40 @@ public class UserHomeActivity extends AbsActivity { CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - List beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class); - UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList); + beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class); + UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList,isMe); userCommunityAdapter.setOnItemClickListener(new UserCommunityAdapter.onItemClickListener() { @Override public void onImgItem(ActiveOtherBean bean, int position) { if (bean.getImg_or_video().equals("1")) { RouteUtil.forwardCommunity(bean.getId()); } else { - int playPosition = 0; + /*int playPosition = 0; for (int i = 0; i < videoList.size(); i++) { if (videoList.get(i).getId().equals(bean.getId())) { playPosition = i; } } - RouteUtil.forwardVideoActivity(); + RouteUtil.forwardVideoActivity();*/ } } @Override - public void onVideoItem(String activeBean, int position) { - + public void onItemMore(ActiveOtherBean bean, int position) { + DialogUitl.showSimpleDialog(mContext, getResources().getString(com.yunbao.main.R.string.msg_del_sure), false, new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + CommonHttpUtil.delActive(bean.getId(), new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + beanList.remove(position); + userCommunityAdapter.notifyItemRemoved(position); + } + } + }); + } + }); } }); communityRecyclerView.setAdapter(userCommunityAdapter);