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 d80f52705..71892da7f 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -230,31 +230,31 @@ public class LiveTextRender { int index = 0; if (levelDrawable != null) { - builder.append(" "); + builder.append(" "); levelDrawable.setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(14)); builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index += 2; + index = builder.length(); } if (gzDrawablesMap.containsKey(bean)) {//贵族 - builder.append(" "); + builder.append(" "); gzDrawablesMap.get(bean).setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(18)); builder.setSpan(new VerticalImageSpan(gzDrawablesMap.get(bean)), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index += 2; + index = builder.length(); } if (ryxzDrawablesMap.containsKey(bean)) {//荣誉勋章 - builder.append(" "); + 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 += 2; + index = builder.length(); } if (nhDrawablesMap.containsKey(bean)) {//靓号 - builder.append(" "); + 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 += 2; + index = builder.length(); } if (bean.getGuardType() != Constants.GUARD_TYPE_NONE) {//守护图标 @@ -268,10 +268,10 @@ public class LiveTextRender { } if (drawable != null) { - builder.append(" "); + builder.append(" "); drawable.setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(16)); builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - index += 2; + index = builder.length(); } } @@ -280,10 +280,10 @@ public class LiveTextRender { && !bean.getMedalNmae().equals("null") && !bean.getMedalNmae().equals("(null)") && !bean.getMedalNmae().equals("")) {//粉丝徽章图标 Drawable drawable = getMedalImage(bean); if (drawable != null) { - builder.append(" "); + 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 += 2; + index = builder.length(); } } @@ -291,21 +291,21 @@ public class LiveTextRender { if (bean.isManager()) {//直播间管理员图标 Drawable drawable = ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.icon_live_chat_m); if (drawable != null) { - builder.append(" "); + 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 += 2; + 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(" "); + 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 += 2; + index = builder.length(); } }