diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index fbe44671d..102cc792e 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -939,6 +939,7 @@ Limited ride And limited avatar frame In a batch Chat Congratulations %s have won %s in the Lucky Angel! The next lucky angel will be you! + Congratulations on %s winning %s in Luck 100 %! Go pass on the good luck! Guardian group %s people receive To complete diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 2c5c8b5e2..f3b7113f3 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -959,6 +959,7 @@ 聊聊天 想在其他APP上方也顯示小窗,\n可前往設置進行授權。 恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦! + 恭喜 %s 在好運百分百中抽中 %s!快去接力好運吧~ 守護團%s人 領取 去完成 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 4fdde22aa..462057ed5 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1179,9 +1179,11 @@ public class LiveAudienceActivity extends LiveActivity { break; case LUCKY_ANGEL: - case LUCKY_100_CHECK: manager.luckyAngel(event.getMsgModel()); break; + case LUCKY_100_CHECK: + manager.lucky100(event.getMsgModel()); + break; case LINK_MIC: if (!StringUtil.isEmpty(((LinkMicUserBean) event.getObject()).getUid())) { mMicQueueList.put(((LinkMicUserBean) event.getObject()).getUid(), (LinkMicUserBean) event.getObject()); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 12eee954f..6e5cb5312 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -1,6 +1,7 @@ package com.yunbao.live.adapter; 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.RECOMMEND_CARD_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()); } - } 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("")) { //加载.9图聊天气泡 LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1); diff --git a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java index 5a492399f..8d876699b 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveChatBean.java @@ -22,6 +22,7 @@ public class LiveChatBean { public static final int AI_AUTOMATIC_SPEECH = 101; public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105; public static final int LUCKY_ANGEL = 106;//幸运天使 + public static final int LUCKY_100_CHECK = 107;//幸运天使 diff --git a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java index 8699d194f..ba96ab4b9 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -157,6 +157,22 @@ public class LiveTextRender { builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 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) { ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() { diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 574dbf439..2c630a09f 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -3904,6 +3904,17 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis 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) public void updateSub(LiveAudienceEvent event) {