新增幸运女神通知
This commit is contained in:
parent
2eba951ad1
commit
c83db0ec77
@ -181,6 +181,7 @@ public class Constants {
|
||||
public static final String SOCKET_USEHOTCARD = "UseHotCard";//热度卡消息
|
||||
public static final String LOVE_CHECK = "LoveCheck";//热度卡消息
|
||||
public static final String TRUMPET_NOTIFY = "TrumpetNotify";//全栈喇叭
|
||||
public static final String LuckyAngel = "LuckyCheck";//幸运天使
|
||||
|
||||
public static final int SOCKET_WHAT_CONN = 0;
|
||||
public static final int SOCKET_WHAT_DISCONN = 2;
|
||||
|
@ -323,4 +323,28 @@ public class MsgModel extends BaseModel {
|
||||
public void setLiveUid(String liveUid) {
|
||||
this.liveUid = liveUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运天使
|
||||
*/
|
||||
@SerializedName("gift_name")
|
||||
private String giftName;
|
||||
@SerializedName("system_bubble")
|
||||
private String system_bubble;
|
||||
|
||||
public String getGiftName() {
|
||||
return giftName;
|
||||
}
|
||||
|
||||
public void setGiftName(String giftName) {
|
||||
this.giftName = giftName;
|
||||
}
|
||||
|
||||
public String getSystem_bubble() {
|
||||
return system_bubble;
|
||||
}
|
||||
|
||||
public void setSystem_bubble(String system_bubble) {
|
||||
this.system_bubble = system_bubble;
|
||||
}
|
||||
}
|
||||
|
@ -946,4 +946,5 @@
|
||||
<string name="in_batch">換一批</string>
|
||||
<string name="chat_chat">聊聊天</string>
|
||||
<string name="want_pre">想在其他APP上方也顯示小窗,\n可前往設置進行授權。</string>
|
||||
<string name="lucky_angel" translatable="false">恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦!</string>
|
||||
</resources>
|
||||
|
@ -683,6 +683,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onOpenDrawer(LiveAudienceEvent event) {
|
||||
Bundle bundle = new Bundle();
|
||||
Log.i("SocketRyClient", "onOpenDrawer: "+event.getType()+" "+event);
|
||||
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
|
||||
switch (event.getType()) {
|
||||
case SIDEBAR:
|
||||
@ -923,6 +924,9 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
|
||||
break;
|
||||
case LUCKY_ANGEL:
|
||||
manager.luckyAngel(event.getMsgModel());
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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_ANGEL;
|
||||
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
|
||||
import static com.yunbao.live.bean.LiveChatBean.STAR_CHALLENGE_UPGRADE_NOTIFY;
|
||||
|
||||
@ -343,7 +344,13 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1);
|
||||
LiveTextRender.starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel());
|
||||
}
|
||||
} else {
|
||||
} else if(bean.getType()==LUCKY_ANGEL){
|
||||
if(!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())){
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
|
||||
LiveTextRender.luckyAngel(mContext, mTextView, bean.getMsgModel());
|
||||
}
|
||||
|
||||
} else{
|
||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||
|
@ -20,6 +20,7 @@ public class LiveChatBean {
|
||||
public static final int RECOMMEND_CARD_NOTIFY = 10;
|
||||
public static final int AI_AUTOMATIC_SPEECH = 101;
|
||||
public static final int STAR_CHALLENGE_UPGRADE_NOTIFY = 105;
|
||||
public static final int LUCKY_ANGEL = 106;//幸运天使
|
||||
|
||||
private String id;
|
||||
private String userNiceName;
|
||||
|
@ -160,7 +160,8 @@ public class LiveAudienceEvent extends BaseModel {
|
||||
STAR_CHALLENGE_UPGRADE_NOTIFY(27, "星级挑战成功"),
|
||||
MESSAGE_BOTTOM(28, "聊天消息滚动到底部"),
|
||||
FLOAT_SETTING(29, "悬浮窗设置"),
|
||||
VOICE_PRESS(30, "长按展示图片");
|
||||
VOICE_PRESS(30, "长按展示图片"),
|
||||
LUCKY_ANGEL(31,"幸运天使");
|
||||
|
||||
private int type;
|
||||
private String name;
|
||||
|
@ -133,7 +133,7 @@ public class SocketRyClient {
|
||||
public void processBroadcast(String socketMsg) {
|
||||
L.e("收到socket--->" + socketMsg);
|
||||
|
||||
Log.i("tag", "socketMsg" + socketMsg);
|
||||
Log.i("SocketRyClient", "socketMsg" + socketMsg);
|
||||
|
||||
if (Constants.SOCKET_STOP_PLAY.equals(socketMsg)) {
|
||||
mListener.onSuperCloseLive();//超管关闭房间
|
||||
@ -143,7 +143,6 @@ public class SocketRyClient {
|
||||
return;
|
||||
}
|
||||
SocketReceiveBean received = JSON.parseObject(socketMsg, SocketReceiveBean.class);
|
||||
Log.i("tag", "1" + "礼物");
|
||||
|
||||
JSONObject map = received.getMsg().getJSONObject(0);
|
||||
|
||||
@ -498,6 +497,11 @@ public class SocketRyClient {
|
||||
.setMsgModel(starChallengeUpgradeNotifyMsg.get(0)));
|
||||
}
|
||||
break;
|
||||
case Constants.LuckyAngel:
|
||||
Bus.get().post(new LiveAudienceEvent()
|
||||
.setType(LiveAudienceEvent.LiveAudienceType.LUCKY_ANGEL)
|
||||
.setMsgModel( GsonUtils.fromJson(map.getJSONObject("ct").toString(), MsgModel.class)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,10 @@ public class LiveTextRender {
|
||||
private static AbsoluteSizeSpan sFontSizeSpan;
|
||||
private static AbsoluteSizeSpan sFontSizeSpan2;
|
||||
private static AbsoluteSizeSpan sFontSizeSpan3;
|
||||
private static final Map<LiveChatBean,Drawable> mDrawableMedalMap=new HashMap<>();
|
||||
private static final Map<LiveChatBean,Drawable> gzDrawablesMap=new HashMap<>();
|
||||
private static final Map<LiveChatBean,Drawable> ryxzDrawablesMap=new HashMap<>();
|
||||
private static final Map<LiveChatBean,Drawable> nhDrawablesMap=new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> mDrawableMedalMap = new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> gzDrawablesMap = new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> ryxzDrawablesMap = new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> nhDrawablesMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
sBoldSpan = new StyleSpan(Typeface.BOLD);
|
||||
@ -123,6 +123,23 @@ public class LiveTextRender {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运天使
|
||||
*/
|
||||
public static void luckyAngel(Context mContext, TextView mTextView, MsgModel msgModel) {
|
||||
String msg = mContext.getString(R.string.lucky_angel);
|
||||
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 static void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
|
||||
ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
@ -324,7 +341,7 @@ public class LiveTextRender {
|
||||
ImgLoader.displayDrawable(context, bean.getMedal_honor(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
ryxzDrawablesMap.put(bean,drawable);
|
||||
ryxzDrawablesMap.put(bean, drawable);
|
||||
nh(context, textView, bean);
|
||||
}
|
||||
|
||||
@ -337,7 +354,7 @@ public class LiveTextRender {
|
||||
|
||||
public static void nh(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
if (bean.getGood_nub() != null && !bean.getGood_nub().equals("")) {
|
||||
nhDrawablesMap.put(bean,ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.good_nub));
|
||||
nhDrawablesMap.put(bean, ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.good_nub));
|
||||
renderTMP(context, textView, bean);
|
||||
} else {
|
||||
renderTMP(context, textView, bean);
|
||||
@ -604,7 +621,8 @@ public class LiveTextRender {
|
||||
builder.setSpan(sFontSizeSpan2, index1, index2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
return builder;
|
||||
}
|
||||
public static void clear(){
|
||||
|
||||
public static void clear() {
|
||||
mDrawableMedalMap.clear();
|
||||
gzDrawablesMap.clear();
|
||||
ryxzDrawablesMap.clear();
|
||||
|
@ -721,11 +721,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
if (!IMLoginManager.get(mContext).hintChat()) {
|
||||
msgLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//msgLayout.removeAllViews();
|
||||
/*msgLayout.setOnClickListener(v -> {
|
||||
LiveEnterRoomBean bean = JSON.parseObject("{\"liveChatBean\":{\"aiAutomaticSpeechModel\":{\"aiName\":\"null:\"},\"anchor\":false,\"atUserID\":\"\",\"atUserName\":\"\",\"bubble\":\"\",\"content\":\"駕馭着公爵專屬座駕【神化龍魚】霸氣進場了\",\"contentColor\":\"\",\"endColor\":\"\",\"guard_type\":0,\"heart\":0,\"hot_num\":\"75974\",\"id\":\"158329\",\"level\":58,\"manager\":false,\"medal_name\":\"\",\"medal_new\":\"\",\"msgModel\":{\"action\":\"\",\"anchorId\":\"\",\"anchorName\":\"\",\"method\":\"\",\"msgtype\":\"\",\"nobleId\":\"\",\"recommendCardType\":\"\",\"systemBubble\":\"\",\"trumpetMsg\":\"\",\"userId\":\"\",\"userName\":\"\"},\"nobleId\":\"0\",\"startColor\":\"\",\"type\":3,\"user_nicename\":\"爺傲灬奈我何丿\",\"vip_type\":0},\"userBean\":{\"avatar\":\"https://downs.yaoulive.com/20220915105003_c3dd5b27cc1d484dbfdade8ae14cb76e?imageView2/2/w/600/h/600\",\"avatar_thumb\":\"https://downs.yaoulive.com/20220915105003_c3dd5b27cc1d484dbfdade8ae14cb76e?imageView2/2/w/200/h/200\",\"car\":{\"id\":44,\"swf\":\"https://downs.yaoulive.com/%E4%BE%AF%E7%88%B5%C2%B7%E7%A5%9E%E5%8C%96%E9%BE%99%E9%B1%BC.svga\",\"swftime\":7,\"words\":\"駕馭着公爵專屬座駕【神化龍魚】霸氣進場了\"},\"dress\":{},\"fans\":0,\"follows\":0,\"goodName\":\"0\",\"guard_type\":0,\"hide\":false,\"hot_num\":\"75974\",\"id\":\"158329\",\"level\":58,\"level_anchor\":0,\"liang\":{\"name\":\"0\"},\"liangNameTip\":\"ID:158329\",\"lives\":0,\"medal_level'\":0,\"medal_name\":\"\",\"medal_name'\":\"\",\"noble_id\":\"0\",\"nub\":0,\"sex\":0,\"token_rong\":\"\",\"user_nicename\":\"爺傲灬奈我何丿\",\"vip\":{\"type\":0},\"vipType\":0}}", LiveEnterRoomBean.class);
|
||||
onEnterRoom(bean);
|
||||
});*/
|
||||
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
@ -3312,4 +3308,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mLiveChatAdapter.insertItem(bean);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运天使
|
||||
*/
|
||||
public void luckyAngel(MsgModel model){
|
||||
if(mLiveChatAdapter!=null){
|
||||
LiveChatBean bean = new LiveChatBean();
|
||||
bean.setType(LiveChatBean.LUCKY_ANGEL);
|
||||
bean.setMsgModel(model);
|
||||
mLiveChatAdapter.insertItem(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1622,6 +1622,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 幸运天使
|
||||
*/
|
||||
public void luckyAngel(MsgModel model){
|
||||
if(mLiveRoomViewHolder != null){
|
||||
mLiveRoomViewHolder.luckyAngel(model);
|
||||
}
|
||||
}
|
||||
|
||||
public void messageBottom() {
|
||||
if (mLiveRoomViewHolder != null) {
|
||||
mLiveRoomViewHolder.chatScrollToBottom();
|
||||
|
Loading…
Reference in New Issue
Block a user