From 9bb4ed1393105c27dd2254cc91733544f088b17b Mon Sep 17 00:00:00 2001 From: hch <16607480311@163.com> Date: Tue, 26 Mar 2024 18:20:48 +0800 Subject: [PATCH] =?UTF-8?q?add=20[=E6=96=B0=E5=A2=9E-=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5-=E5=8A=A8=E6=80=81=E5=88=A0=E9=99=A4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/adapter/UserCommunityAdapter.java | 25 ++++++++++++++--- .../yunbao/common/http/CommonHttpUtil.java | 11 +++++++- .../layout/activity_user_community_item.xml | 8 ++++++ .../main/res/mipmap-mdpi/icon_active_more.png | Bin 0 -> 527 bytes common/src/main/res/values-en-rUS/strings.xml | 1 + common/src/main/res/values-zh-rHK/strings.xml | 1 + common/src/main/res/values-zh-rTW/strings.xml | 1 + common/src/main/res/values-zh/strings.xml | 1 + common/src/main/res/values/strings.xml | 1 + .../main/activity/UserHomeActivity.java | 26 ++++++++++++++---- 10 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 common/src/main/res/mipmap-mdpi/icon_active_more.png 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 @@ + + Px$$w@>(RA@u(m9a_#K@f)jxz#hV&|a{%6CXejE2~s7OAxj60jvcr?CmW@C0x>_ zu@VGdKs#%}T8l{Z%>5G3CJ}GhCbyTl_LyP5|C`+vOxY(>#tQ{5yKyzFhD(-!u5`(S zj^U_bHC(a;bfrrsR4*-EX%^GNF1)>q_fNmn;G2mF{-C^Sxeg+ZeM>a>W?) zJQxfv0o+<^KV5T~bRQ?+BuQcbrvO$(BEd65TPgg#EdNs?TN$O1`@LWxKO;HA-M9OMBPp^q!@9e}rgfEKN_ z8xFt|@8bmAZnw_?Ed89_QLe}s^IEUhck_UY(8me5)oSfWQM3bK>^2sWIg)4A+M7J! zBJ^6F0&ric zR5~tC(y#qV_i+Z!Th~zjD{v^LeCJfdzR87Br-nl@~KhJBL@rA`fpV#;?;HSC*QD0ON$6jQ!)s$t*cLa9^3p_uZW^Bd|EK}=Ub R-&6nq002ovPDHLkV1frq>A3&^ literal 0 HcmV?d00001 diff --git a/common/src/main/res/values-en-rUS/strings.xml b/common/src/main/res/values-en-rUS/strings.xml index a16b1aa54..d473f7815 100644 --- a/common/src/main/res/values-en-rUS/strings.xml +++ b/common/src/main/res/values-en-rUS/strings.xml @@ -28,4 +28,5 @@ 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);