星级挑战成功
This commit is contained in:
parent
db81f4556a
commit
88107b7ab5
@ -167,6 +167,7 @@ public class Constants {
|
|||||||
public static final String RECOMMEND_CARD_NOTIFY = "recommendCardNotify";//推荐卡通知消息
|
public static final String RECOMMEND_CARD_NOTIFY = "recommendCardNotify";//推荐卡通知消息
|
||||||
public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力
|
public static final String STAR_CHALLENGE_UPDATE = "starChallengeUpdate";//星级助力
|
||||||
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
|
public static final String AI_AUTOMATIC_SPEECH = "aiAutomaticSpeech";//机器人助手
|
||||||
|
public static final String STAR_CHALLENGE_UPGRADE_NOTIFY = "starChallengeUpgradeNotify";//星级挑战成功
|
||||||
|
|
||||||
//游戏socket
|
//游戏socket
|
||||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||||
|
@ -69,6 +69,21 @@ public class MsgModel extends BaseModel {
|
|||||||
@SerializedName("taskName2")
|
@SerializedName("taskName2")
|
||||||
private String taskName2;
|
private String taskName2;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 星级挑战成功IM消息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@SerializedName("ancherName")
|
||||||
|
private String ancherName;
|
||||||
|
@SerializedName("competitionArea")
|
||||||
|
private String competitionArea;
|
||||||
|
@SerializedName("star")
|
||||||
|
private String star;
|
||||||
|
@SerializedName("liveUid")
|
||||||
|
private String liveUid;
|
||||||
|
|
||||||
public String getTaskNum() {
|
public String getTaskNum() {
|
||||||
return taskNum;
|
return taskNum;
|
||||||
}
|
}
|
||||||
@ -276,4 +291,36 @@ public class MsgModel extends BaseModel {
|
|||||||
return roleType;
|
return roleType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAncherName() {
|
||||||
|
return ancherName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAncherName(String ancherName) {
|
||||||
|
this.ancherName = ancherName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompetitionArea() {
|
||||||
|
return competitionArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompetitionArea(String competitionArea) {
|
||||||
|
this.competitionArea = competitionArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStar() {
|
||||||
|
return star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStar(String star) {
|
||||||
|
this.star = star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLiveUid() {
|
||||||
|
return liveUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLiveUid(String liveUid) {
|
||||||
|
this.liveUid = liveUid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -924,6 +924,6 @@
|
|||||||
<string name="total_star_value">總星值</string>
|
<string name="total_star_value">總星值</string>
|
||||||
<string name="number_of_people_assisted">助力人數</string>
|
<string name="number_of_people_assisted">助力人數</string>
|
||||||
<string name="star_change">星级挑战%s</string>
|
<string name="star_change">星级挑战%s</string>
|
||||||
|
<string name="star_success">恭喜 %s,完成了%s %s星 挑戰,快去一睹主播芳容吧!</string>
|
||||||
|
<string name="star">星</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -849,6 +849,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
|||||||
case AI_AUTOMATIC_SPEECH:
|
case AI_AUTOMATIC_SPEECH:
|
||||||
manager.aiAutomaticSpeech(event.getAiAutomaticSpeechModel());
|
manager.aiAutomaticSpeech(event.getAiAutomaticSpeechModel());
|
||||||
break;
|
break;
|
||||||
|
case STAR_CHALLENGE_UPGRADE_NOTIFY:
|
||||||
|
manager.starChallengeUpgradeNotify(event.getMsgModel());
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ 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.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 android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -336,6 +337,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
//加载.9图聊天气泡
|
//加载.9图聊天气泡
|
||||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1);
|
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1);
|
||||||
LiveTextRender.aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel());
|
LiveTextRender.aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel());
|
||||||
|
} else if (bean.getType() == STAR_CHALLENGE_UPGRADE_NOTIFY) {
|
||||||
|
//加载.9图聊天气泡
|
||||||
|
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1);
|
||||||
|
LiveTextRender.starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel());
|
||||||
} else {
|
} else {
|
||||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||||
//加载.9图聊天气泡
|
//加载.9图聊天气泡
|
||||||
|
@ -19,6 +19,7 @@ public class LiveChatBean {
|
|||||||
public static final int RED_PACK = 5;
|
public static final int RED_PACK = 5;
|
||||||
public static final int RECOMMEND_CARD_NOTIFY = 10;
|
public static final int RECOMMEND_CARD_NOTIFY = 10;
|
||||||
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;
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String userNiceName;
|
private String userNiceName;
|
||||||
|
@ -147,6 +147,7 @@ public class LiveAudienceEvent extends BaseModel {
|
|||||||
AT_MESSAGE(24, "@消息"),
|
AT_MESSAGE(24, "@消息"),
|
||||||
START_MESSAGE(25, "星级消息"),
|
START_MESSAGE(25, "星级消息"),
|
||||||
AI_AUTOMATIC_SPEECH(26, "机器人助手"),
|
AI_AUTOMATIC_SPEECH(26, "机器人助手"),
|
||||||
|
STAR_CHALLENGE_UPGRADE_NOTIFY(27, "星级挑战成功")
|
||||||
;
|
;
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
@ -488,6 +488,16 @@ public class SocketRyClient {
|
|||||||
.setType(LiveAudienceEvent.LiveAudienceType.AI_AUTOMATIC_SPEECH)
|
.setType(LiveAudienceEvent.LiveAudienceType.AI_AUTOMATIC_SPEECH)
|
||||||
.setAiAutomaticSpeechModel(aiAutomaticSpeechModel));
|
.setAiAutomaticSpeechModel(aiAutomaticSpeechModel));
|
||||||
break;
|
break;
|
||||||
|
case Constants.STAR_CHALLENGE_UPGRADE_NOTIFY:
|
||||||
|
SocketModel starChallengeUpgradeNotify = GsonUtils.fromJson(socketMsg, SocketModel.class);
|
||||||
|
List<MsgModel> starChallengeUpgradeNotifyMsg = starChallengeUpgradeNotify.getMsg();
|
||||||
|
if (starChallengeUpgradeNotifyMsg.size() > 0) {
|
||||||
|
|
||||||
|
Bus.get().post(new LiveAudienceEvent()
|
||||||
|
.setType(LiveAudienceEvent.LiveAudienceType.STAR_CHALLENGE_UPGRADE_NOTIFY)
|
||||||
|
.setMsgModel(starChallengeUpgradeNotifyMsg.get(0)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import com.yunbao.common.CommonAppContext;
|
|||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||||
import com.yunbao.common.bean.LevelBean;
|
import com.yunbao.common.bean.LevelBean;
|
||||||
|
import com.yunbao.common.bean.MsgModel;
|
||||||
import com.yunbao.common.custom.VerticalImageSpan;
|
import com.yunbao.common.custom.VerticalImageSpan;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
@ -93,6 +94,28 @@ public class LiveTextRender {
|
|||||||
textView.setText(spannableString);
|
textView.setText(spannableString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 星级挑战成功Im消息
|
||||||
|
*
|
||||||
|
* @param activity
|
||||||
|
* @param textView
|
||||||
|
* @param model
|
||||||
|
*/
|
||||||
|
public static void starChallengeUpgradeNotify(Context activity, TextView textView, MsgModel model) {
|
||||||
|
String star = activity.getString(R.string.star);
|
||||||
|
String starString = String.format(activity.getString(R.string.star_success), model.getAncherName(), model.getCompetitionArea(), model.getStar());
|
||||||
|
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
|
||||||
|
star = model.getStar() + star;
|
||||||
|
int ancherNameStart = starString.indexOf(model.getAncherName());
|
||||||
|
int starStart = starString.indexOf(star);
|
||||||
|
spannableStringBuilder.append(starString);
|
||||||
|
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#6ffeff")),
|
||||||
|
ancherNameStart, ancherNameStart + model.getAncherName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#fcfe35")),
|
||||||
|
starStart, starStart + star.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
textView.setText(spannableStringBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
public static void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
|
public static void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
|
||||||
ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() {
|
ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -3267,6 +3267,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
bean.setAiAutomaticSpeechModel(model);
|
bean.setAiAutomaticSpeechModel(model);
|
||||||
mLiveChatAdapter.insertItem(bean);
|
mLiveChatAdapter.insertItem(bean);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 星级挑战成功
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
*/
|
||||||
|
public void starChallengeUpgradeNotify(MsgModel model) {
|
||||||
|
if (mLiveChatAdapter != null) {
|
||||||
|
LiveChatBean bean = new LiveChatBean();
|
||||||
|
bean.setType(LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY);
|
||||||
|
bean.setMsgModel(model);
|
||||||
|
mLiveChatAdapter.insertItem(bean);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1591,4 +1591,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRoomViewHolder.aiAutomaticSpeech(model);
|
mLiveRoomViewHolder.aiAutomaticSpeech(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 星级挑战成功
|
||||||
|
*
|
||||||
|
* @param msgModel
|
||||||
|
*/
|
||||||
|
public void starChallengeUpgradeNotify(MsgModel msgModel) {
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
mLiveRoomViewHolder.starChallengeUpgradeNotify(msgModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user