From df996435ec6589b2939c558ce9c0a1acf27ec08a Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Thu, 28 Mar 2024 15:48:29 +0800 Subject: [PATCH] =?UTF-8?q?fix=20[=E5=8D=A1=E7=89=87=E5=86=85=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E9=9C=80=E8=A6=81=E5=8A=A0=E7=9B=B4=E6=92=AD?= =?UTF-8?q?=E7=8A=B6=E6=80=81&=E7=9B=B4=E6=92=AD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=9B=B4=E6=92=AD=E9=97=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/dialog/PDLiveMessageListAdapter.java | 34 +++++++++++++- .../activity/PDLiveConversationActivity.java | 44 +++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java index 5b2f9db7d..2d0d7045c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java +++ b/live/src/main/java/com/yunbao/live/dialog/PDLiveMessageListAdapter.java @@ -11,8 +11,13 @@ import android.widget.TextView; import androidx.annotation.NonNull; +import com.alibaba.fastjson.JSON; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.message.content.MessageChatTipsContent; import com.yunbao.common.utils.DateFormatUtil; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.live.R; import com.yunbao.live.event.InputPanelViewHolderEvent; @@ -21,6 +26,7 @@ import org.greenrobot.eventbus.EventBus; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import java.util.HashMap; import io.rong.common.RLog; import io.rong.imkit.R.string; @@ -103,8 +109,33 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { } else if (!isSender) { holder.getView(R.id.left_liveStatus).setVisibility(View.GONE); } + holder.getView(R.id.left_liveStatus).setOnClickListener(view -> { + LiveHttpUtil.getLiveInfo(mDataList.get(position).getTargetId(), new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + if (liveBean == null) { + return; + } + liveBean.setParams(new HashMap<>()); + new LiveRoomCheckLivePresenter(view.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + } + }); + }); } - if (holder.getView(R.id.right_liveStatus)!=null) { + if (holder.getView(R.id.right_liveStatus) != null) { if (isRightLive && isSender) { holder.getView(R.id.right_liveStatus).setVisibility(View.VISIBLE); } else { @@ -114,5 +145,4 @@ public class PDLiveMessageListAdapter extends MessageListAdapter { } - } diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java index 06d20ecdb..9a3416d8e 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationActivity.java @@ -25,6 +25,7 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; @@ -32,17 +33,20 @@ import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.SelectImageActivity; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.ImageEntity; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.MessageUserInfoBean; import com.yunbao.common.bean.NoviceInstructorModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.event.PDChatInputModeEvent; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.MessageIMManager; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; @@ -66,6 +70,7 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import io.rong.imkit.IMCenter; @@ -301,6 +306,45 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl ViewUtils.findViewById(card, R.id.follow, Button.class).setVisibility(View.INVISIBLE); } getRemarkName(); + LiveNetManager.get(mContext) + .getUserLiveStatus(targetId, new HttpCallback>() { + @Override + public void onSuccess(List data) { + if (data.contains(Integer.parseInt(targetId))) { + ViewUtils.findViewById(card, R.id.liveStatus).setVisibility(View.VISIBLE); + ViewUtils.findViewById(card, R.id.liveStatus).setOnClickListener(view -> { + LiveHttpUtil.getLiveInfo(targetId, new com.yunbao.common.http.HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + if (liveBean == null) { + return; + } + liveBean.setParams(new HashMap<>()); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + } + }); + }); + } + } + + @Override + public void onError(String error) { + + } + }); } @Override