From 58ba80929be62e1c2b9ae17d027fea745caf5f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Fri, 20 Sep 2024 10:52:34 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=B8=BB?= =?UTF-8?q?=E6=92=ADPK=E4=B8=AD=EF=BC=8C=E7=94=A8=E6=88=B7=E7=82=B9?= =?UTF-8?q?=E5=87=BBPK=E5=AF=B9=E6=89=8B=E5=A4=B4=E5=83=8F=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E8=BF=9B=E5=85=A5=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=EF=BC=88=E8=A2=AB=E8=B8=A2=E5=87=BA=E8=BF=87=E7=9A=84=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E7=A4=BA=E2=80=9C=E5=B7=B2=E8=A2=AB=E8=B8=A2?= =?UTF-8?q?=E5=87=BA=E7=9B=B4=E6=92=AD=E9=97=B4=E2=80=9D=EF=BC=8C=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E4=BC=9A=E8=87=AA=E5=8A=A8=E8=BF=9B=E5=85=A5=E5=88=B0?= =?UTF-8?q?=E5=88=AB=E7=9A=84=E4=B8=BB=E6=92=AD=E7=9B=B4=E6=92=AD=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/base/CheckLiveCallBack.java | 2 +- .../java/com/yunbao/common/http/live/LiveNetManager.java | 6 +++--- .../yunbao/common/utils/LiveRoomCheckLivePresenter.java | 9 ++++++--- .../main/java/com/yunbao/live/socket/SocketSwClient.java | 2 ++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java b/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java index 56e1d2067..ee90bcb57 100644 --- a/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java +++ b/common/src/main/java/com/yunbao/common/http/base/CheckLiveCallBack.java @@ -26,5 +26,5 @@ public interface CheckLiveCallBack { * * @param error */ - void onError(String error); + void onError(String error,int code); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 7631dc829..a42aa216a 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -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(); diff --git a/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java b/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java index 6c7d2d6f3..c1c2435e8 100644 --- a/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java +++ b/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java @@ -106,9 +106,12 @@ public class LiveRoomCheckLivePresenter { } @Override - public void onError(String error) { - Log.e("直播间异常", "onError: " + error); - Bus.get().post(new LiveErrorEvent()); + public void onError(String error,int code) { + Log.e("直播间异常", "onError: " + error + " code = " + code); + if (code != 1004) { + // 1004 为用户被踢过,不能进入直播间但是不能随机再进入别的直播间 + Bus.get().post(new LiveErrorEvent()); + } ToastUtil.show(error); } }); diff --git a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java index d7917ade1..4bcc60620 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketSwClient.java @@ -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_")) { //用户连麦 From 0646c2c6a7b5db35e4d165011b616393b0ad31df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Fri, 20 Sep 2024 13:22:46 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BA=E5=8F=AA?= =?UTF-8?q?=E6=9C=89=E4=BB=8E=E4=B8=BB=E6=92=ADPK=E4=B8=AD=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E7=9B=B4=E6=92=AD=E9=97=B4=E5=A4=B1=E8=B4=A5=EF=BC=88?= =?UTF-8?q?=E8=A2=AB=E8=B8=A2=E8=BF=87=EF=BC=89=E6=89=8D=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E5=8C=B9=E9=85=8D=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/utils/LiveRoomCheckLivePresenter.java | 7 +++++-- .../com/yunbao/live/dialog/LiveUserDialogFragment.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java b/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java index c1c2435e8..a3eb49433 100644 --- a/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java +++ b/common/src/main/java/com/yunbao/common/utils/LiveRoomCheckLivePresenter.java @@ -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() { @@ -108,8 +109,10 @@ public class LiveRoomCheckLivePresenter { @Override public void onError(String error,int code) { Log.e("直播间异常", "onError: " + error + " code = " + code); - if (code != 1004) { + 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); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index 8e23a8a9c..cfd746637 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -681,7 +681,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On public void onCheckError(String contextError) { } - }); + },true); } } }); From d79dba045d5b93ba51dba8ad3b32331d0dbcf5b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Mon, 23 Sep 2024 13:14:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E9=97=B4=E7=82=B9=E5=87=BB=E4=B8=89=E4=B8=AA=E7=82=B9--?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E8=AE=BE=E7=BD=AE--=E4=B8=BE=E6=8A=A5?= =?UTF-8?q?=E9=97=AA=E9=80=80=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=88=E7=BD=91?= =?UTF-8?q?=E9=80=9F=E6=85=A2=E4=B8=80=E7=82=B9=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveReportActivity.java | 10 ++- .../live/adapter/LiveReportAdapter.java | 87 +++++++++++++++++-- 2 files changed, 88 insertions(+), 9 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/activity/LiveReportActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveReportActivity.java index 6be9e8cf9..137c8453d 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveReportActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveReportActivity.java @@ -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 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(); } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveReportAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveReportAdapter.java index 052e063fa..bc65cadbf 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveReportAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveReportAdapter.java @@ -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 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 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; - } }