修复单人PK坐席头像展示问题

This commit is contained in:
18401019693 2022-12-14 11:02:46 +08:00
parent 1293368d59
commit 3d60814538
7 changed files with 133 additions and 88 deletions

View File

@ -10,20 +10,7 @@ public class CoinChangeEvent {
private String coin;
private String goldCoinNum;
private boolean chargeSuccess;
//重置头像
private boolean resetProfilePicture = false;
public boolean isResetProfilePicture() {
return resetProfilePicture;
}
public CoinChangeEvent() {
}
public CoinChangeEvent setResetProfilePicture(boolean resetProfilePicture) {
this.resetProfilePicture = resetProfilePicture;
return this;
}
public CoinChangeEvent(String coin) {
this.coin = coin;

View File

@ -161,6 +161,18 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mPageContainer = findViewById(R.id.page_container);
EventBus.getDefault().register(this);
mDialogFragmentSet = new HashSet<>();
//解压 美颜模型
/*try {
CommonAppConfig.VIDEO_TIE_MODEl_PATH = getFilesDir().getAbsolutePath() + "/model";//app安装路径
File model = new File(CommonAppConfig.VIDEO_TIE_MODEl_PATH);
if (model.exists() && Objects.requireNonNull(model.listFiles()).length > 0) {
return;
}
UnzipFromAssets.unZip(LiveActivity.this, "model-all.zip", CommonAppConfig.VIDEO_TIE_MODEl_PATH, false);
} catch (Exception e) {
e.printStackTrace();
Log.i("log", "beauty e=" + e);
}*/
}
@Override
@ -211,9 +223,17 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (!mFirstConnectSocket) {
mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) {
// if (isRy == false) {
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
// } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
// }
}
// if (isRy == false) {
// SocketChatUtil.getFakeFans(mLiveUid);
// } else {
SocketRyChatUtil.getFakeFans(mLiveUid);
// }
}
}
}
@ -614,13 +634,23 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLinkMicAnchorClose() {
// if (isRy == false) {
// if (mLiveLinkMicAnchorPresenter != null) {
// mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
// }
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
// }
// } else {
if (mLiveLinkMicAnchorPresenter != null) {
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
}
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
}
// }
if (this instanceof LiveAudienceActivity) {
((LiveAudienceActivity) this).onLinkMicTxAnchor(false);
}
@ -674,33 +704,26 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
/**
* 主播与主播PK 所有人收到PK开始的回调
*/
private String mPkUid, mPkhead, mPkname, mIsLadders;
private Handler linkMicPkStartHandler = new Handler();
private Runnable linkMicPkStartRunnable = new Runnable() {
@Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) {
if (mContext instanceof LiveAudienceActivity) return;
Log.e("ry", "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (mLiveRoomViewHolder != null) {
Log.e("tasdsdg", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
mLiveRoomViewHolder.setOtherInfo(mPkUid, mPkhead, mPkname);
mLiveRoomViewHolder.initPkRank(mIsLadders);
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
mLiveRoomViewHolder.initPkRank(isLadders);
}
}
}
};
}, 4000);//3秒后执行Runnable中的run方法
@Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) {
Log.e("ry", "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
mPkUid = pkUid;
mPkhead = pkhead;
mPkname = pkname;
mIsLadders = isLadders;
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法
}
}
@ -823,6 +846,13 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 打开聊天输入框
*/
public void openChatWindow() {
// if (mKeyBoardHeightUtil == null) {
// mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this);
// mKeyBoardHeightUtil.start();
// }
// if (mLiveRoomViewHolder != null) {
// mLiveRoomViewHolder.chatScrollToBottom();
// }
LiveInputDialogFragment fragment = new LiveInputDialogFragment();
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice);
@ -1147,21 +1177,12 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCoinChangeEvent(CoinChangeEvent e) {
if (e.isResetProfilePicture()) {
mPkUid = null;
mPkhead = null;
mPkname = null;
mIsLadders = null;
linkMicPkStartHandler.removeCallbacks(linkMicPkStartRunnable);
} else {
onCoinChanged(e.getCoin());
if (e.isChargeSuccess() && this instanceof LiveAudienceActivity) {
((LiveAudienceActivity) this).onChargeSuccess();
}
}
}
public void onCoinChanged(String coin) {
}

View File

