修改问题
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取等级数据
|
* 获取等级数据
|
||||||
*
|
*
|
||||||
|
@ -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,10 +262,28 @@ 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) {
|
||||||
|
|
||||||
|
|
||||||
|
// if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标
|
||||||
|
// Drawable drawable;
|
||||||
|
// if (bean.getGuardType() == Constants.GUARD_TYPE_MONTH) {
|
||||||
|
// drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_1);
|
||||||
|
// } 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();
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
@ -296,25 +314,80 @@ public class LiveTextRender {
|
|||||||
builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
builder.setSpan(new VerticalImageSpan(nhDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
index = builder.length();
|
index = builder.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标
|
|
||||||
Drawable drawable;
|
|
||||||
if (bean.getGuardType() == Constants.GUARD_TYPE_MONTH) {
|
|
||||||
drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_guard_type_1);
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
builder.append(" ");
|
builder.append(" ");
|
||||||
drawable.setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(16));
|
drawable.setBounds(0, 0, DpUtil.dp2px(35), DpUtil.dp2px(17));
|
||||||
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
index = builder.length();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadFailed() {
|
||||||
|
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)) {//贵族
|
||||||
|
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())
|
if (!TextUtils.isEmpty(bean.getMedalNmae()) && !TextUtils.isEmpty(bean.getMedalLevelImageUrl())
|
||||||
&& !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("<null>")) {//粉丝徽章图标
|
&& !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("<null>")) {//粉丝徽章图标
|
||||||
@ -348,9 +421,11 @@ public class LiveTextRender {
|
|||||||
index = builder.length();
|
index = builder.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
createPrefixCallback.onPrefixCallback(builder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
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,7 +681,10 @@ 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);
|
|
||||||
|
createPrefix(drawable, bean, new CreatePrefixCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
int color = Color.parseColor("#68F1F4");
|
int color = Color.parseColor("#68F1F4");
|
||||||
if (bean.isAnchor()) {
|
if (bean.isAnchor()) {
|
||||||
color = Color.parseColor("#FBEABF");
|
color = Color.parseColor("#FBEABF");
|
||||||
@ -593,10 +701,15 @@ public class LiveTextRender {
|
|||||||
}
|
}
|
||||||
textView.setText(builder);
|
textView.setText(builder);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFailed() {
|
public void onLoadFailed() {
|
||||||
SpannableStringBuilder builder = createPrefix(null, bean);
|
createPrefix(null, bean, new CreatePrefixCallback() {
|
||||||
|
@Override
|
||||||
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
int color = 0;
|
int color = 0;
|
||||||
if (bean.isAnchor()) {
|
if (bean.isAnchor()) {
|
||||||
color = 0xffffdd00;
|
color = 0xffffdd00;
|
||||||
@ -616,6 +729,9 @@ public class LiveTextRender {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,24 +887,34 @@ 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() {
|
||||||
|
@Override
|
||||||
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
int start = builder.length();
|
int start = builder.length();
|
||||||
String name = bean.getUserNiceName() + " ";
|
String name = bean.getUserNiceName() + " ";
|
||||||
builder.append(name);
|
builder.append(name);
|
||||||
builder.append(bean.getContent());
|
builder.append(bean.getContent());
|
||||||
textView.setText(builder);
|
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() {
|
||||||
|
@Override
|
||||||
|
public void onPrefixCallback(SpannableStringBuilder builder) {
|
||||||
int start = builder.length();
|
int start = builder.length();
|
||||||
String name = bean.getUserNiceName() + " ";
|
String name = bean.getUserNiceName() + " ";
|
||||||
builder.append(name);
|
builder.append(name);
|
||||||
textView.setText(builder);
|
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,6 +2239,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent);
|
mLiveRoomViewHolder.onSendMoneyLongEndEvent(moneyLongEndEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGuardRed() {
|
public void onGuardRed() {
|
||||||
if (mLiveAudienceViewHolder != null) {
|
if (mLiveAudienceViewHolder != null) {
|
||||||
mLiveAudienceViewHolder.onGuardRed();
|
mLiveAudienceViewHolder.onGuardRed();
|
||||||
|
Loading…
Reference in New Issue
Block a user