Merge branch 'refs/heads/v6.8.1' into 6.8.2

This commit is contained in:
老皮 2024-09-27 10:09:00 +08:00
commit ee8f744ed2
7 changed files with 105 additions and 18 deletions

View File

@ -26,5 +26,5 @@ public interface CheckLiveCallBack {
*
* @param error
*/
void onError(String error);
void onError(String error,int code);
}

View File

@ -426,12 +426,12 @@ public class LiveNetManager {
}
} else {
if (callBack != null) {
callBack.onError(listResponseModel.getData().getMsg());
callBack.onError(listResponseModel.getData().getMsg(), listResponseModel.getData().getCode());
}
}
} else {
if (callBack != null) {
callBack.onError(listResponseModel.getData().getMsg());
callBack.onError(listResponseModel.getData().getMsg(), listResponseModel.getData().getCode());
}
}
}
@ -440,7 +440,7 @@ public class LiveNetManager {
public void accept(Throwable throwable) throws Exception {
Log.e("异常", "checkLive: ", throwable);
if (callBack != null) {
callBack.onError(throwable.getMessage());
callBack.onError(throwable.getMessage(), -1008611);
}
}
}).isDisposed();

View File

@ -43,8 +43,9 @@ public class LiveRoomCheckLivePresenter {
* @param context 上下文
* @param liveUid 直播间ID
* @param stream
* @param isPk 是否是pk时点击头像打开弹窗后跳转来的
*/
public LiveRoomCheckLivePresenter(Context context, String liveUid, String stream, NewActionListener actionListener) {
public LiveRoomCheckLivePresenter(Context context, String liveUid, String stream, NewActionListener actionListener,boolean... isPk) {
mContext = context;
LiveNetManager.get(context)
.checkLive(liveUid, stream, new CheckLiveCallBack() {
@ -106,9 +107,14 @@ public class LiveRoomCheckLivePresenter {
}
@Override
public void onError(String error) {
Log.e("直播间异常", "onError: " + error);
public void onError(String error,int code) {
Log.e("直播间异常", "onError: " + error + " code = " + code);
if (code == 1004 && isPk != null && isPk.length > 0 && isPk[0]) {
// 1004 为用户被踢过不能进入直播间但是不能随机再进入别的直播间
Log.e("直播间异常", "onError: " + error + " code = " + code);
}else {
Bus.get().post(new LiveErrorEvent());
}
ToastUtil.show(error);
}
});

View File

@ -80,16 +80,18 @@ public class LiveReportActivity extends AbsActivity implements LiveReportAdapter
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
mKeyBoardHeightUtil = new KeyBoardHeightUtil(mContext, findViewById(android.R.id.content), this);
mAdapter = new LiveReportAdapter(mContext);
if (mRecyclerView != null) {
mRecyclerView.setAdapter(mAdapter);
}
LiveHttpUtil.getLiveReportList(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
List<LiveReportBean> list = JSON.parseArray(Arrays.toString(info), LiveReportBean.class);
mAdapter = new LiveReportAdapter(mContext, list);
mAdapter.setActionListener(LiveReportActivity.this);
if (mRecyclerView != null) {
mRecyclerView.setAdapter(mAdapter);
}
mAdapter.setData(list);
if (mKeyBoardHeightUtil != null) {
mKeyBoardHeightUtil.start();
}

View File

@ -1,5 +1,7 @@
package com.yunbao.live.adapter;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
@ -52,14 +54,92 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
private int photoIndex = 0;
private File mFile1, mFile2, mFile3;
public LiveReportAdapter(Context context, List<LiveReportBean> list) {
mContext = context;
/* mContext = context;
mList = list;
mInflater = LayoutInflater.from(context);
mCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_1);
mUnCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_0);
mCheckedPosition = -1;
imageUtilInit();*/
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Object tag = v.getTag();
if (tag == null) {
return;
}
int position = (int) tag;
LiveReportBean bean = mList.get(position - 1);
if (mCheckedPosition == position) {
bean.setChecked(false);
notifyItemChanged(position, Constants.PAYLOAD);
mCheckedPosition = -1;
mCurVideoReportBean = null;
} else {
if (mCheckedPosition >= 0) {
mList.get(mCheckedPosition - 1).setChecked(false);
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
}
bean.setChecked(true);
notifyItemChanged(position, Constants.PAYLOAD);
mCheckedPosition = position;
mCurVideoReportBean = bean;
}
}
};
mReportListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getId() == R.id.btn_report){
if (mFootVh != null) {
mFootVh.submit();
}
}else if (v.getId() == R.id.photo1){
photoIndex = 0;
if (mFootVh != null) {
mFootVh.showAddPhoto();
}
}
else if (v.getId() == R.id.photo2){
photoIndex = 1;
if (mFootVh != null) {
mFootVh.showAddPhoto();
}
}
else if (v.getId() == R.id.photo3){
photoIndex = 2;
if (mFootVh != null) {
mFootVh.showAddPhoto();
}
}
}
};
}
public void setActionListener(ActionListener actionListener) {
mActionListener = actionListener;
}
@SuppressLint("NotifyDataSetChanged")
public void setData(List<LiveReportBean> list) {
mList = list;
notifyDataSetChanged();
}
public LiveReportAdapter(Activity context) {
this.mContext = context;
mInflater = LayoutInflater.from(context);
mCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_1);
mUnCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_0);
mCheckedPosition = -1;
imageUtilInit();
mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -196,7 +276,7 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
@Override
public int getItemCount() {
return mList.size() + 2;
return mList == null ? 0 : mList.size() + 2;
}
class HeadVh extends RecyclerView.ViewHolder {
@ -272,7 +352,4 @@ public class LiveReportAdapter extends RecyclerView.Adapter {
void onReportClick(LiveReportBean bean, String text,File file1,File file2,File file3);
}
public void setActionListener(ActionListener actionListener) {
mActionListener = actionListener;
}
}

View File

@ -681,7 +681,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
public void onCheckError(String contextError) {
}
});
},true);
}
}
});

View File

@ -201,6 +201,8 @@ public class SocketSwClient {
SocketReceiveBean received = JSON.parseObject(socketMsg, SocketReceiveBean.class);
JSONObject map = received.getMsg().getJSONObject(0);
L.e("收到IM数据--->" + map.toString());
String ct="";
switch (map.getString("_method_")) {
//用户连麦