修复:上下滑动直播间,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 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;
@ -19,6 +33,7 @@ public class CoinChangeEvent {
this.coin = coin;
this.chargeSuccess = chargeSuccess;
}
public CoinChangeEvent(String coin, String goldCoinNum, boolean chargeSuccess) {
this.coin = coin;
this.goldCoinNum = goldCoinNum;

View File

@ -152,6 +152,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected TreeMap<String, LinkMicUserBean> mMicQueueList = new TreeMap<>();
protected List<LiveUserGiftBean> mAudienceList = new ArrayList<>();
protected LiveMicAnchorDialogFragment.OnMicListener micListener = null;
@Override
protected void main() {
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);
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
@ -222,17 +211,9 @@ 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);
// }
}
}
}
@ -633,23 +614,13 @@ 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);
}
@ -703,25 +674,33 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
/**
* 主播与主播PK 所有人收到PK开始的回调
*/
@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);
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
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(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方法
}
}
@ -844,13 +823,6 @@ 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);
@ -1175,12 +1147,21 @@ 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) {
}
@ -1592,6 +1573,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}
});
}
@Override
protected void onDestroy() {
release();

View File

@ -79,6 +79,7 @@ import com.yunbao.common.bean.RewardAllModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.TaskModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.event.CoinChangeEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
@ -1102,6 +1103,7 @@ 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);