兼容幸运百分百活动

This commit is contained in:
zlzw 2023-01-10 15:34:40 +08:00
parent 749f756d58
commit 872245c9c9
7 changed files with 43 additions and 2 deletions

View File

@ -939,6 +939,7 @@ Limited ride And limited avatar frame</string>
<string name="in_batch">In a batch</string> <string name="in_batch">In a batch</string>
<string name="chat_chat">Chat</string> <string name="chat_chat">Chat</string>
<string name="lucky_angel" >Congratulations %s have won %s in the Lucky Angel! The next lucky angel will be you!</string> <string name="lucky_angel" >Congratulations %s have won %s in the Lucky Angel! The next lucky angel will be you!</string>
<string name="lucky_100" >Congratulations on %s winning %s in Luck 100 %! Go pass on the good luck!</string>
<string name="user_card_guard" >Guardian group %s people</string> <string name="user_card_guard" >Guardian group %s people</string>
<string name="to_receive" >receive</string> <string name="to_receive" >receive</string>
<string name="to_complete" >To complete</string> <string name="to_complete" >To complete</string>

View File

@ -959,6 +959,7 @@
<string name="chat_chat">聊聊天</string> <string name="chat_chat">聊聊天</string>
<string name="want_pre">想在其他APP上方也顯示小窗\n可前往設置進行授權。</string> <string name="want_pre">想在其他APP上方也顯示小窗\n可前往設置進行授權。</string>
<string name="lucky_angel" >恭喜 %s 在幸運天使中抽中 %s下一個幸運天使就是你哦</string> <string name="lucky_angel" >恭喜 %s 在幸運天使中抽中 %s下一個幸運天使就是你哦</string>
<string name="lucky_100" >恭喜 %s 在好運百分百中抽中 %s快去接力好運吧~</string>
<string name="user_card_guard" >守護團%s人</string> <string name="user_card_guard" >守護團%s人</string>
<string name="to_receive" >領取</string> <string name="to_receive" >領取</string>
<string name="to_complete" >去完成</string> <string name="to_complete" >去完成</string>

View File

@ -1179,9 +1179,11 @@ public class LiveAudienceActivity extends LiveActivity {
break; break;
case LUCKY_ANGEL: case LUCKY_ANGEL:
case LUCKY_100_CHECK:
manager.luckyAngel(event.getMsgModel()); manager.luckyAngel(event.getMsgModel());
break; break;
case LUCKY_100_CHECK:
manager.lucky100(event.getMsgModel());
break;
case LINK_MIC: case LINK_MIC:
if (!StringUtil.isEmpty(((LinkMicUserBean) event.getObject()).getUid())) { if (!StringUtil.isEmpty(((LinkMicUserBean) event.getObject()).getUid())) {
mMicQueueList.put(((LinkMicUserBean) event.getObject()).getUid(), (LinkMicUserBean) event.getObject()); mMicQueueList.put(((LinkMicUserBean) event.getObject()).getUid(), (LinkMicUserBean) event.getObject());

View File

@ -1,6 +1,7 @@
package com.yunbao.live.adapter; package com.yunbao.live.adapter;
import static com.yunbao.live.bean.LiveChatBean.AI_AUTOMATIC_SPEECH; import static com.yunbao.live.bean.LiveChatBean.AI_AUTOMATIC_SPEECH;
import static com.yunbao.live.bean.LiveChatBean.LUCKY_100_CHECK;
import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL; import static com.yunbao.live.bean.LiveChatBean.LUCKY_ANGEL;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY; import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY;
@ -378,7 +379,15 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
new LiveTextRender().luckyAngel(mContext, mTextView, bean.getMsgModel()); new LiveTextRender().luckyAngel(mContext, mTextView, bean.getMsgModel());
} }
} else { }else if(bean.getType() == LUCKY_100_CHECK){
if (!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())) {
bean.setId(bean.getMsgModel().getUserId());
itemView.setTag(bean);
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel());
}
}
else {
if (bean.getBubble() != null && !bean.getBubble().equals("")) { if (bean.getBubble() != null && !bean.getBubble().equals("")) {
//加载.9图聊天气泡 //加载.9图聊天气泡
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);

View File

@ -22,6 +22,7 @@ public class LiveChatBean {
public static final int AI_AUTOMATIC_SPEECH = 101; public static final int AI_AUTOMATIC_SPEECH = 101;
public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105; public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105;
public static final int LUCKY_ANGEL = 106;//幸运天使 public static final int LUCKY_ANGEL = 106;//幸运天使
public static final int LUCKY_100_CHECK = 107;//幸运天使

View File

@ -157,6 +157,22 @@ public class LiveTextRender {
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mTextView.setText(builder); mTextView.setText(builder);
} }
/**
* 幸运100%活动
*/
public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel){
String msg = mContext.getString(R.string.lucky_100);
msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName());
int unameIndexOf = msg.indexOf(msgModel.getUserName());
int giftIndexOf = msg.indexOf(msgModel.getGiftName());
int unameSize = msgModel.getUserName().length();
int giftSize = msgModel.getGiftName().length();
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append(msg);
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#78FEFF")), unameIndexOf, unameIndexOf + unameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mTextView.setText(builder);
}
public void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) { public void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() { ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() {

View File

@ -3904,6 +3904,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mLiveChatAdapter.insertItem(bean); mLiveChatAdapter.insertItem(bean);
} }
} }
/**
* 幸运100%活动
*/
public void lucky100(MsgModel model){
if (mLiveChatAdapter != null) {
LiveChatBean bean = new LiveChatBean();
bean.setType(LiveChatBean.LUCKY_100_CHECK);
bean.setMsgModel(model);
mLiveChatAdapter.insertItem(bean);
}
}
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void updateSub(LiveAudienceEvent event) { public void updateSub(LiveAudienceEvent event) {