fix [修复-个人主页-点击视频-无法跳转问题]

This commit is contained in:
hch 2024-03-28 13:36:20 +08:00
parent 54c97251b8
commit 2e9d1cb3dd
2 changed files with 39 additions and 22 deletions

View File

@ -17,6 +17,7 @@ import com.alibaba.fastjson.JSONObject;
import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.R;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.ActiveOtherBean;
import com.yunbao.common.dialog.ImagePreviewDialog;
import com.yunbao.common.glide.ImgLoader;
@ -27,7 +28,7 @@ import java.util.ArrayList;
import java.util.List;
public class UserCommunityAdapter extends RecyclerView.Adapter {
private List<ActiveOtherBean> commentBeanList;
private List<ActiveBean> commentBeanList;
private Context mContext;
private onItemClickListener onItemClickListener;
private boolean isMe;
@ -36,7 +37,7 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
this.onItemClickListener = onItemClickListener;
}
public UserCommunityAdapter(Context content, List<ActiveOtherBean> commentBeanList, boolean isMe) {
public UserCommunityAdapter(Context content, List<ActiveBean> commentBeanList, boolean isMe) {
this.mContext = content;
this.commentBeanList = commentBeanList;
this.isMe = isMe;
@ -90,7 +91,7 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
@Override
public void onClick(View v) {
if (onItemClickListener != null) {
onItemClickListener.onItemMore((ActiveOtherBean) v.getTag(), getPosition());
onItemClickListener.onItemMore((ActiveBean) v.getTag(), getPosition());
}
}
});
@ -98,14 +99,19 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
@Override
public void onClick(View v) {
if (onItemClickListener != null) {
onItemClickListener.onImgItem((ActiveOtherBean) v.getTag(), getPosition());
ActiveBean activeOtherBean = (ActiveBean) v.getTag();
if (activeOtherBean.getImg_or_video().equals("1")) {
onItemClickListener.onImgItem(activeOtherBean, getPosition());
} else {
onItemClickListener.onItemVideo(activeOtherBean, getPosition());
}
}
}
});
}
@SuppressLint("SetTextI18n")
public void setData(ActiveOtherBean bean) {
public void setData(ActiveBean bean) {
itemView.setTag(bean);
mAvatar.setTag(bean);
more_del.setTag(bean);
@ -161,8 +167,10 @@ public class UserCommunityAdapter extends RecyclerView.Adapter {
}
public interface onItemClickListener {
void onImgItem(ActiveOtherBean activeBean, int position);
void onImgItem(ActiveBean activeBean, int position);
void onItemMore(ActiveOtherBean activeBean, int position);
void onItemMore(ActiveBean activeBean, int position);
void onItemVideo(ActiveBean activeBean, int position);
}
}

View File

@ -71,6 +71,8 @@ import com.yunbao.common.views.UserHomeImgsViewHolder;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.dialog.GiftWallDialog;
import com.yunbao.live.views.ShowBigPhoto;
import com.yunbao.video.activity.VideoPlayActivity;
import com.yunbao.video.utils.VideoStorge;
import java.io.File;
import java.util.ArrayList;
@ -152,7 +154,7 @@ public class UserHomeActivity extends AbsActivity {
private LinearLayout bottomEditLayout;
private UploadQnImpl mUploadStrategy;
private List<ActiveBean> videoList = new ArrayList<>();
List<ActiveOtherBean> beanList = new ArrayList<>();
List<ActiveBean> beanList = new ArrayList<>();
private UserHomeImgsViewHolder userHomeImgsViewHolder;
private Map<String, String> gotoRoomKey = new HashMap<>();
@ -183,26 +185,21 @@ public class UserHomeActivity extends AbsActivity {
CommonHttpUtil.getOtherDynamicList(uid, new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
beanList = JSONArray.parseArray(Arrays.toString(info), ActiveOtherBean.class);
beanList = JSONArray.parseArray(Arrays.toString(info), ActiveBean.class);
for (int j = 0; j < beanList.size(); j++) {
if (beanList.get(j).getImg_or_video().equals("2")) {
videoList.add(beanList.get(j));
}
}
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")) {
public void onImgItem(ActiveBean bean, int position) {
RouteUtil.forwardCommunity(bean.getId());
} else {
/*int playPosition = 0;
for (int i = 0; i < videoList.size(); i++) {
if (videoList.get(i).getId().equals(bean.getId())) {
playPosition = i;
}
}
RouteUtil.forwardVideoActivity();*/
}
}
@Override
public void onItemMore(ActiveOtherBean bean, int position) {
public void onItemMore(ActiveBean 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) {
@ -218,6 +215,18 @@ public class UserHomeActivity extends AbsActivity {
}
});
}
@Override
public void onItemVideo(ActiveBean activeBean, int position) {
int playPosition = 0;
for (int i = 0; i < videoList.size(); i++) {
if (videoList.get(i).getId().equals(activeBean.getId())) {
playPosition = i;
}
}
VideoStorge.getInstance().put(Constants.VIDEO_HOME, videoList);
VideoPlayActivity.forward(mContext, playPosition, Constants.VIDEO_HOME, 1);
}
});
communityRecyclerView.setAdapter(userCommunityAdapter);
}