fix [修复-bug]

This commit is contained in:
hch
2024-04-03 13:11:10 +08:00
parent 0f9f53a080
commit 04bc9af501
28 changed files with 469 additions and 238 deletions

View File

@@ -3,16 +3,19 @@ package com.yunbao.video.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.custom.ItemSlideHelper;
import com.yunbao.common.utils.ClickUtil;
@@ -324,20 +327,20 @@ public class VideoScrollAdapter extends RecyclerView.Adapter<VideoScrollAdapter.
* 关注发生变化
*/
public void onFollowChanged(boolean needExclude, String excludeVideoId, String toUid, int isAttention) {
// if (mList != null && !TextUtils.isEmpty(toUid) && !TextUtils.isEmpty(excludeVideoId)) {
// for (int i = 0, size = mList.size(); i < size; i++) {
// VideoBean videoBean = mList.get(i);
// if (videoBean != null) {
// if (needExclude && excludeVideoId.equals(videoBean.getId())) {
// continue;
// }
// if (toUid.equals(videoBean.getUid())) {
// videoBean.setAttent(isAttention);
// notifyItemChanged(i, Constants.PAYLOAD);
// }
// }
// }
// }
if (mList != null && !TextUtils.isEmpty(toUid) && !TextUtils.isEmpty(excludeVideoId)) {
for (int i = 0, size = mList.size(); i < size; i++) {
ActiveBean videoBean = mList.get(i);
if (videoBean != null) {
if (needExclude && excludeVideoId.equals(videoBean.getId())) {
continue;
}
if (toUid.equals(videoBean.getUser_id())) {
videoBean.setIs_attention(String.valueOf(isAttention));
notifyItemChanged(i, Constants.PAYLOAD);
}
}
}
}
}
/**
@@ -377,16 +380,16 @@ public class VideoScrollAdapter extends RecyclerView.Adapter<VideoScrollAdapter.
* 分享数发生变化
*/
public void onShareChanged(String videoId, String shareNum) {
// if (mList != null && !TextUtils.isEmpty(videoId)) {
// for (int i = 0, size = mList.size(); i < size; i++) {
// VideoBean videoBean = mList.get(i);
// if (videoBean != null && videoId.equals(videoBean.getId())) {
// videoBean.setShareNum(shareNum);
// notifyItemChanged(i, Constants.PAYLOAD);
// break;
// }
// }
// }
if (mList != null && !TextUtils.isEmpty(videoId)) {
for (int i = 0, size = mList.size(); i < size; i++) {
ActiveBean videoBean = mList.get(i);
if (videoBean != null && videoId.equals(videoBean.getId())) {
videoBean.setShare_num(String.valueOf(Integer.parseInt(videoBean.getShare_num()) + Integer.parseInt(shareNum)));
notifyItemChanged(i, Constants.PAYLOAD);
break;
}
}
}
}
public void release() {

View File

@@ -0,0 +1,31 @@
package com.yunbao.video.event;
/**
* Created by cxf on 2018/12/17.
*/
public class VideoFollowEvent {
private String videoId;
private int isLike;
public VideoFollowEvent(String videoId, int isLike) {
this.videoId = videoId;
this.isLike = isLike;
}
public String getVideoId() {
return videoId;
}
public void setVideoId(String videoId) {
this.videoId = videoId;
}
public int getIsLike() {
return isLike;
}
public void setIsLike(int isLike) {
this.isLike = isLike;
}
}

View File

@@ -228,7 +228,7 @@ public class VideoHttpUtil {
String uid = CommonAppConfig.getInstance().getUid();
String s = MD5Util.getMD5(uid + "-" + videoid + "-" + VIDEO_SALT);
HttpClient.getInstance().get("Video.addShare", VideoHttpConsts.SET_VIDEO_SHARE)
.params("uid", uid,true)
.params("uid", uid, true)
.params("videoid", videoid)
.params("random_str", s)
.execute(callback);
@@ -246,7 +246,7 @@ public class VideoHttpUtil {
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_START);
String s = MD5Util.getMD5(uid + "-" + videoId + "-" + VIDEO_SALT);
HttpClient.getInstance().get("Video.addView", VideoHttpConsts.VIDEO_WATCH_START)
.params("uid", uid,true)
.params("uid", uid, true)
.params("videoid", videoId)
.params("random_str", s)
.execute(CommonHttpUtil.NO_CALLBACK);
@@ -263,12 +263,21 @@ public class VideoHttpUtil {
VideoHttpUtil.cancel(VideoHttpConsts.VIDEO_WATCH_END);
String s = MD5Util.getMD5(uid + "-" + videoId + "-" + VIDEO_SALT);
HttpClient.getInstance().get("Video.setConversion", VideoHttpConsts.VIDEO_WATCH_END)
.params("uid", uid,true)
.params("uid", uid, true)
.params("videoid", videoId)
.params("random_str", s)
.execute(CommonHttpUtil.NO_CALLBACK);
}
/**
*
*/
public static void addShareCount(String dynamic_id, HttpCallback callback) {
HttpClient.getInstance().get("Pdlcommunity.userClickDynamicShare", "Pdlcommunity.userClickDynamicShare")
.params("dynamic_id", dynamic_id)
.execute(callback);
}
}

View File

@@ -105,8 +105,8 @@ public class VideoPlayViewHolder extends AbsViewHolder implements View.OnClickLi
ToastUtil.show(mContext.getResources().getString(R.string.live_play_error));
}
});
placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH);
//placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH);
placeholderView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
placeholderView.requestLayout();
placeholderView.setKeepContentOnPlayerReset(false);
placeholderView.setPlayer(mPlayer);