@ -8,6 +8,7 @@ import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.OpenParametersModel;
public class LiveAudienceEvent extends BaseModel {
@ -29,6 +30,16 @@ public class LiveAudienceEvent extends BaseModel {
private String uid;
private int time;
private CustomFullServiceNotifyEvent customFullServiceNotifyEvent;
private LivePKUserListBean livePKUserListBean;
public LivePKUserListBean getLivePKUserListBean() {
return livePKUserListBean;
}
public LiveAudienceEvent setLivePKUserListBean(LivePKUserListBean livePKUserListBean) {
this.livePKUserListBean = livePKUserListBean;
return this;
}
public CustomFullServiceNotifyEvent getCustomFullServiceNotifyEvent() {
return customFullServiceNotifyEvent;

View File

@ -236,7 +236,7 @@ public class LiveLinkMicPkViewHolder extends AbsViewHolder {
animationDrawable.start();
}
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_UPDATE_HEAD_DATA).setObject(bean));
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.PK_TWO_UPDATE_HEAD_DATA).setLivePKUserListBean(bean));
}
private void changeLine(float nowIndex, long leftGift, long rightGift) {

View File

@ -45,12 +45,15 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveRyAnchorActivity;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.momo.TencentTRTCBeautyManager;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketSendBean;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.List;
@ -327,6 +330,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
}
mLiveRyLinkMicPkPresenter.onLinkMicToPk(userBean1);
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(inviteeRoomId, 3);
EventBus.getDefault().post(new LiveAudienceEvent().setType(LiveAudienceEvent.LiveAudienceType.UP_PK_TWO));
}
}
});

View File

@ -1103,7 +1103,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 重置该隐藏的view
*/
public void resetViewGone() {
EventBus.getDefault().post(new CoinChangeEvent().setResetProfilePicture(true));
goto_room_view.setVisibility(View.GONE);
mPkRankTopIcon.setVisibility(View.GONE);
lt_pk_line.setVisibility(View.GONE);
@ -1887,23 +1886,31 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
//头像显示
public void setHeadData(LivePKUserListBean bean) {
if (bean == null) return;
Log.e("更新礼物进度", bean.toString());
livePKUserListBean = bean;
String mLiveuid = LiveRoomViewHolder.mLiveUid;
if (livePKUserListBean != null) {
if (!lt_pk_line.isShown()) {
UpPkTwo();
if (lt_pk_line.getVisibility() == View.GONE) {
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams();
params.height = mScreenWdith * 720 / 1120;
lt_pk_line.requestLayout();
lt_pk_line.setVisibility(View.VISIBLE);
}
Boolean idB = true;
if (livePKUserListBean.getRed_one() != null && livePKUserListBean.getBlue_one() != null) {
if (mLiveuid.equals(livePKUserListBean.getRed_one().getLiveuid())) {
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getRed_one().getImg(), avatar_l1);
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getBlue_one().getImg(), avatar_r1);
ImgLoader.display2(mContext, livePKUserListBean.getRed_one().getImg(), avatar_l1);
ImgLoader.display2(mContext, livePKUserListBean.getBlue_one().getImg(), avatar_r1);
uidL1 = livePKUserListBean.getRed_one().getUid();
uidR1 = livePKUserListBean.getBlue_one().getUid();
idB = true;
} else {
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getRed_one().getImg(), avatar_r1);
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getBlue_one().getImg(), avatar_l1);
ImgLoader.display2(mContext, livePKUserListBean.getRed_one().getImg(), avatar_r1);
ImgLoader.display2(mContext, livePKUserListBean.getBlue_one().getImg(), avatar_l1);
uidR1 = livePKUserListBean.getRed_one().getUid();
uidL1 = livePKUserListBean.getBlue_one().getUid();
idB = false;
@ -1911,35 +1918,38 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
if (livePKUserListBean.getRed_two() != null && livePKUserListBean.getBlue_two() != null) {
if (idB) {
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getRed_two().getImg(), avatar_l2);
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getBlue_two().getImg(), avatar_r2);
ImgLoader.display2(mContext, livePKUserListBean.getRed_two().getImg(), avatar_l2);
ImgLoader.display2(mContext, livePKUserListBean.getBlue_two().getImg(), avatar_r2);
uidL2 = livePKUserListBean.getRed_two().getUid();
uidR2 = livePKUserListBean.getBlue_two().getUid();
} else {
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getRed_two().getImg(), avatar_r2);
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getBlue_two().getImg(), avatar_l2);
ImgLoader.display2(mContext, livePKUserListBean.getRed_two().getImg(), avatar_r2);
ImgLoader.display2(mContext, livePKUserListBean.getBlue_two().getImg(), avatar_l2);
uidR2 = livePKUserListBean.getRed_two().getUid();
uidL2 = livePKUserListBean.getBlue_two().getUid();
}
}
if (livePKUserListBean.getRed_three() != null && livePKUserListBean.getBlue_three() != null) {
if (idB) {
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getRed_three().getImg(), avatar_l3);
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getBlue_three().getImg(), avatar_r3);
ImgLoader.display2(mContext, livePKUserListBean.getRed_three().getImg(), avatar_l3);
ImgLoader.display2(mContext, livePKUserListBean.getBlue_three().getImg(), avatar_r3);
uidL3 = livePKUserListBean.getRed_three().getUid();
uidR3 = livePKUserListBean.getBlue_three().getUid();
} else {
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getRed_three().getImg(), avatar_r3);
ImgLoader.display2((LiveActivity) Contexts, livePKUserListBean.getBlue_three().getImg(), avatar_l3);
ImgLoader.display2(mContext, livePKUserListBean.getRed_three().getImg(), avatar_r3);
ImgLoader.display2(mContext, livePKUserListBean.getBlue_three().getImg(), avatar_l3);
uidR3 = livePKUserListBean.getRed_three().getUid();
uidL3 = livePKUserListBean.getBlue_three().getUid();
}
}
} else {
UpPkTwo();
}
}
//双人pk显示
public void UpPkTwo() {
if (lt_pk_line.getVisibility() == View.VISIBLE) return;
ScreenDimenUtil util = ScreenDimenUtil.getInstance();
int mScreenWdith = util.getScreenWdith();
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) lt_pk_line.getLayoutParams();
@ -1949,12 +1959,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
lt_pk_line.setVisibility(View.VISIBLE);
img_pk_fist_l.setBackgroundResource(R.mipmap.icon_red_no1);
img_pk_fist_r.setBackgroundResource(R.mipmap.icon_blue_no1);
ImgLoader.display2(mContext, R.mipmap.icon_sofa_red, avatar_l1);
ImgLoader.display2(mContext, R.mipmap.icon_sofa_red, avatar_l2);
ImgLoader.display2((LiveActivity) Contexts, R.mipmap.icon_sofa_red, avatar_l3);
ImgLoader.display2((LiveActivity) Contexts, R.mipmap.icon_sofa_blue, avatar_r1);
ImgLoader.display2((LiveActivity) Contexts, R.mipmap.icon_sofa_blue, avatar_r2);
ImgLoader.display2((LiveActivity) Contexts, R.mipmap.icon_sofa_blue, avatar_r3);
avatar_l1.setImageResource(R.mipmap.icon_sofa_red);
avatar_l2.setImageResource(R.mipmap.icon_sofa_red);
avatar_l3.setImageResource(R.mipmap.icon_sofa_red);
avatar_r1.setImageResource(R.mipmap.icon_sofa_blue);
avatar_r2.setImageResource(R.mipmap.icon_sofa_blue);
avatar_r3.setImageResource(R.mipmap.icon_sofa_blue);
uidL1 = "";
uidL2 = "";
@ -3804,7 +3814,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
updatePkRank((PkRankBean) event.getObject());
break;
case PK_TWO_UPDATE_HEAD_DATA:
setHeadData((LivePKUserListBean) event.getObject());
setHeadData( event.getLivePKUserListBean());
break;
case PK_TWO_START:
pkUid = event.getObject().toString();

