修改问题
This commit is contained in:
parent
ce7b6decc1
commit
0b7b959151
@ -0,0 +1,37 @@
|
|||||||
|
package com.yunbao.common.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class NewGuardLevelModel extends BaseModel{
|
||||||
|
|
||||||
|
@SerializedName("guard_type")
|
||||||
|
private int guardType;
|
||||||
|
@SerializedName("cn")
|
||||||
|
private String cn;
|
||||||
|
@SerializedName("en")
|
||||||
|
private String en;
|
||||||
|
|
||||||
|
public int getGuardType() {
|
||||||
|
return guardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuardType(int guardType) {
|
||||||
|
this.guardType = guardType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCn() {
|
||||||
|
return cn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCn(String cn) {
|
||||||
|
this.cn = cn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEn() {
|
||||||
|
return en;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEn(String en) {
|
||||||
|
this.en = en;
|
||||||
|
}
|
||||||
|
}
|
@ -208,6 +208,10 @@ public class CommonHttpUtil {
|
|||||||
JSONArray levelArray = obj.getJSONArray("liveclass");
|
JSONArray levelArray = obj.getJSONArray("liveclass");
|
||||||
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
|
new LiveClassManager(context).UpDataLiveClass(levelArray.toJSONString());
|
||||||
}
|
}
|
||||||
|
if (obj.containsKey("guard_type")) {
|
||||||
|
JSONArray levelArray = obj.getJSONArray("guard_type");
|
||||||
|
new NewLevelManager(context).upDataGuardLevel(levelArray.toJSONString());
|
||||||
|
}
|
||||||
if (obj.containsKey("apk_ver")) {
|
if (obj.containsKey("apk_ver")) {
|
||||||
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
APKManager.get().setApkVer(obj.getString("apk_ver"));
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,15 @@ public class IMLoginManager extends BaseCacheManager {
|
|||||||
|
|
||||||
private final String KEY_LANGUAGE = "language";
|
private final String KEY_LANGUAGE = "language";
|
||||||
private final String KEY_GAME = "key_game";
|
private final String KEY_GAME = "key_game";
|
||||||
|
private final String GUARD_TYPE = "key_GUARD_TYPE";
|
||||||
|
|
||||||
|
public void setGuardType(int guardType) {
|
||||||
|
put(GUARD_TYPE, guardType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGuardType() {
|
||||||
|
return getInt(GUARD_TYPE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public void setRedPoint() {
|
public void setRedPoint() {
|
||||||
put("RedPoint", "1");
|
put("RedPoint", "1");
|
||||||
|
@ -5,6 +5,7 @@ import android.content.Context;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.yunbao.common.bean.FansModel;
|
import com.yunbao.common.bean.FansModel;
|
||||||
|
import com.yunbao.common.bean.NewGuardLevelModel;
|
||||||
import com.yunbao.common.bean.NewLevelModel;
|
import com.yunbao.common.bean.NewLevelModel;
|
||||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||||
|
|
||||||
@ -19,10 +20,12 @@ public class NewLevelManager extends BaseCacheManager {
|
|||||||
private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel";
|
private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel";
|
||||||
private final String KEY_LIVE_LEVEL = "keyLiveLevel";
|
private final String KEY_LIVE_LEVEL = "keyLiveLevel";
|
||||||
private final String KEY_FANS_LEVEL = "keyFansLevel";
|
private final String KEY_FANS_LEVEL = "keyFansLevel";
|
||||||
|
private final String KEY_GUARD_LEVEL = "keyGuardLevel";
|
||||||
|
|
||||||
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
||||||
private List<NewLevelModel> keyAnchorLevel = new ArrayList<>();
|
private List<NewLevelModel> keyAnchorLevel = new ArrayList<>();
|
||||||
private List<FansModel> fansModels = new ArrayList<>();
|
private List<FansModel> fansModels = new ArrayList<>();
|
||||||
|
private List<NewGuardLevelModel> newGuardLevelModels = new ArrayList<>();
|
||||||
|
|
||||||
public NewLevelManager(Context context) {
|
public NewLevelManager(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -62,6 +65,29 @@ public class NewLevelManager extends BaseCacheManager {
|
|||||||
return fansModel;
|
return fansModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void upDataGuardLevel(String json) {
|
||||||
|
newGuardLevelModels = new Gson().fromJson(json, new TypeToken<List<NewGuardLevelModel>>() {
|
||||||
|
}.getType());
|
||||||
|
put(KEY_GUARD_LEVEL, newGuardLevelModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NewGuardLevelModel> getGuardLevel() {
|
||||||
|
newGuardLevelModels = getList(KEY_GUARD_LEVEL, new TypeToken<List<NewGuardLevelModel>>() {
|
||||||
|
}.getType());
|
||||||
|
return newGuardLevelModels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewGuardLevelModel getGuardModel(int type) {
|
||||||
|
getGuardLevel();
|
||||||
|
NewGuardLevelModel guardLevelModel = null;
|
||||||
|
for (NewGuardLevelModel model : newGuardLevelModels) {
|
||||||
|
if (model.getGuardType() == type) {
|
||||||
|
guardLevelModel = model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return guardLevelModel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取等级数据
|
* 获取等级数据
|
||||||
*
|
*
|
||||||
|
@ -286,7 +286,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
|||||||
.isDestroyOnDismiss(true)
|
.isDestroyOnDismiss(true)
|
||||||
.isLightStatusBar(false)
|
.isLightStatusBar(false)
|
||||||
.popupPosition(PopupPosition.Top)
|
.popupPosition(PopupPosition.Top)
|
||||||
.asCustom(new LiveBuyGuardSelectPopup(getContext(), price,guardPriceModel)
|
.asCustom(new LiveBuyGuardSelectPopup(getContext(), price, guardPriceModel)
|
||||||
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
@ -373,6 +373,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
|||||||
}
|
}
|
||||||
}).build().show();
|
}).build().show();
|
||||||
} else {
|
} else {
|
||||||
|
IMLoginManager.get(mContext).setGuardType(dataTipModel.getGuardType());
|
||||||
ToastUtil.show(data);
|
ToastUtil.show(data);
|
||||||
dismiss();
|
dismiss();
|
||||||
if (dataTipModel.getGuardType() == 3) {
|
if (dataTipModel.getGuardType() == 3) {
|
||||||
|
@ -102,7 +102,7 @@ public class SocketRyChatUtil {
|
|||||||
.param("uid", u.getId())
|
.param("uid", u.getId())
|
||||||
.param("liangname", u.getGoodName())
|
.param("liangname", u.getGoodName())
|
||||||
.param("vip_type", u.getVip().getType())
|
.param("vip_type", u.getVip().getType())
|
||||||
.param("guard_type", guardType)
|
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType())
|
||||||
.param("medal_name", u.getMedalName())
|
.param("medal_name", u.getMedalName())
|
||||||
.param("medal_level", model.getMedalLevel())
|
.param("medal_level", model.getMedalLevel())
|
||||||
.param("good_num", u.getGoodnum())
|
.param("good_num", u.getGoodnum())
|
||||||
@ -180,7 +180,7 @@ public class SocketRyChatUtil {
|
|||||||
.param("bubble", u.getDress().getBubble())
|
.param("bubble", u.getDress().getBubble())
|
||||||
.param("medal", u.getDress().getMedal())
|
.param("medal", u.getDress().getMedal())
|
||||||
.param("medal_new", u.getDress().getMedal_new())
|
.param("medal_new", u.getDress().getMedal_new())
|
||||||
.param("guard_type", guardType)
|
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType())
|
||||||
.param("medal_name", u.getMedalName())
|
.param("medal_name", u.getMedalName())
|
||||||
.param("medal_level", u.getMedalLevel())
|
.param("medal_level", u.getMedalLevel())
|
||||||
.param("good_num", u.getGoodnum())
|
.param("good_num", u.getGoodnum())
|
||||||
@ -716,7 +716,7 @@ public class SocketRyChatUtil {
|
|||||||
.param("uhead", u.getAvatar())
|
.param("uhead", u.getAvatar())
|
||||||
.param("votestotal", votes)
|
.param("votestotal", votes)
|
||||||
.param("guard_nums", guardNum)
|
.param("guard_nums", guardNum)
|
||||||
.param("guard_type", guardType);
|
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType());
|
||||||
msg.create();
|
msg.create();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -742,7 +742,7 @@ public class SocketRyChatUtil {
|
|||||||
.param("bubble", u.getDress().getBubble())
|
.param("bubble", u.getDress().getBubble())
|
||||||
.param("medal", u.getDress().getMedal())
|
.param("medal", u.getDress().getMedal())
|
||||||
.param("medal_new", u.getDress().getMedal_new())
|
.param("medal_new", u.getDress().getMedal_new())
|
||||||
.param("guard_type", guardType);
|
.param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType());
|
||||||
msg.create();
|
msg.create();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ public class SocketRyClient {
|
|||||||
} else if (action2 == 61) {//赠送礼物
|
} else if (action2 == 61) {//赠送礼物
|
||||||
sendGiftByNotify(map);
|
sendGiftByNotify(map);
|
||||||
} else if (action2 == 62) {//购买守护
|
} else if (action2 == 62) {//购买守护
|
||||||
buyGuardByNotify(map);
|
// buyGuardByNotify(map);
|
||||||
// }else if (action2 == 63){
|
// }else if (action2 == 63){
|
||||||
} else if (action2 == 63) {//购买vip
|
} else if (action2 == 63) {//购买vip
|
||||||
buyVipByNotify(map);
|
buyVipByNotify(map);
|
||||||
@ -443,6 +443,7 @@ public class SocketRyClient {
|
|||||||
} else if (action2 == 90) {
|
} else if (action2 == 90) {
|
||||||
NewAllServerNotifyGuardEvent notifyGuardEvent = GsonUtils.fromJson(map.toString(), NewAllServerNotifyGuardEvent.class);
|
NewAllServerNotifyGuardEvent notifyGuardEvent = GsonUtils.fromJson(map.toString(), NewAllServerNotifyGuardEvent.class);
|
||||||
Bus.get().post(notifyGuardEvent);
|
Bus.get().post(notifyGuardEvent);
|
||||||
|
buyGuardInSameRoom(map);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Constants.SOCKET_SEND_BARRAGE://发弹幕
|
case Constants.SOCKET_SEND_BARRAGE://发弹幕
|
||||||
@ -820,16 +821,16 @@ public class SocketRyClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void buyGuardInSameRoom(JSONObject map) {
|
private void buyGuardInSameRoom(JSONObject map) {
|
||||||
String guardName = WordUtil.isNewZh() ? "周守護" : "Week Guardian";
|
String guardName = WordUtil.isNewZh() ? "星之守護" : "Star Guardian";
|
||||||
switch (map.getIntValue("guard_type")) {
|
switch (map.getIntValue("guard_type")) {
|
||||||
case 1:
|
case 1:
|
||||||
guardName = WordUtil.isNewZh() ? "周守護" : "Week Guardian";
|
guardName = WordUtil.isNewZh() ? "星之守護" : "Star Guardian";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
guardName = WordUtil.isNewZh() ? "月守護" : "Month Guardian";
|
guardName = WordUtil.isNewZh() ? "王之守護" : "King Guardian";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
guardName = WordUtil.isNewZh() ? "年守護" : "Year Guardian";
|
guardName = WordUtil.isNewZh() ? "神之守護" : "God Guardian";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String content = WordUtil.isNewZh() ? "%s在%s的直播間開通了%s" : "%s has been opened in %s live broadcast room %s";
|
String content = WordUtil.isNewZh() ? "%s在%s的直播間開通了%s" : "%s has been opened in %s live broadcast room %s";
|
||||||
@ -845,7 +846,7 @@ public class SocketRyClient {
|
|||||||
|
|
||||||
private void buyGuardByNotify(JSONObject map) {
|
private void buyGuardByNotify(JSONObject map) {
|
||||||
if (mLiveUid.equals(map.getString("liveuid"))) {
|
if (mLiveUid.equals(map.getString("liveuid"))) {
|
||||||
buyGuardInSameRoom(map);
|
// buyGuardInSameRoom(map);
|
||||||
//同一直播间,玩家自己开通,也能看到全服通知
|
//同一直播间,玩家自己开通,也能看到全服通知
|
||||||
String userId = CommonAppConfig.getInstance().getUid();
|
String userId = CommonAppConfig.getInstance().getUid();
|
||||||
String uid = map.getString("uid");
|
String uid = map.getString("uid");
|
||||||
|
@ -32,9 +32,9 @@ import com.bumptech.glide.Glide;
|
|||||||
import com.bumptech.glide.request.target.CustomTarget;
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
import com.yunbao.common.CommonAppContext;
|
import com.yunbao.common.CommonAppContext;
|
||||||
import com.yunbao.common.Constants;
|
|
||||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||||
import com.yunbao.common.bean.MsgModel;
|
import com.yunbao.common.bean.MsgModel;
|
||||||
|
import com.yunbao.common.bean.NewGuardLevelModel;
|
||||||
import com.yunbao.common.bean.NewLevelModel;
|
import com.yunbao.common.bean.NewLevelModel;
|
||||||
import com.yunbao.common.custom.VerticalImageSpan;
|
import com.yunbao.common.custom.VerticalImageSpan;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
@ -262,95 +262,170 @@ public class LiveTextRender {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface CreatePrefixCallback {
|
||||||
|
void onPrefixCallback(SpannableStringBuilder builder);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成前缀
|
* 生成前缀
|
||||||
*/
|
*/
|
||||||
private SpannableStringBuilder createPrefix(Drawable levelDrawable, LiveChatBean bean) {
|
private void createPrefix(Drawable levelDrawable, LiveChatBean bean, CreatePrefixCallback createPrefixCallback) {
|
||||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
if (levelDrawable != null) {
|
|
||||||
builder.append(" ");
|
|
||||||
levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
|
||||||
builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
index = builder.length();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gzDrawablesMap.containsKey(bean)) {//贵族
|
// if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标
|
||||||
builder.append(" ");
|
// Drawable drawable;
|
||||||
gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20));
|
// if (bean.getGuardType() == Constants.GUARD_TYPE_MONTH) {
|
||||||
builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_1);
|
||||||
index = builder.length();
|
// } else if (bean.getGuardType() == Constants.GUARD_TYPE_YEAR) {
|
||||||
}
|
// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_2);
|
||||||
|
// } else {
|
||||||
|
// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_0);
|
||||||
|
// }
|
||||||
|
getGuardImage(CommonAppContext.sInstance, bean.getGuardType(), new ImgLoader.DrawableCallback() {
|
||||||
|
@Override
|
||||||
|
public void onLoadSuccess(Drawable drawable) {
|
||||||
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章
|
if (levelDrawable != null) {
|
||||||
builder.append(" ");
|
builder.append(" ");
|
||||||
ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18));
|
levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
||||||
builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
index = builder.length();
|
index = builder.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nhDrawablesMap.containsKey(bean)) {//靓号
|
if (gzDrawablesMap.containsKey(bean)) {//贵族
|
||||||
builder.append(" ");
|
builder.append(" ");
|
||||||
nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20));
|
||||||
builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
index = builder.length();
|
index = builder.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标
|
if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章
|
||||||
Drawable drawable;
|
builder.append(" ");
|
||||||
if (bean.getGuardType() == Constants.GUARD_TYPE_MONTH) {
|
ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18));
|
||||||
drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_1);
|
builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
} else if (bean.getGuardType() == Constants.GUARD_TYPE_YEAR) {
|
index = builder.length();
|
||||||
drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_2);
|
}
|
||||||
} else {
|
|
||||||
drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_0);
|
if (nhDrawablesMap.containsKey(bean)) {//靓号
|
||||||
|
builder.append(" ");
|
||||||
|
nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
||||||
|
builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
if (drawable != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable.setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(17));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
//在这里添加粉丝徽章的图片
|
||||||
|
if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl())
|
||||||
|
&& !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("<null>")) {//粉丝徽章图标
|
||||||
|
Drawable drawable2 = getMedalImage(bean);
|
||||||
|
if (drawable2 != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable2.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable2), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (bean.isManager()) {//直播间管理员图标
|
||||||
|
Drawable drawable3 = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m);
|
||||||
|
if (drawable3 != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable3.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable3), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标
|
||||||
|
Drawable drawable4 = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang);
|
||||||
|
if (drawable4 != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable4.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable4), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
// new add
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createPrefixCallback.onPrefixCallback(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawable != null) {
|
@Override
|
||||||
builder.append(" ");
|
public void onLoadFailed() {
|
||||||
drawable.setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(16));
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||||
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
int index = 0;
|
||||||
index = builder.length();
|
|
||||||
|
if (levelDrawable != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
||||||
|
builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gzDrawablesMap.containsKey(bean)) {//贵族
|
||||||
|
builder.append(" ");
|
||||||
|
gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(20));
|
||||||
|
builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章
|
||||||
|
builder.append(" ");
|
||||||
|
ryxzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18));
|
||||||
|
builder.setSpan(new VerticalImageSpan(ryxzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nhDrawablesMap.containsKey(bean)) {//靓号
|
||||||
|
builder.append(" ");
|
||||||
|
nhDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
||||||
|
builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
//在这里添加粉丝徽章的图片
|
||||||
|
if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl())
|
||||||
|
&& !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("<null>")) {//粉丝徽章图标
|
||||||
|
Drawable drawable = getMedalImage(bean);
|
||||||
|
if (drawable != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (bean.isManager()) {//直播间管理员图标
|
||||||
|
Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m);
|
||||||
|
if (drawable != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标
|
||||||
|
Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang);
|
||||||
|
if (drawable != null) {
|
||||||
|
builder.append(" ");
|
||||||
|
drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14));
|
||||||
|
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
// new add
|
||||||
|
index = builder.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createPrefixCallback.onPrefixCallback(builder);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
//在这里添加粉丝徽章的图片
|
|
||||||
if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl())
|
|
||||||
&& !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("<null>")) {//粉丝徽章图标
|
|
||||||
Drawable drawable = getMedalImage(bean);
|
|
||||||
if (drawable != null) {
|
|
||||||
builder.append(" ");
|
|
||||||
drawable.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17));
|
|
||||||
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
index = builder.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (bean.isManager()) {//直播间管理员图标
|
|
||||||
Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m);
|
|
||||||
if (drawable != null) {
|
|
||||||
builder.append(" ");
|
|
||||||
drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14));
|
|
||||||
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
index = builder.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(bean.getLiangName())) {//靓号图标
|
|
||||||
Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_liang);
|
|
||||||
if (drawable != null) {
|
|
||||||
builder.append(" ");
|
|
||||||
drawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(14));
|
|
||||||
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
||||||
// new add
|
|
||||||
index = builder.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getMedalImage(final LiveChatBean bean) {
|
private Drawable getMedalImage(final LiveChatBean bean) {
|
||||||
@ -439,6 +514,36 @@ public class LiveTextRender {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getGuardImage(Context mContext, int guardType, ImgLoader.DrawableCallback callback) {
|
||||||
|
if (guardType==0){
|
||||||
|
callback.onLoadFailed();
|
||||||
|
}else {
|
||||||
|
if (mContext instanceof Activity) {
|
||||||
|
if (((Activity) mContext).isDestroyed()) {
|
||||||
|
mContext = CommonAppContext.getTopActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<NewGuardLevelModel> models = new NewLevelManager(mContext).getGuardLevel();
|
||||||
|
String imgUrl = WordUtil.isNewZh() ? "https://downs.yaoulive.com/%E6%98%9F%E4%B9%8B%E5%AE%88%E6%8A%A4%E9%93%AD%E7%89%8C.png" : "https://downs.yaoulive.com/%E6%98%9F%E5%AE%88%E9%8A%98%E7%89%8C-2.png";
|
||||||
|
for (NewGuardLevelModel newGuardLevelModel : models) {
|
||||||
|
if (newGuardLevelModel.getGuardType() == guardType) {
|
||||||
|
imgUrl = WordUtil.isNewZh() ? newGuardLevelModel.getCn() : newGuardLevelModel.getEn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImgLoader.displayDrawable(mContext, imgUrl, new ImgLoader.DrawableCallback() {
|
||||||
|
@Override
|
||||||
|
public void onLoadSuccess(Drawable drawable) {
|
||||||
|
callback.onLoadSuccess(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadFailed() {
|
||||||
|
callback.onLoadFailed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 等级设置
|
* 等级设置
|
||||||
@ -576,42 +681,53 @@ public class LiveTextRender {
|
|||||||
getLiveLevelImage(context, bean.getLevel(), false, new ImgLoader.DrawableCallback() {
|
getLiveLevelImage(context, bean.getLevel(), false, new ImgLoader.DrawableCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadSuccess(Drawable drawable) {
|
public void onLoadSuccess(Drawable drawable) {
|
||||||
SpannableStringBuilder builder = createPrefix(drawable, bean);
|
|
||||||
int color = Color.parseColor("#68F1F4");
|
createPrefix(drawable, bean, new CreatePrefixCallback() {
|
||||||
if (bean.isAnchor()) {
|
@Override
|
||||||
color = Color.parseColor("#FBEABF");
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
} else {
|
int color = Color.parseColor("#68F1F4");
|
||||||
color = Color.parseColor("#68F1F4");
|
if (bean.isAnchor()) {
|
||||||
}
|
color = Color.parseColor("#FBEABF");
|
||||||
switch (bean.getType()) {
|
} else {
|
||||||
case LiveChatBean.GIFT:
|
color = Color.parseColor("#68F1F4");
|
||||||
builder = renderGift(color, builder, bean);
|
}
|
||||||
break;
|
switch (bean.getType()) {
|
||||||
default:
|
case LiveChatBean.GIFT:
|
||||||
builder = renderChat(color, builder, bean);
|
builder = renderGift(color, builder, bean);
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
textView.setText(builder);
|
builder = renderChat(color, builder, bean);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
textView.setText(builder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFailed() {
|
public void onLoadFailed() {
|
||||||
SpannableStringBuilder builder = createPrefix(null, bean);
|
createPrefix(null, bean, new CreatePrefixCallback() {
|
||||||
int color = 0;
|
@Override
|
||||||
if (bean.isAnchor()) {
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
color = 0xffffdd00;
|
int color = 0;
|
||||||
} else {
|
if (bean.isAnchor()) {
|
||||||
color = Color.parseColor("#68F1F4");
|
color = 0xffffdd00;
|
||||||
}
|
} else {
|
||||||
switch (bean.getType()) {
|
color = Color.parseColor("#68F1F4");
|
||||||
case LiveChatBean.GIFT:
|
}
|
||||||
builder = renderGift(color, builder, bean);
|
switch (bean.getType()) {
|
||||||
break;
|
case LiveChatBean.GIFT:
|
||||||
default:
|
builder = renderGift(color, builder, bean);
|
||||||
builder = renderChat(color, builder, bean);
|
break;
|
||||||
break;
|
default:
|
||||||
}
|
builder = renderChat(color, builder, bean);
|
||||||
textView.setText(builder);
|
break;
|
||||||
|
}
|
||||||
|
textView.setText(builder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -771,23 +887,33 @@ public class LiveTextRender {
|
|||||||
@Override
|
@Override
|
||||||
public void onLoadSuccess(Drawable drawable) {
|
public void onLoadSuccess(Drawable drawable) {
|
||||||
if (textView != null) {
|
if (textView != null) {
|
||||||
SpannableStringBuilder builder = createPrefix(drawable, bean);
|
createPrefix(drawable, bean, new CreatePrefixCallback() {
|
||||||
int start = builder.length();
|
@Override
|
||||||
String name = bean.getUserNiceName() + " ";
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
builder.append(name);
|
int start = builder.length();
|
||||||
builder.append(bean.getContent());
|
String name = bean.getUserNiceName() + " ";
|
||||||
textView.setText(builder);
|
builder.append(name);
|
||||||
|
builder.append(bean.getContent());
|
||||||
|
textView.setText(builder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFailed() {
|
public void onLoadFailed() {
|
||||||
if (textView != null) {
|
if (textView != null) {
|
||||||
SpannableStringBuilder builder = createPrefix(null, bean);
|
createPrefix(null, bean, new CreatePrefixCallback() {
|
||||||
int start = builder.length();
|
@Override
|
||||||
String name = bean.getUserNiceName() + " ";
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
builder.append(name);
|
int start = builder.length();
|
||||||
textView.setText(builder);
|
String name = bean.getUserNiceName() + " ";
|
||||||
|
builder.append(name);
|
||||||
|
textView.setText(builder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,6 +393,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
|||||||
private LinearLayout combo_layout;
|
private LinearLayout combo_layout;
|
||||||
private TextView combo_number;
|
private TextView combo_number;
|
||||||
private View quick_gift_reminder;
|
private View quick_gift_reminder;
|
||||||
|
private int guardType = 0;
|
||||||
|
|
||||||
|
public LiveRoomViewHolder setGuardType(int guardType) {
|
||||||
|
this.guardType = guardType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onUpdata(String str) {
|
public void onUpdata(String str) {
|
||||||
|
@ -696,6 +696,17 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
|
upDataPkScore(pkInfo.getJSONArray("userlist"), pkInfo.getIntValue("drpk_time"));
|
||||||
}
|
}
|
||||||
|
if (data.getGuardUserAvatar() != null) {
|
||||||
|
if (mLiveRoomViewHolder != null) {
|
||||||
|
if (TextUtils.isEmpty(data.getGuardUserAvatar().getGuardType())) {
|
||||||
|
mLiveRoomViewHolder.setGuardType(0);
|
||||||
|
} else {
|
||||||
|
int guardType = Integer.parseInt(data.getGuardUserAvatar().getGuardType());
|
||||||
|
IMLoginManager.get(mContext).setGuardType(guardType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
// mLivePlayViewHolder.setLayoutInterface(new LivePlayRyViewHolder.PlayViewLayoutInterface() {
|
// mLivePlayViewHolder.setLayoutInterface(new LivePlayRyViewHolder.PlayViewLayoutInterface() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void playViewLayout(int width, int height) {
|
// public void playViewLayout(int width, int height) {
|
||||||
@ -2228,8 +2239,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent);
|
mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void onGuardRed(){
|
|
||||||
if (mLiveAudienceViewHolder!=null){
|
public void onGuardRed() {
|
||||||
|
if (mLiveAudienceViewHolder != null) {
|
||||||
mLiveAudienceViewHolder.onGuardRed();
|
mLiveAudienceViewHolder.onGuardRed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user