修改名称。
This commit is contained in:
@@ -0,0 +1,691 @@
|
||||
package com.xscm.moduleutil.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.base.RoomRollModel;
|
||||
import com.xscm.moduleutil.bean.FaceBean;
|
||||
import com.xscm.moduleutil.bean.room.ClosePhone;
|
||||
import com.xscm.moduleutil.bean.room.RoomClearCardiacAllModel;
|
||||
import com.xscm.moduleutil.bean.room.RoomClearCardiacModel;
|
||||
import com.xscm.moduleutil.bean.room.RoomClosePitModel;
|
||||
import com.xscm.moduleutil.bean.room.RoomCountDownModel;
|
||||
import com.xscm.moduleutil.bean.room.RoomDownWheatModel;
|
||||
import com.xscm.moduleutil.bean.room.RoomGiveGiftModel;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomWheatModel;
|
||||
import com.xscm.moduleutil.event.RoomBanWheatEvent;
|
||||
import com.xscm.moduleutil.event.RoomBeckoningEvent;
|
||||
import com.xscm.moduleutil.event.RoomFaceEvent;
|
||||
import com.xscm.moduleutil.interfaces.IBaseWheat;
|
||||
import com.xscm.moduleutil.interfaces.SoundLevelUpdateListener;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public abstract class BaseWheatView extends ConstraintLayout implements IBaseWheat {
|
||||
public ImageView mRiv;
|
||||
public ImageView mIvGift;
|
||||
public WheatCharmView mCharmView;
|
||||
public TextView mTvName;
|
||||
public ImageView mIvSex;
|
||||
public AvatarFrameView mIvFrame;
|
||||
public SVGAImageView mIvRipple;
|
||||
public ExpressionImgView mIvFace;
|
||||
public ImageView mIvShutup;
|
||||
public TextView tvTime;
|
||||
public TextView mTvNo;
|
||||
|
||||
public TextView tv_time_pk;
|
||||
|
||||
public RoomPitBean pitBean;//麦位数据
|
||||
public String roomId;//房间id
|
||||
|
||||
CountDownTimer mCountDownTimer;
|
||||
|
||||
public static final String WHEAT_BOSS = "8";//老板位
|
||||
|
||||
public static final String WHEAT_HOST = "9";//主持位
|
||||
|
||||
public float oX;
|
||||
public float oY;
|
||||
|
||||
boolean closePhone = false;//自己麦位关闭话筒,用于判断声纹显示
|
||||
|
||||
public String pitNumber;
|
||||
public int pitImageVId;
|
||||
|
||||
public ImageView iv_on_line;
|
||||
private boolean showGiftAnim = true;//显示麦位动画
|
||||
private ImageView iv_tag_type;
|
||||
|
||||
private TextView tv_zhul;
|
||||
|
||||
private SVGAParser parser = new SVGAParser(getContext());
|
||||
|
||||
|
||||
public BaseWheatView(Context context) {
|
||||
this(context, null, 0);
|
||||
}
|
||||
|
||||
public BaseWheatView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BaseWheatView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
inflate(context, getLayoutId(), this);
|
||||
mRiv = findViewById(R.id.riv);
|
||||
mIvGift = findViewById(R.id.iv_gift);
|
||||
mCharmView = findViewById(R.id.charm_view);
|
||||
mTvName = findViewById(R.id.tv_name);
|
||||
mIvSex = findViewById(R.id.iv_sex);
|
||||
mIvFrame = findViewById(R.id.iv_frame);
|
||||
mIvRipple = findViewById(R.id.iv_ripple);
|
||||
mIvFace = findViewById(R.id.iv_face);
|
||||
mIvShutup = findViewById(R.id.iv_shutup);
|
||||
tvTime = findViewById(R.id.tv_time);
|
||||
tv_time_pk = findViewById(R.id.tv_time_pk);
|
||||
mTvNo = findViewById(R.id.tv_no);
|
||||
iv_on_line = findViewById(R.id.iv_online);/**/
|
||||
iv_tag_type = findViewById(R.id.iv_tag_type);
|
||||
tv_zhul = findViewById(R.id.tv_zhul);
|
||||
setClipChildren(false);
|
||||
setClipToPadding(false);
|
||||
oX = mIvGift.getX();
|
||||
oY = mIvGift.getY();
|
||||
initPit(context, attrs);
|
||||
}
|
||||
|
||||
protected abstract void initPit(Context context, AttributeSet attrs);
|
||||
|
||||
protected abstract int getLayoutId();
|
||||
|
||||
protected abstract void setPitData(RoomPitBean bean);
|
||||
|
||||
protected float getTzbl() {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
private @DrawableRes int mOriginImage = 0;
|
||||
private @DrawableRes int mOriginNoImage = 0;
|
||||
|
||||
public @DrawableRes int getOriginImage() {
|
||||
return mOriginImage;
|
||||
}
|
||||
|
||||
public @DrawableRes int getOriginNoImage() {
|
||||
return mOriginNoImage;
|
||||
}
|
||||
|
||||
public void setImageResource(@DrawableRes int image, @DrawableRes int noImage, CharSequence no) {
|
||||
mOriginImage = image;
|
||||
mOriginNoImage = noImage;
|
||||
mRiv.setImageResource(mOriginImage);
|
||||
if (mTvNo != null) {
|
||||
mTvNo.setText(no);
|
||||
mTvNo.setBackgroundResource(mOriginNoImage);
|
||||
mTvNo.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置麦位数据
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
|
||||
public void setData(RoomPitBean bean) {
|
||||
if (!pitNumber.equals(bean.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
this.pitBean = bean;
|
||||
this.roomId = bean.getRoom_id();
|
||||
countDownTime(bean.getCount_down());
|
||||
|
||||
setCardiac(pitBean.getCharm(), getTzbl());
|
||||
|
||||
if (bean.getUser_id() != null && !bean.getUser_id().equals("0") && !bean.getUser_id().isEmpty()) {
|
||||
if (CommonAppContext.getInstance().getOnlineMap() != null && CommonAppContext.getInstance().getOnlineMap().get(bean.getUser_id()) != null) {
|
||||
iv_on_line.setVisibility(CommonAppContext.getInstance().getOnlineMap().get(bean.getUser_id()) == 1 ? GONE : VISIBLE);
|
||||
} else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
|
||||
|
||||
parser.decodeFromAssets("ripple3695.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@Nullable SVGAVideoEntity videoItem) {
|
||||
if (videoItem != null) {
|
||||
mIvRipple.setVideoItem(videoItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Log.e("SVGA", "解析 ripple.svga 失败");
|
||||
}
|
||||
});
|
||||
|
||||
setPitData(bean);
|
||||
|
||||
//心动值
|
||||
//显示心动
|
||||
if ("1".equals(pitBean.getShutup())) {
|
||||
mIvShutup.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mIvShutup.setVisibility(GONE);
|
||||
}
|
||||
|
||||
//自动调节麦位波纹
|
||||
if (mIvRipple != null) {
|
||||
mIvRipple.setScaleX(1.1f);
|
||||
mIvRipple.setScaleY(1.1f);
|
||||
}
|
||||
if (pitNumber.equals("9")) {
|
||||
iv_tag_type.setImageResource(R.mipmap.zc);
|
||||
if (mRiv.getLayoutParams() instanceof ConstraintLayout.LayoutParams) {
|
||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mRiv.getLayoutParams();
|
||||
params.matchConstraintPercentWidth = 0.66f; // 设置为 52%
|
||||
params.width = 0; // 必须设为 0dp(MATCH_CONSTRAINT)
|
||||
mRiv.setLayoutParams(params);
|
||||
}
|
||||
} else if (pitNumber.equals("10")) {
|
||||
iv_tag_type.setImageResource(R.mipmap.jb);
|
||||
if (mRiv.getLayoutParams() instanceof ConstraintLayout.LayoutParams) {
|
||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mRiv.getLayoutParams();
|
||||
params.matchConstraintPercentWidth = 0.66f; // 设置为 52%
|
||||
params.width = 0; // 必须设为 0dp(MATCH_CONSTRAINT)
|
||||
mRiv.setLayoutParams(params);
|
||||
}
|
||||
} else if (pitNumber.equals("-1")) {
|
||||
iv_tag_type.setImageResource(R.mipmap.mu_yc);
|
||||
if (mRiv.getLayoutParams() instanceof ConstraintLayout.LayoutParams) {
|
||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mRiv.getLayoutParams();
|
||||
params.matchConstraintPercentWidth = 0.66f; // 设置为 52%
|
||||
params.width = 0; // 必须设为 0dp(MATCH_CONSTRAINT)
|
||||
mRiv.setLayoutParams(params);
|
||||
}
|
||||
} else if (pitNumber.equals("0")) {
|
||||
iv_tag_type.setVisibility(GONE);
|
||||
mIvShutup.setVisibility(VISIBLE);
|
||||
} else if (pitNumber.equals("888")) {
|
||||
iv_tag_type.setVisibility(GONE);
|
||||
mIvShutup.setVisibility(GONE);
|
||||
} else {
|
||||
iv_tag_type.setVisibility(GONE);
|
||||
}
|
||||
AgoraManager.getInstance(getContext()).addSoundLevelListener(new SoundLevelUpdateListener() {
|
||||
@Override
|
||||
public void onRemoteSoundLevelUpdate(String userId, int soundLevel) {
|
||||
if (mIvRipple == null)
|
||||
return;
|
||||
|
||||
if (userId.equals(pitBean.getUser_id())) {
|
||||
if (soundLevel == 0) {
|
||||
mIvRipple.pauseAnimation();
|
||||
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(), 1);
|
||||
mIvRipple.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mIvRipple.startAnimation();
|
||||
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(), 1);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalSoundLevelUpdate(int volume) {
|
||||
if (mIvRipple == null)
|
||||
return;
|
||||
if (volume == 0) {
|
||||
mIvRipple.setVisibility(GONE);
|
||||
} else {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(), 1);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userJoined(int userId, int elapsd) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOffline(int userId, int reason) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void setCharm(String charm) {
|
||||
mCharmView.setSex(pitBean.getSex(), pitBean.getUser_id(), charm, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始倒计时
|
||||
*
|
||||
* @param time
|
||||
*/
|
||||
public void countDownTime(int time) {
|
||||
try {
|
||||
if (time <= 0) {
|
||||
setTime(0);
|
||||
|
||||
releaseCountDownTimer();
|
||||
return;
|
||||
}
|
||||
releaseCountDownTimer();
|
||||
mCountDownTimer = new CountDownTimer(time * 1000L, 1000L) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int time1 = (int) (millisUntilFinished / 1000);
|
||||
pitBean.setCount_down(time1);
|
||||
setTime(time1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
setTime(0);
|
||||
}
|
||||
};
|
||||
mCountDownTimer.start();
|
||||
} catch (Exception e) {
|
||||
Logger.e("countDownTime", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTime(int time) {
|
||||
if (time == 0) {
|
||||
tvTime.setText("");
|
||||
tvTime.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
tvTime.setText(String.format("%s'%s", time / 60, time % 60));
|
||||
tvTime.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnlineStatus() {
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (CommonAppContext.getInstance().getOnlineMap() != null && CommonAppContext.getInstance().getOnlineMap().get(pitBean.getUser_id()) != null) {
|
||||
iv_on_line.setVisibility(CommonAppContext.getInstance().getOnlineMap().get(pitBean.getUser_id()) == 1 ? GONE : VISIBLE);
|
||||
} else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
showGiftAnim = true;
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
showGiftAnim = false;
|
||||
releaseCountDownTimer();
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放倒计时
|
||||
*/
|
||||
private void releaseCountDownTimer() {
|
||||
if (mCountDownTimer != null) {
|
||||
mCountDownTimer.cancel();
|
||||
mCountDownTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 麦位是否有人
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isOn() {
|
||||
return pitBean != null && !TextUtils.isEmpty(pitBean.getUser_id()) && !"0".equals(pitBean.getUser_id());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示麦位礼物动画
|
||||
*
|
||||
* @param listBean
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void showGift(RoomGiveGiftModel.GiftListBean listBean) {
|
||||
if (!showGiftAnim) {
|
||||
mIvGift.setVisibility(GONE);
|
||||
return;
|
||||
}
|
||||
if (listBean.getUser_id() == null || !listBean.getUser_id().equals(pitBean.getUser_id())) {
|
||||
return;
|
||||
}
|
||||
WheatGiftAnim.addGift(mIvGift, listBean.getPicture());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置心动值
|
||||
*
|
||||
* @param rough_number
|
||||
*/
|
||||
@Override
|
||||
public void setCardiac(String rough_number, float bl) {
|
||||
if (mCharmView != null) {
|
||||
pitBean.setCharm((rough_number != null && !rough_number.isEmpty()) ? rough_number : "0");
|
||||
if (pitBean.getUser_id() == null || pitBean.getUser_id().equals("0") || pitBean.getUser_id().equals("")) {
|
||||
mCharmView.setSex(pitBean.getSex(), pitBean.getUser_id(), pitBean.getCharm(), false);
|
||||
} else {
|
||||
mCharmView.setVisibility(VISIBLE);
|
||||
mCharmView.setSex(pitBean.getSex(), pitBean.getUser_id(), pitBean.getCharm(), false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空心动值
|
||||
*/
|
||||
@Override
|
||||
public void clearCardiac() {
|
||||
if (mCharmView != null) {
|
||||
pitBean.setCharm("0");
|
||||
mCharmView.setSex(pitBean.getSex(), pitBean.getUser_id(), pitBean.getCharm(), true);
|
||||
}
|
||||
}
|
||||
|
||||
public int getCardiac() {
|
||||
if (pitBean == null) {
|
||||
return 0;
|
||||
} else {
|
||||
try {
|
||||
return Integer.parseInt(pitBean.getCharm());
|
||||
} catch (Throwable e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
return pitBean.getUser_id();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Object obj) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegister(Object obj) {
|
||||
AgoraManager.getInstance(getContext()).removeSoundLevelListener(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 心动值显示开关
|
||||
*
|
||||
* @param roomBeckoningEvent
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomBeckoningEvent roomBeckoningEvent) {
|
||||
if (roomId != null && roomId.equals(roomBeckoningEvent.getRoomId())) {
|
||||
mCharmView.setVisibility(roomBeckoningEvent.isOpen() ? VISIBLE : INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 心动值变化
|
||||
*
|
||||
* @param cardiacListBean
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomGiveGiftModel.CardiacListBean cardiacListBean) {
|
||||
if (!roomId.equals(cardiacListBean.getRoom_id())) {
|
||||
return;
|
||||
}
|
||||
if (this.pitNumber.equals(cardiacListBean.getPit_number())) {
|
||||
this.setCardiac(cardiacListBean.getXin_dong(), getTzbl());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空单个麦位心动值
|
||||
*
|
||||
* @param roomClearCardiacModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomClearCardiacModel roomClearCardiacModel) {
|
||||
if (!roomId.equals(roomClearCardiacModel.getRoom_id())) {
|
||||
return;
|
||||
}
|
||||
if (this.pitNumber.equals(roomClearCardiacModel.getPit_number())) {
|
||||
clearCardiac();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 清空所有心动值
|
||||
*
|
||||
* @param roomClearCardiacAllModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomClearCardiacAllModel roomClearCardiacAllModel) {
|
||||
if (!roomId.equals(roomClearCardiacAllModel.getRoom_id())) {
|
||||
return;
|
||||
}
|
||||
clearCardiac();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上麦
|
||||
*
|
||||
* @param roomWheatModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomWheatModel roomWheatModel) {
|
||||
if (!roomId.equals(roomWheatModel.getRoom_id()) || !pitNumber.equals(roomWheatModel.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
pitBean.setNickname(roomWheatModel.getNickname());
|
||||
pitBean.setHead_picture(roomWheatModel.getHead_picture());
|
||||
pitBean.setBanned(roomWheatModel.getBanned());
|
||||
pitBean.setUser_id(roomWheatModel.getUser_id());
|
||||
pitBean.setDress_picture(roomWheatModel.getDress_picture());
|
||||
pitBean.setSex(roomWheatModel.getSex());
|
||||
pitBean.setBall_state(roomWheatModel.getBall_state());
|
||||
pitBean.setPit_number(roomWheatModel.getPit_number());
|
||||
pitBean.setCharm(roomWheatModel.getXin_dong());
|
||||
setData(pitBean);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下麦
|
||||
*
|
||||
* @param roomDownWheatModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomDownWheatModel roomDownWheatModel) {
|
||||
if (!roomId.equals(roomDownWheatModel.getRoom_id()) || !pitNumber.equals(roomDownWheatModel.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
closePhone = SpUtil.getUserId() == roomDownWheatModel.getUser_id();
|
||||
pitBean.setUser_id("0");
|
||||
pitBean.setPit_number(roomDownWheatModel.getPit_number());
|
||||
setData(pitBean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 倒计时
|
||||
*
|
||||
* @param roomCountDownModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomCountDownModel roomCountDownModel) {
|
||||
if (!roomId.equals(roomCountDownModel.getRoom_id()) || !pitNumber.equals(roomCountDownModel.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
pitBean.setCount_down(roomCountDownModel.getSeconds());
|
||||
countDownTime(roomCountDownModel.getSeconds());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 禁麦
|
||||
*
|
||||
* @param roomBanWheatEvent
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomBanWheatEvent roomBanWheatEvent) {
|
||||
if (!roomId.equals(roomBanWheatEvent.getRoomId()) || !pitNumber.equals(roomBanWheatEvent.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
pitBean.setShutup(roomBanWheatEvent.isBanWheat() ? "1" : "2");
|
||||
setData(pitBean);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁麦
|
||||
*
|
||||
* @param roomClosePitModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomClosePitModel roomClosePitModel) {
|
||||
if (!roomId.equals(roomClosePitModel.getRoom_id()) || !pitNumber.equals(roomClosePitModel.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
pitBean.setState(roomClosePitModel.getAction());
|
||||
//麦位上锁
|
||||
setData(pitBean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户关闭麦克风
|
||||
*
|
||||
* @param closePhone
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void subscribeMessages(ClosePhone closePhone) {
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId())) {
|
||||
this.closePhone = closePhone.isClosePhone();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦位是否被锁
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isLocked() {
|
||||
return "1".equals(pitBean.getIs_lock());
|
||||
}
|
||||
|
||||
public boolean isMute() {
|
||||
if (pitBean != null) {
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().isEmpty() && "1".equals(pitBean.getIs_mute())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 表情
|
||||
*
|
||||
* @param roomFaceEvent
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomFaceEvent roomFaceEvent) {
|
||||
if (!roomId.equals(roomFaceEvent.getRoom_id()) || !pitNumber.equals(roomFaceEvent.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIvFace.addData(new FaceBean(roomFaceEvent.getSpecial(), roomFaceEvent.getTime(), 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 抽签
|
||||
*
|
||||
* @param roomRollModel
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@Override
|
||||
public void subscribeMessages(RoomRollModel roomRollModel) {
|
||||
if (!roomId.equals(roomRollModel.getRoom_id()) || !pitNumber.equals(roomRollModel.getPit_number())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mIvFace.addData(new FaceBean(roomRollModel.getNumber(), 2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否主持
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isHost() {
|
||||
return WHEAT_HOST.equals(pitNumber);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user