add [新增-个人主页-动态删除]
This commit is contained in:
parent
e69be60d43
commit
9bb4ed1393
@ -30,14 +30,16 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
|
||||
private List<ActiveOtherBean> commentBeanList;
|
||||
private Context mContext;
|
||||
private onItemClickListener onItemClickListener;
|
||||
private boolean isMe;
|
||||
|
||||
public void setOnItemClickListener(UserCommunityAdapter.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.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,12 +85,22 @@ 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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,6 +49,14 @@
|
||||
|
||||
</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>
|
||||
|
||||
<TextView
|
||||
|
BIN
common/src/main/res/mipmap-mdpi/icon_active_more.png
Normal file
BIN
common/src/main/res/mipmap-mdpi/icon_active_more.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 527 B |
@ -28,4 +28,5 @@
|
||||
<string name="see_more">See more</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="msg_del_sure">Do you confirm deletion?</string>
|
||||
</resources>
|
@ -1493,4 +1493,5 @@
|
||||
<string name="see_more">查看更多</string>
|
||||
<string name="close">收起</string>
|
||||
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
|
||||
<string name="msg_del_sure">是否確認刪除?</string>
|
||||
</resources>
|
||||
|
@ -1493,4 +1493,5 @@
|
||||
<string name="see_more">查看更多</string>
|
||||
<string name="close">收起</string>
|
||||
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
|
||||
<string name="msg_del_sure">是否確認刪除?</string>
|
||||
</resources>
|
||||
|
@ -1491,4 +1491,5 @@
|
||||
<string name="see_more">查看更多</string>
|
||||
<string name="close">收起</string>
|
||||
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
|
||||
<string name="msg_del_sure">是否確認刪除?</string>
|
||||
</resources>
|
||||
|
@ -1513,6 +1513,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="see_more">查看更多</string>
|
||||
<string name="close">收起</string>
|
||||
<string name="time_cannot_be_greater_than_the_current_time">时间不能大于当前时间</string>
|
||||
<string name="msg_del_sure">是否確認刪除?</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
@ -141,6 +141,7 @@ public class UserHomeActivity extends AbsActivity {
|
||||
private LinearLayout bottomEditLayout;
|
||||
private UploadQnImpl mUploadStrategy;
|
||||
private List<ActiveBean> videoList = new ArrayList<>();
|
||||
List<ActiveOtherBean> 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<ActiveOtherBean> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user