View File

@@ -31,6 +31,7 @@ import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.L;
@@ -42,8 +43,8 @@ import com.yunbao.share.bean.ShareBean;
import com.yunbao.share.ui.SharePopDialog;
import com.yunbao.video.R;
import com.yunbao.video.activity.AbsVideoPlayActivity;
import com.yunbao.video.dialog.VideoShareDialogFragment;
import com.yunbao.video.event.VideoLikeEvent;
import com.yunbao.video.event.VideoShareEvent;
import com.yunbao.video.http.VideoHttpUtil;
import org.greenrobot.eventbus.EventBus;
@@ -305,8 +306,8 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
mCover.requestLayout();
}
mCover.setImageDrawable(drawable);
L.e("setCoverImage————Height----"+mCover.getHeight());
L.e("setCoverImage————Width----"+mCover.getWidth());
L.e("setCoverImage————Height----" + mCover.getHeight());
L.e("setCoverImage————Width----" + mCover.getWidth());
}
}
@@ -531,7 +532,26 @@ public class VideoPlayWrapViewHolder extends AbsViewHolder implements View.OnCli
} else {
image = mVideoBean.getVideo() + "?vframe/jpg/offset/0";
}
new SharePopDialog(mContext).setShareType(SharePopDialog.TYPE_VIDEO).setShareData(ShareBean.ShareBuilder.create().setShareType(SharePopDialog.TYPE_VIDEO).setUid(CommonAppConfig.getInstance().getUid()).setCover(StringUtil.isEmpty(image) ? mVideoBean.getUser_avatar() : image).setTitle(StringUtil.isEmpty(mVideoBean.getContent()) ? mVideoBean.getUser_name() : JSONObject.parseObject(mVideoBean.getContent()).getString("msg")).setAnchorId(mVideoBean.getUser_id()).setAnchorName(mVideoBean.getUser_name()).setAnchorAvatar(mVideoBean.getUser_avatar()).setExtraData(mVideoBean.getId()).build()).showDialog();
SharePopDialog sharePopDialog = new SharePopDialog(mContext).setShareType(SharePopDialog.TYPE_VIDEO).setShareData(ShareBean.ShareBuilder.create().setShareType(SharePopDialog.TYPE_VIDEO).setUid(CommonAppConfig.getInstance().getUid()).setCover(StringUtil.isEmpty(image) ? mVideoBean.getUser_avatar() : image).setTitle(StringUtil.isEmpty(mVideoBean.getContent()) ? mVideoBean.getUser_name() : JSONObject.parseObject(mVideoBean.getContent()).getString("msg")).setAnchorId(mVideoBean.getUser_id()).setAnchorName(mVideoBean.getUser_name()).setAnchorAvatar(mVideoBean.getUser_avatar()).setExtraData(mVideoBean.getId()).build());
sharePopDialog.showDialog();
sharePopDialog.setOnShareListener(new SharePopDialog.onShareListener() {
@Override
public void onShareAddCount() {
LiveNetManager.get(mContext).shreCount(mVideoBean.getId(), new com.yunbao.common.http.base.HttpCallback<com.yunbao.common.bean.ShareBean>() {
@Override
public void onSuccess(com.yunbao.common.bean.ShareBean data) {
if (data.getNum() != 0) {
EventBus.getDefault().post(new VideoShareEvent(mVideoBean.getId(), String.valueOf(data.getNum())));
}
}
@Override
public void onError(String error) {
}
});
}
});
}
public void release() {

View File

@@ -11,14 +11,12 @@ import android.view.ViewGroup;
import com.umeng.analytics.MobclickAgent;
import com.yunbao.common.bean.ActiveBean;
import com.yunbao.common.bean.CommentBean;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.video.R;
import com.yunbao.video.activity.AbsVideoPlayActivity;
import com.yunbao.video.adapter.VideoScrollAdapter;
import com.yunbao.common.bean.VideoBean;
import com.yunbao.video.bean.VideoCommentBean;
import com.yunbao.video.custom.VideoLoadingBar;
import com.yunbao.video.event.VideoCommentEvent;
import com.yunbao.video.event.VideoLikeEvent;
@@ -279,6 +277,11 @@ public class VideoScrollViewHolder extends AbsViewHolder implements VideoScrollA
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onVideoUserFollow() {
}
/**
* 分享数发生变化
*/

View File

@@ -42,7 +42,7 @@
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"
android:layout_marginTop="38dp"
android:padding="3dp"
android:visibility="visible" />