View File

@ -40,7 +40,6 @@ import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.LiveFloatEvent;
import com.yunbao.common.glide.ImgLoader;
@ -307,6 +306,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
});
mLiveRoomViewHolder.resetView();
linkMicPkStartHandler.removeCallbacks(linkMicPkStartRunnable);
mLiveRoomViewHolder.setAvatar(data.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(data.getLevelAnchor());
mLiveRoomViewHolder.setName(data.getUserNiceName());
@ -1215,25 +1215,37 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
@Override
public void onLinkMicPkStart(String pkUid, String pkhead, String pkname, String isLadders) {
System.out.println("PK测试 pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
/**
* 主播与主播PK 所有人收到PK开始的回调
*/
private String mPkUid, mPkhead, mPkname, mIsLadders;
private Handler linkMicPkStartHandler = new Handler();
private Runnable linkMicPkStartRunnable = new Runnable() {
@Override
public void run() {
if (mLiveRoomViewHolder != null) {
Log.e("tasdsdg", liveID + "1111" + CommonAppConfig.getInstance().getUid());
if (!liveID.equals(CommonAppConfig.getInstance().getUid())) {
mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
mLiveRoomViewHolder.initPkRank(isLadders);
mLiveRoomViewHolder.setOtherInfo(mPkUid, mPkhead, mPkname);
mLiveRoomViewHolder.initPkRank(mIsLadders);
}
}
}
}, 4000);//3秒后执行Runnable中的run方法
};
@Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) {
Log.e("ry", "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
mPkUid = pkUid;
mPkhead = pkhead;
mPkname = pkname;
mIsLadders = isLadders;
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法
}
if (mLivePlayViewHolder != null) {
mLivePlayViewHolder.setLiveBeanLandscape(1);