add [新增-个人主页-动态删除]

This commit is contained in:
hch 2024-03-26 18:20:48 +08:00
parent e69be60d43
commit 9bb4ed1393
10 changed files with 64 additions and 11 deletions

View File

@ -30,14 +30,16 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
private List<ActiveOtherBean> commentBeanList; private List<ActiveOtherBean> commentBeanList;
private Context mContext; private Context mContext;
private onItemClickListener onItemClickListener; private onItemClickListener onItemClickListener;
private boolean isMe;
public void setOnItemClickListener(UserCommunityAdapter.onItemClickListener onItemClickListener) { public void setOnItemClickListener(UserCommunityAdapter.onItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener; this.onItemClickListener = onItemClickListener;
} }
public UserCommunityAdapter(Context content, List<ActiveOtherBean> commentBeanList) { public UserCommunityAdapter(Context content, List<ActiveOtherBean> commentBeanList, boolean isMe) {
this.mContext = content; this.mContext = content;
this.commentBeanList = commentBeanList; this.commentBeanList = commentBeanList;
this.isMe = isMe;
} }
@NonNull @NonNull
@ -69,6 +71,7 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
private TextView likeCount; private TextView likeCount;
private TextView comCount; private TextView comCount;
private TextView shareCount; private TextView shareCount;
private ImageView more_del;
public CommentViewHolder(@NonNull View itemView) { public CommentViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
@ -82,11 +85,21 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
likeCount = itemView.findViewById(R.id.likeCount); likeCount = itemView.findViewById(R.id.likeCount);
comCount = itemView.findViewById(R.id.comCount); comCount = itemView.findViewById(R.id.comCount);
shareCount = itemView.findViewById(R.id.shareCount); 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() { itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { 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) { public void setData(ActiveOtherBean bean) {
itemView.setTag(bean); itemView.setTag(bean);
mAvatar.setTag(bean); mAvatar.setTag(bean);
more_del.setTag(bean);
if (isMe) {
more_del.setVisibility(View.VISIBLE);
}
ImgLoader.display(mContext, bean.getUser_avatar(), mAvatar); ImgLoader.display(mContext, bean.getUser_avatar(), mAvatar);
userName.setText(bean.getUser_name()); userName.setText(bean.getUser_name());
time.setText(bean.getCreate_time()); time.setText(bean.getCreate_time());
@ -146,6 +163,6 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
public interface onItemClickListener { public interface onItemClickListener {
void onImgItem(ActiveOtherBean activeBean, int position); void onImgItem(ActiveOtherBean activeBean, int position);
void onVideoItem(String activeBean, int position); void onItemMore(ActiveOtherBean activeBean, int position);
} }
} }

View File

@ -606,7 +606,7 @@ public class CommonHttpUtil {
} }
/** /**
* 动态-删除 * 动态-评论-删除
*/ */
public static void delCom(String comment_id, HttpCallback callback) { public static void delCom(String comment_id, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.delComment", "Pdlcommunity.delComment") HttpClient.getInstance().get("Pdlcommunity.delComment", "Pdlcommunity.delComment")
@ -651,6 +651,15 @@ public class CommonHttpUtil {
.params("home_banner_url_ary", imgs) .params("home_banner_url_ary", imgs)
.execute(callback); .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);
}
} }

View File

@ -49,6 +49,14 @@
</LinearLayout> </LinearLayout>
<ImageView
android:id="@+id/more_del"
android:layout_width="30dp"
android:layout_height="30dp"
android:padding="4dp"
android:src="@mipmap/icon_active_more"
android:visibility="invisible" />
</LinearLayout> </LinearLayout>
<TextView <TextView

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

View File

@ -28,4 +28,5 @@
<string name="see_more">See more</string> <string name="see_more">See more</string>
<string name="close">close</string> <string name="close">close</string>
<string name="time_cannot_be_greater_than_the_current_time">Time cannot be greater than the current time</string> <string name="time_cannot_be_greater_than_the_current_time">Time cannot be greater than the current time</string>
<string name="msg_del_sure">Do you confirm deletion?</string>
</resources> </resources>

View File

@ -1493,4 +1493,5 @@
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string> <string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
<string name="msg_del_sure">是否確認刪除?</string>
</resources> </resources>

View File

@ -1493,4 +1493,5 @@
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string> <string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
<string name="msg_del_sure">是否確認刪除?</string>
</resources> </resources>

View File

@ -1491,4 +1491,5 @@
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string> <string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
<string name="msg_del_sure">是否確認刪除?</string>
</resources> </resources>

View File

@ -1513,6 +1513,7 @@ Limited ride And limited avatar frame</string>
<string name="see_more">查看更多</string> <string name="see_more">查看更多</string>
<string name="close">收起</string> <string name="close">收起</string>
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string> <string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
<string name="msg_del_sure">是否確認刪除?</string>
</resources> </resources>

View File

@ -141,6 +141,7 @@ public class UserHomeActivity extends AbsActivity {
private LinearLayout bottomEditLayout; private LinearLayout bottomEditLayout;
private UploadQnImpl mUploadStrategy; private UploadQnImpl mUploadStrategy;
private List<ActiveBean> videoList = new ArrayList<>(); private List<ActiveBean> videoList = new ArrayList<>();
List<ActiveOtherBean> beanList = new ArrayList<>();
private UserHomeImgsViewHolder userHomeImgsViewHolder; private UserHomeImgsViewHolder userHomeImgsViewHolder;
@ -171,27 +172,40 @@ public class UserHomeActivity extends AbsActivity {
CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() { CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onSuccess(int code, String msg, String[] info) {
List<ActiveOtherBean> beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class); beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class);
UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList); UserCommunityAdapter userCommunityAdapter = new UserCommunityAdapter(mContext, beanList,isMe);
userCommunityAdapter.setOnItemClickListener(new UserCommunityAdapter.onItemClickListener() { userCommunityAdapter.setOnItemClickListener(new UserCommunityAdapter.onItemClickListener() {
@Override @Override
public void onImgItem(ActiveOtherBean bean, int position) { public void onImgItem(ActiveOtherBean bean, int position) {
if (bean.getImg_or_video().equals("1")) { if (bean.getImg_or_video().equals("1")) {
RouteUtil.forwardCommunity(bean.getId()); RouteUtil.forwardCommunity(bean.getId());
} else { } else {
int playPosition = 0; /*int playPosition = 0;
for (int i = 0; i < videoList.size(); i++) { for (int i = 0; i < videoList.size(); i++) {
if (videoList.get(i).getId().equals(bean.getId())) { if (videoList.get(i).getId().equals(bean.getId())) {
playPosition = i; playPosition = i;
} }
} }
RouteUtil.forwardVideoActivity(); RouteUtil.forwardVideoActivity();*/
} }
} }
@Override @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); communityRecyclerView.setAdapter(userCommunityAdapter);