新增主動PK結束通知

This commit is contained in:
zlzw 2023-08-31 15:14:15 +08:00
parent 357ece2ebe
commit 8d984951c3
2 changed files with 112 additions and 37 deletions

View File

@ -352,6 +352,30 @@ public class LiveGiftPopup extends AbsDialogFragment {
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment"); fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
} }
}); });
/**
* 礼物图片运营位跳转
*/
ViewClicksAntiShake.clicksAntiShake(operateImage, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
StringBuffer htmlUrl = new StringBuffer();
htmlUrl.append(CommonAppConfig.HOST)
.append(liveGiftModel.getOperateUrl())
.append("?uid=")
.append(userInfo.getId())
.append("&token=")
.append(userInfo.getToken())
.append("&for");
Bundle bundle = new Bundle();
bundle.putString("url", htmlUrl.toString());
bundle.putInt("height", DeviceUtils.getScreenHeight(getActivity()) / 5 * 3);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
});
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
ImgLoader.display(mContext, R.mipmap.icon_live_gift_gift_itle, giftItle); ImgLoader.display(mContext, R.mipmap.icon_live_gift_gift_itle, giftItle);
} else { } else {
@ -809,6 +833,8 @@ public class LiveGiftPopup extends AbsDialogFragment {
if (!TextUtils.isEmpty(liveGiftModel.getOperateImage())) { if (!TextUtils.isEmpty(liveGiftModel.getOperateImage())) {
operateImage.setVisibility(View.VISIBLE); operateImage.setVisibility(View.VISIBLE);
ImgLoader.display(getContext(), liveGiftModel.getOperateImage(), operateImage); ImgLoader.display(getContext(), liveGiftModel.getOperateImage(), operateImage);
}else {
operateImage.setVisibility(View.GONE);
} }
} }

View File

@ -4,8 +4,11 @@ import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK; import static com.yunbao.common.Constants.SOCKET_LINK_MIC_PK;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK; import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter; import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.LIVE_PK_END;
import static com.yunbao.live.event.LiveAudienceEvent.LiveAudienceType.LIVE_PK_ING;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1; import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.mPkUid;
import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER; import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER;
import android.app.Dialog; import android.app.Dialog;
@ -118,6 +121,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
private TextView tv_avatarOther_name; private TextView tv_avatarOther_name;
private ImageView avatarOther; private ImageView avatarOther;
private LinearLayout goto_room_view; private LinearLayout goto_room_view;
private boolean isPk = false;
//修改上面主播的头像 //修改上面主播的头像
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
@ -126,6 +130,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
if (e != null) { if (e != null) {
if (!e.isClear()) { if (!e.isClear()) {
tv_avatarOther_name.setText(e.getUserNiceName()); tv_avatarOther_name.setText(e.getUserNiceName());
tv_avatarOther_name.setTag(e.getUserNiceName());
ImgLoader.displayAvatar(mContext, e.getAvatar(), avatarOther); ImgLoader.displayAvatar(mContext, e.getAvatar(), avatarOther);
goto_room_view.setVisibility(View.VISIBLE); goto_room_view.setVisibility(View.VISIBLE);
} else { } else {
@ -491,6 +496,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() { DialogUitl.showSimpleDialog(mContext, "是否要斷開連麥?", new DialogUitl.SimpleCallback() {
@Override @Override
public void onConfirmClick(Dialog dialog, String content) { public void onConfirmClick(Dialog dialog, String content) {
aheadOfScheduleEndPK(mPkUid, CommonAppConfig.getInstance().getUserBean().getUserNiceName(), (String) tv_avatarOther_name.getTag());
//断开连麦 //断开连麦
LiveRyAnchorActivity.isDRPK = 0; LiveRyAnchorActivity.isDRPK = 0;
HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout") HttpClient.getInstance().post("livepk.setliveuserout", "livepk.setliveuserout")
@ -597,6 +603,8 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} }
}); });
} }
}); });
} }
@ -975,6 +983,38 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} }
private void aheadOfScheduleEndPK(String pkUid, String uname, String pkname) {
if (!isPk) {
return;
}
String ct = "由於" + uname + "退出比賽," + pkname + "獲得勝利";
SocketSendBean seed_msg = new SocketSendBean()
.param("_method_", Constants.SOCKET_SYSTEM)
.param("action", 1)
.param("ct", ct);
seed_msg.create();
HttpClient.getInstance().get("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + pkUid)
.params("jsonstr", seed_msg.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
HttpClient.getInstance().post("Tx.sendmsgzs2", "Tx.sendmsgzs2")
.params("GroupId", "g" + CommonAppConfig.getInstance().getUid())
.params("jsonstr", seed_msg.mResult.toString())
.execute(new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
});
}
private Bitmap decodeResource(Resources resources, int id) { private Bitmap decodeResource(Resources resources, int id) {
TypedValue value = new TypedValue(); TypedValue value = new TypedValue();
resources.openRawResource(id, value); resources.openRawResource(id, value);
@ -1006,4 +1046,13 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
} }
}); });
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) {
if (event.getType() == LIVE_PK_END) {
isPk = false;
} else if (event.getType() == LIVE_PK_ING) {
isPk = true;
}
}
} }