修复:上下滑动直播间,Pk头像展示在不PK得房间的情况

This commit is contained in:
18401019693 2022-12-13 16:56:06 +08:00
parent b804c20ba0
commit d1e1f5f4e8
4 changed files with 56 additions and 57 deletions

View File

@ -10,6 +10,20 @@ public class CoinChangeEvent {
private String coin; private String coin;
private String goldCoinNum; private String goldCoinNum;
private boolean chargeSuccess; 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) { public CoinChangeEvent(String coin) {
this.coin = coin; this.coin = coin;
@ -19,7 +33,8 @@ public class CoinChangeEvent {
this.coin = coin; this.coin = coin;
this.chargeSuccess = chargeSuccess; this.chargeSuccess = chargeSuccess;
} }
public CoinChangeEvent(String coin,String goldCoinNum, boolean chargeSuccess) {
public CoinChangeEvent(String coin, String goldCoinNum, boolean chargeSuccess) {
this.coin = coin; this.coin = coin;
this.goldCoinNum = goldCoinNum; this.goldCoinNum = goldCoinNum;
this.chargeSuccess = chargeSuccess; this.chargeSuccess = chargeSuccess;

View File

@ -152,6 +152,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected TreeMap<String, LinkMicUserBean> mMicQueueList = new TreeMap<>(); protected TreeMap<String, LinkMicUserBean> mMicQueueList = new TreeMap<>();
protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>(); protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
protected LiveMicAnchorDialogFragment.OnMicListener micListener = null; protected LiveMicAnchorDialogFragment.OnMicListener micListener = null;
@Override @Override
protected void main() { protected void main() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@ -160,18 +161,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mPageContainer = findViewById(R.id.page_container); mPageContainer = findViewById(R.id.page_container);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
mDialogFragmentSet = new HashSet<>(); 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 @Override
@ -222,17 +211,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
if (!mFirstConnectSocket) { if (!mFirstConnectSocket) {
mFirstConnectSocket = true; mFirstConnectSocket = true;
if (mLiveType == Constants.LIVE_TYPE_PAY || mLiveType == Constants.LIVE_TYPE_TIME) { 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); SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, mLiveTypeVal, 1);
// }
} }
// if (isRy == false) {
// SocketChatUtil.getFakeFans(mLiveUid);
// } else {
SocketRyChatUtil.getFakeFans(mLiveUid); SocketRyChatUtil.getFakeFans(mLiveUid);
// }
} }
} }
} }
@ -633,23 +614,13 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
@Override @Override
public void onLinkMicAnchorClose() { public void onLinkMicAnchorClose() {
// if (isRy == false) {
// if (mLiveLinkMicAnchorPresenter != null) {
// mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
// }
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkClose(1);
// }
// } else {
if (mLiveLinkMicAnchorPresenter != null) { if (mLiveLinkMicAnchorPresenter != null) {
mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose(); mLiveLinkMicAnchorPresenter.onLinkMicAnchorClose();
} }
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1); mLiveRyLinkMicPkPresenter.onLinkMicPkClose(1);
} }
// }
if (this instanceof LiveAudienceActivity) { if (this instanceof LiveAudienceActivity) {
((LiveAudienceActivity) this).onLinkMicTxAnchor(false); ((LiveAudienceActivity) this).onLinkMicTxAnchor(false);
} }
@ -703,25 +674,33 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
/** /**
* 主播与主播PK 所有人收到PK开始的回调 * 主播与主播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", mLiveUid + "1111" + CommonAppConfig.getInstance().getUid());
if (!mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
mLiveRoomViewHolder.setOtherInfo(mPkUid, mPkhead, mPkname);
mLiveRoomViewHolder.initPkRank(mIsLadders);
}
}
}
};
@Override @Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname, String isLadders) { 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); Log.e("ry", "pkUid = " + pkUid + ", pkhead = " + pkhead + ", pkname = " + pkname + ", isLadders = " + isLadders);
mPkUid = pkUid;
mPkhead = pkhead;
mPkname = pkname;
mIsLadders = isLadders;
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) { if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1); mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler(); linkMicPkStartHandler.postDelayed(linkMicPkStartRunnable, 4000);//3秒后执行Runnable中的run方法
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(pkUid, pkhead, pkname);
mLiveRoomViewHolder.initPkRank(isLadders);
}
}
}
}, 4000);//3秒后执行Runnable中的run方法
} }
} }
@ -844,13 +823,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 打开聊天输入框 * 打开聊天输入框
*/ */
public void openChatWindow() { 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(); LiveInputDialogFragment fragment = new LiveInputDialogFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice); bundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice);
@ -1175,10 +1147,19 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/ */
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onCoinChangeEvent(CoinChangeEvent e) { public void onCoinChangeEvent(CoinChangeEvent e) {
onCoinChanged(e.getCoin()); if (e.isResetProfilePicture()) {
if (e.isChargeSuccess() && this instanceof LiveAudienceActivity) { mPkUid = null;
((LiveAudienceActivity) this).onChargeSuccess(); 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) { public void onCoinChanged(String coin) {
@ -1576,7 +1557,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
/** /**
* 获取连麦列表 * 获取连麦列表
*/ */
public void showMicList(String uid,LiveRoomViewHolder mLiveRoomViewHolder) { public void showMicList(String uid, LiveRoomViewHolder mLiveRoomViewHolder) {
LiveNetManager.get(mContext) LiveNetManager.get(mContext)
.getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback<List<LinkMicUserBean>>() { .getDRMicUserList(uid, new com.yunbao.common.http.base.HttpCallback<List<LinkMicUserBean>>() {
@Override @Override
@ -1592,6 +1573,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
} }
}); });
} }
@Override @Override
protected void onDestroy() { protected void onDestroy() {
release(); release();

View File

@ -79,6 +79,7 @@ import com.yunbao.common.bean.RewardAllModel;
import com.yunbao.common.bean.StarChallengeStatusModel; import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.TaskModel;
import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.CoinChangeEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent; import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API; import com.yunbao.common.http.API;
@ -1102,6 +1103,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
* 重置该隐藏的view * 重置该隐藏的view
*/ */
public void resetViewGone() { public void resetViewGone() {
EventBus.getDefault().post(new CoinChangeEvent().setResetProfilePicture(true));
goto_room_view.setVisibility(View.GONE); goto_room_view.setVisibility(View.GONE);
mPkRankTopIcon.setVisibility(View.GONE); mPkRankTopIcon.setVisibility(View.GONE);
lt_pk_line.setVisibility(View.GONE); lt_pk_line.setVisibility(View.GONE);