调整PK排位赛判断
This commit is contained in:
parent
0f457efce6
commit
d53d250e6f
@ -706,7 +706,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
|||||||
* 主播与主播PK 所有人收到PK开始的回调
|
* 主播与主播PK 所有人收到PK开始的回调
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) {
|
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname,String isLadders) {
|
||||||
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
|
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
|
||||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||||
@ -718,6 +718,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
|||||||
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
|
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
|
||||||
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
|
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
|
||||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||||
|
mLiveRoomViewHolder.initPkRank(isLadders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -763,13 +763,13 @@ public class SocketClient {
|
|||||||
break;
|
break;
|
||||||
case 2://收到对方确认主播PK回调
|
case 2://收到对方确认主播PK回调
|
||||||
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||||
break;
|
break;
|
||||||
case 3://对方主播拒绝PK的回调
|
case 3://对方主播拒绝PK的回调
|
||||||
mListener.onLinkMicPkRefuse();
|
mListener.onLinkMicPkRefuse();
|
||||||
break;
|
break;
|
||||||
case 4://所有人收到PK开始址的回调
|
case 4://所有人收到PK开始址的回调
|
||||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"));
|
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||||
break;
|
break;
|
||||||
case 5://PK时候断开连麦的回调
|
case 5://PK时候断开连麦的回调
|
||||||
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
if (LivePushTxViewHolder.mTRTCCloud != null) {
|
||||||
|
@ -247,7 +247,7 @@ public interface SocketMessageListener {
|
|||||||
/**
|
/**
|
||||||
* 主播与主播PK 所有人收到PK开始的回调
|
* 主播与主播PK 所有人收到PK开始的回调
|
||||||
*/
|
*/
|
||||||
void onLinkMicPkStart(String pkUid, String pkhead, String pkname);
|
void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主播与主播PK 断开连麦pk的回调
|
* 主播与主播PK 断开连麦pk的回调
|
||||||
|
@ -1004,13 +1004,13 @@ public class SocketRyClient {
|
|||||||
break;
|
break;
|
||||||
case 2://收到对方主播PK回调
|
case 2://收到对方主播PK回调
|
||||||
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
mListener.onLinkMicToPk(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));
|
||||||
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
mListener.onLinkMicPkStart(map.getString("uid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));// mListener.onLinkMicPkStart(map.getString("uid"));
|
||||||
break;
|
break;
|
||||||
case 3://对方主播拒绝PK的回调
|
case 3://对方主播拒绝PK的回调
|
||||||
mListener.onLinkMicPkRefuse();
|
mListener.onLinkMicPkRefuse();
|
||||||
break;
|
break;
|
||||||
case 4://所有人收到PK开始址的回调
|
case 4://所有人收到PK开始址的回调
|
||||||
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"));
|
mListener.onLinkMicPkStart(map.getString("pkuid"), map.getString("pkhead"), map.getString("pkname"),map.getString("is_ladders"));
|
||||||
break;
|
break;
|
||||||
case 5://PK时候断开连麦的回调
|
case 5://PK时候断开连麦的回调
|
||||||
if (rtcRoom != null) {
|
if (rtcRoom != null) {
|
||||||
|
@ -1511,16 +1511,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
initPkRank();
|
initPkRank();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPkRank() {
|
private void initPkRankView() {
|
||||||
API.get().pdLiveApi(mContext)
|
if(pkRankVf.getTag()!=null){
|
||||||
.getPkRanksList(mLiveUid, pkUid)
|
return;
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
}
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.subscribe(listResponseModel -> {
|
|
||||||
PkRankBean bean = listResponseModel.getData().getInfo();
|
|
||||||
ToastUtil.show("触发PK排位赛");
|
|
||||||
Log.i("PK", bean.toString());
|
|
||||||
if (bean != null) {
|
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22));
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22));
|
||||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.leftMargin = DpUtil.dp2px(2);
|
params.leftMargin = DpUtil.dp2px(2);
|
||||||
@ -1530,20 +1524,40 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
ImageView titleIcon = new ImageView(mContext);
|
ImageView titleIcon = new ImageView(mContext);
|
||||||
mPkRankIcon = hourView.findViewById(R.id.wish_pic);
|
mPkRankIcon = hourView.findViewById(R.id.wish_pic);
|
||||||
mPkRankText = hourView.findViewById(R.id.wish_index);
|
mPkRankText = hourView.findViewById(R.id.wish_index);
|
||||||
mPkRankText.setText(bean.getName());
|
|
||||||
mPkRankText.setLayoutParams(textParams);
|
mPkRankText.setLayoutParams(textParams);
|
||||||
mPkRankText.setGravity(Gravity.CENTER);
|
mPkRankText.setGravity(Gravity.CENTER);
|
||||||
titleIcon.setImageResource(R.mipmap.icon_pk_rank);
|
titleIcon.setImageResource(R.mipmap.icon_pk_rank);
|
||||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
|
||||||
titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
mPkRankIcon.setLayoutParams(params);
|
mPkRankIcon.setLayoutParams(params);
|
||||||
pkRankVf.addView(titleIcon);
|
pkRankVf.addView(titleIcon);
|
||||||
pkRankVf.addView(hourView);
|
pkRankVf.addView(hourView);
|
||||||
pkRankVf.startFlipping();
|
pkRankVf.startFlipping();
|
||||||
|
pkRankVf.setTag("start");
|
||||||
|
}
|
||||||
|
|
||||||
if(StringUtil.isEmpty(bean.getPkTopImgUrl())){
|
private void initPkRank() {
|
||||||
|
initPkRank(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initPkRank(String isLadders) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.getPkRanksList(mLiveUid, pkUid)
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.subscribe(listResponseModel -> {
|
||||||
|
PkRankBean bean = listResponseModel.getData().getInfo();
|
||||||
|
if (bean != null) {
|
||||||
|
Log.i("PK", bean.toString() + " | " + isLadders);
|
||||||
|
initPkRankView();
|
||||||
|
|
||||||
|
mPkRankText.setText(bean.getName());
|
||||||
|
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||||
|
if (StringUtil.isEmpty(bean.getPkTopImgUrl()) || StringUtil.isEmpty(isLadders)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!StringUtil.isEmpty(isLadders)) {
|
||||||
|
bean.setPkTopImgUrl(isLadders);
|
||||||
|
}
|
||||||
if (Integer.parseInt(bean.getRedVal()) > 2) {
|
if (Integer.parseInt(bean.getRedVal()) > 2) {
|
||||||
mRedVal.setVisibility(View.VISIBLE);
|
mRedVal.setVisibility(View.VISIBLE);
|
||||||
mRedVal.setText(bean.getRedVal() + "連勝");
|
mRedVal.setText(bean.getRedVal() + "連勝");
|
||||||
@ -1593,6 +1607,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
private void updatePkRank(PkRankBean bean) {
|
private void updatePkRank(PkRankBean bean) {
|
||||||
mPkRankText.setText(bean.getName());
|
mPkRankText.setText(bean.getName());
|
||||||
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);
|
||||||
|
initPkRank();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1784,8 +1799,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
uidR2 = "";
|
uidR2 = "";
|
||||||
uidR1 = "";
|
uidR1 = "";
|
||||||
uidR3 = "";
|
uidR3 = "";
|
||||||
|
|
||||||
initPkRank();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//双人pk关闭
|
//双人pk关闭
|
||||||
@ -3561,6 +3574,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
case PK_TWO_START:
|
case PK_TWO_START:
|
||||||
pkUid = event.getObject().toString();
|
pkUid = event.getObject().toString();
|
||||||
UpPkTwo();
|
UpPkTwo();
|
||||||
|
initPkRank();
|
||||||
break;
|
break;
|
||||||
case PK_TWO_END:
|
case PK_TWO_END:
|
||||||
closePkTwo();
|
closePkTwo();
|
||||||
|
@ -923,7 +923,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname) {
|
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname,String isLadders) {
|
||||||
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
|
||||||
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
@ -934,6 +934,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid());
|
Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid());
|
||||||
if (!liveID.equals(CommonAppConfig.getInstance().getUid())) {
|
if (!liveID.equals(CommonAppConfig.getInstance().getUid())) {
|
||||||
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
|
||||||
|
mLiveRoomViewHolder.initPkRank(isLadders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user