消息气泡位置,关注消息默认消息,样式更改
This commit is contained in:
parent
be608fd90b
commit
554bfa137a
@ -2,6 +2,7 @@ package com.yunbao.common.bean;
|
|||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,6 +18,17 @@ public class NewLevelModel extends BaseModel {
|
|||||||
private String levemax;
|
private String levemax;
|
||||||
@SerializedName("thumb")
|
@SerializedName("thumb")
|
||||||
private String thumb;
|
private String thumb;
|
||||||
|
@SerializedName("icon")
|
||||||
|
private String icon;
|
||||||
|
@SerializedName("colour")
|
||||||
|
private String colour;
|
||||||
|
@SerializedName("live_icon")
|
||||||
|
private String liveIcon;
|
||||||
|
|
||||||
|
public static NewLevelModel objectFromData(String str) {
|
||||||
|
|
||||||
|
return new Gson().fromJson(str, NewLevelModel.class);
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -67,4 +79,28 @@ public class NewLevelModel extends BaseModel {
|
|||||||
this.thumb = thumb;
|
this.thumb = thumb;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcon(String icon) {
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColour() {
|
||||||
|
return colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColour(String colour) {
|
||||||
|
this.colour = colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLiveIcon() {
|
||||||
|
return liveIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLiveIcon(String liveIcon) {
|
||||||
|
this.liveIcon = liveIcon;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ import java.util.List;
|
|||||||
public class NewLevelManager extends BaseCacheManager {
|
public class NewLevelManager extends BaseCacheManager {
|
||||||
private final String KEY_USER_LEVEL = "keyUserLevel";
|
private final String KEY_USER_LEVEL = "keyUserLevel";
|
||||||
private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel";
|
private final String KEY_ANCHOR_LEVEL = "keyAnchorLevel";
|
||||||
|
private final String KEY_LIVE_LEVEL = "keyLiveLevel";
|
||||||
|
|
||||||
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
||||||
private List<NewLevelModel> keyAnchorLevel = new ArrayList<>();
|
private List<NewLevelModel> keyAnchorLevel = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@
|
|||||||
<string name="live_close_exit">Exit</string>
|
<string name="live_close_exit">Exit</string>
|
||||||
<string name="user">User</string>
|
<string name="user">User</string>
|
||||||
|
|
||||||
<string name="automatic_chat">If you don\'t take the initiative,how can we have a story?\nTell the anchor say hi~</string>
|
<string name="automatic_chat">If you don\'t take the initiative,how can we have a story?Tell the anchor say hi~</string>
|
||||||
|
|
||||||
<string name="add_follow">+ follow</string>
|
<string name="add_follow">+ follow</string>
|
||||||
<string name="add_into_active">Enter activity</string>
|
<string name="add_into_active">Enter activity</string>
|
||||||
|
@ -780,7 +780,7 @@
|
|||||||
<string name="live_close_exit">直接退出</string>
|
<string name="live_close_exit">直接退出</string>
|
||||||
<string name="user">用戶</string>
|
<string name="user">用戶</string>
|
||||||
|
|
||||||
<string name="automatic_chat">你都不主動我們怎麼會有故事,\n跟主播Say Hi吧~</string>
|
<string name="automatic_chat">你都不主動我們怎麼會有故事,跟主播Say Hi吧~</string>
|
||||||
<string name="add_follow">+ 關注</string>
|
<string name="add_follow">+ 關注</string>
|
||||||
<string name="add_into_active">進入活動</string>
|
<string name="add_into_active">進入活動</string>
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ ext {
|
|||||||
]
|
]
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
//正式、
|
//正式、
|
||||||
serverHost : "https://napi.yaoulive.com",
|
// serverHost : "https://napi.yaoulive.com",
|
||||||
//测试
|
//测试
|
||||||
// serverHost : "https://ceshi.yaoulive.com",
|
serverHost : "https://ceshi.yaoulive.com",
|
||||||
|
|
||||||
//腾讯地图
|
//腾讯地图
|
||||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 712 B |
@ -14,11 +14,13 @@ import android.text.SpannableStringBuilder;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -37,6 +39,7 @@ import com.yunbao.common.interfaces.OnItemClickListener;
|
|||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.views.weight.ClipPathCircleImage;
|
||||||
import com.yunbao.live.R;
|
import com.yunbao.live.R;
|
||||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
import com.yunbao.live.bean.LiveChatBean;
|
import com.yunbao.live.bean.LiveChatBean;
|
||||||
@ -176,12 +179,16 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
RoundedImageView avatar;
|
RoundedImageView avatar;
|
||||||
View v_chat_active_close;
|
View v_chat_active_close;
|
||||||
RecyclerView rv_chat_active;
|
RecyclerView rv_chat_active;
|
||||||
ImageView img_zg_img;
|
ImageView img_zg_img, btnAttention;
|
||||||
|
FrameLayout attentionLayout;
|
||||||
|
ClipPathCircleImage clipImage2;
|
||||||
|
|
||||||
public Vh(View itemView) {
|
public Vh(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
mBg = (LinearLayout) itemView.findViewById(R.id.bg);
|
mBg = (LinearLayout) itemView.findViewById(R.id.bg);
|
||||||
mTextView = (TextView) itemView.findViewById(R.id.text_txt);
|
mTextView = (TextView) itemView.findViewById(R.id.text_txt);
|
||||||
|
attentionLayout = (FrameLayout) itemView.findViewById(R.id.attention_layout);
|
||||||
|
clipImage2 = (ClipPathCircleImage) itemView.findViewById(R.id.clip_image2);
|
||||||
itemView.setOnClickListener(mOnClickListener);
|
itemView.setOnClickListener(mOnClickListener);
|
||||||
|
|
||||||
view_follow = (LinearLayout) itemView.findViewById(R.id.view_follow);
|
view_follow = (LinearLayout) itemView.findViewById(R.id.view_follow);
|
||||||
@ -196,6 +203,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
view_zg = (LinearLayout) itemView.findViewById(R.id.view_zg);
|
view_zg = (LinearLayout) itemView.findViewById(R.id.view_zg);
|
||||||
tv_zg_anchorname = (TextView) itemView.findViewById(R.id.tv_zg_anchorname);
|
tv_zg_anchorname = (TextView) itemView.findViewById(R.id.tv_zg_anchorname);
|
||||||
img_zg_img = (ImageView) itemView.findViewById(R.id.img_zg_img);
|
img_zg_img = (ImageView) itemView.findViewById(R.id.img_zg_img);
|
||||||
|
btnAttention = (ImageView) itemView.findViewById(R.id.btn_attention);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +211,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
itemView.setTag(bean);
|
itemView.setTag(bean);
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
params.setMargins(0, 0, DpUtil.dp2px(95), 12);
|
params.setMargins(0, 0, DpUtil.dp2px(95), 0);
|
||||||
|
params.gravity = Gravity.CENTER_VERTICAL;
|
||||||
mBg.setLayoutParams(params);
|
mBg.setLayoutParams(params);
|
||||||
if (bean.getType() == 6) {//大作战活动
|
if (bean.getType() == 6) {//大作战活动
|
||||||
view_action_game.setVisibility(View.VISIBLE);
|
view_action_game.setVisibility(View.VISIBLE);
|
||||||
@ -241,7 +250,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||||
} else {
|
} else {
|
||||||
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||||
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg,1);
|
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
|
||||||
}
|
}
|
||||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||||
if (bean.getType() == -3) {
|
if (bean.getType() == -3) {
|
||||||
@ -282,7 +291,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||||
} else {
|
} else {
|
||||||
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||||
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg,1);
|
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
|
||||||
}
|
}
|
||||||
String str1 = "火力四射,魅力無限!感謝";
|
String str1 = "火力四射,魅力無限!感謝";
|
||||||
String str2 = "為本直播間加成熱度";
|
String str2 = "為本直播間加成熱度";
|
||||||
@ -302,7 +311,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||||
} else {
|
} else {
|
||||||
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||||
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg,1);
|
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
|
||||||
}
|
}
|
||||||
String str1 = "甜蜜不停,愛意不斷!恭喜";
|
String str1 = "甜蜜不停,愛意不斷!恭喜";
|
||||||
String str2 = "在甜蜜約會中搶購到了";
|
String str2 = "在甜蜜約會中搶購到了";
|
||||||
@ -329,33 +338,48 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
}
|
}
|
||||||
if (isContains) {
|
if (isContains) {
|
||||||
mTextView.setTextColor(0xffffffff);
|
mTextView.setTextColor(0xffffffff);
|
||||||
mBg.setBackground(null);
|
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
|
||||||
mTextView.setText(bean.getContent());
|
mTextView.setText(bean.getContent());
|
||||||
}
|
}
|
||||||
} else if (bean.getType() == LiveChatBean.SYSTEM2) {
|
} else if (bean.getType() == LiveChatBean.SYSTEM2) {
|
||||||
mTextView.setTextColor(0xffffffff);
|
mTextView.setTextColor(0xffffffff);
|
||||||
mBg.setBackground(null);
|
mBg.setBackground(null);
|
||||||
mTextView.setText(bean.getContent());
|
mTextView.setText(bean.getContent());
|
||||||
} else if (bean.getType() == -1) {//自动消息,关注
|
}
|
||||||
boolean isContains = false;
|
// else if (bean.getType() == -1) {//自动消息,关注
|
||||||
for (LiveChatBean model : mList) {
|
// boolean isContains = false;
|
||||||
if (bean.getType() == -1) {
|
// for (LiveChatBean model : mList) {
|
||||||
isContains = true;
|
// if (bean.getType() == -1) {
|
||||||
}
|
// isContains = true;
|
||||||
}
|
// }
|
||||||
if (isContains) {
|
// }
|
||||||
mBg.setBackground(null);
|
// if (isContains) {
|
||||||
mTextView.setVisibility(View.GONE);
|
// mBg.setBackground(null);
|
||||||
view_follow.setVisibility(View.VISIBLE);
|
// mTextView.setVisibility(View.GONE);
|
||||||
ImgLoader.display(mContext, bean.getId(), avatar);
|
// view_follow.setVisibility(View.VISIBLE);
|
||||||
bean.setHeart(position);
|
// ImgLoader.display(mContext, bean.getId(), avatar);
|
||||||
}
|
// bean.setHeart(position);
|
||||||
|
// }
|
||||||
} else if (bean.getType() == -2) {//自动消息,点击发言
|
//
|
||||||
|
// }
|
||||||
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
|
else if (bean.getType() == -2) {//自动消息,点击发言
|
||||||
mTextView.setText(R.string.automatic_chat);
|
LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
params3.setMargins(0, 8, DpUtil.dp2px(95), 8);
|
||||||
|
params3.gravity = Gravity.CENTER_VERTICAL;
|
||||||
|
mBg.setLayoutParams(params3);
|
||||||
|
mBg.setBackground(null);
|
||||||
|
mTextView.setVisibility(View.GONE);
|
||||||
bean.setHeart(position);
|
bean.setHeart(position);
|
||||||
|
ImgLoader.display(mContext, bean.getId(), clipImage2);
|
||||||
|
attentionLayout.setVisibility(View.VISIBLE);
|
||||||
|
btnAttention.setVisibility(bean.isAttention() ? View.GONE : View.VISIBLE);
|
||||||
|
btnAttention.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LiveRoomViewHolder.follow();
|
||||||
|
btnAttention.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (bean.getType() == MSG_HOUR_RANK_CHANGE) {
|
} else if (bean.getType() == MSG_HOUR_RANK_CHANGE) {
|
||||||
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
|
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
|
||||||
mTextView.setText(bean.getContent());
|
mTextView.setText(bean.getContent());
|
||||||
@ -382,21 +406,20 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
new LiveTextRender().luckyAngel(mContext, mTextView, bean.getMsgModel());
|
new LiveTextRender().luckyAngel(mContext, mTextView, bean.getMsgModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(bean.getType() == LUCKY_100_CHECK){
|
} else if (bean.getType() == LUCKY_100_CHECK) {
|
||||||
if (!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())) {
|
if (!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())) {
|
||||||
bean.setId(bean.getMsgModel().getUserId());
|
bean.setId(bean.getMsgModel().getUserId());
|
||||||
itemView.setTag(bean);
|
itemView.setTag(bean);
|
||||||
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
|
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
|
||||||
new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel());
|
new LiveTextRender().lucky100(mContext, mTextView, bean.getMsgModel());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||||
//加载.9图聊天气泡
|
//加载.9图聊天气泡
|
||||||
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||||
} else {
|
} else {
|
||||||
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
// mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||||
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg,1);
|
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
|
||||||
}
|
}
|
||||||
if (bean.getType() == LiveChatBean.ENTER_ROOM || bean.getType() == LiveChatBean.LIGHT) {
|
if (bean.getType() == LiveChatBean.ENTER_ROOM || bean.getType() == LiveChatBean.LIGHT) {
|
||||||
mTextView.setTextColor(0xffc8c8c8);
|
mTextView.setTextColor(0xffc8c8c8);
|
||||||
@ -406,7 +429,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
|||||||
|
|
||||||
new LiveTextRender().render(mContext, mTextView, bean);
|
new LiveTextRender().render(mContext, mTextView, bean);
|
||||||
}
|
}
|
||||||
Animation animation = AnimationUtils.loadAnimation(itemView.getContext(),R.anim.live_chat_msg_in);
|
Animation animation = AnimationUtils.loadAnimation(itemView.getContext(), R.anim.live_chat_msg_in);
|
||||||
itemView.startAnimation(animation);
|
itemView.startAnimation(animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,17 @@ public class LiveChatBean {
|
|||||||
//@ID
|
//@ID
|
||||||
@SerializedName("atUserID")
|
@SerializedName("atUserID")
|
||||||
private String atUserID = "";
|
private String atUserID = "";
|
||||||
|
//用户是否关注主播
|
||||||
|
private boolean isAttention = false;
|
||||||
|
|
||||||
|
public boolean isAttention() {
|
||||||
|
return isAttention;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveChatBean setAttention(boolean attention) {
|
||||||
|
isAttention = attention;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAtUserName() {
|
public String getAtUserName() {
|
||||||
return atUserName;
|
return atUserName;
|
||||||
|
@ -158,10 +158,11 @@ public class LiveTextRender {
|
|||||||
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF86C")), giftIndexOf, giftIndexOf + giftSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
mTextView.setText(builder);
|
mTextView.setText(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 幸运100%活动
|
* 幸运100%活动
|
||||||
*/
|
*/
|
||||||
public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel){
|
public void lucky100(Context mContext, TextView mTextView, MsgModel msgModel) {
|
||||||
String msg = mContext.getString(R.string.lucky_100);
|
String msg = mContext.getString(R.string.lucky_100);
|
||||||
msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName());
|
msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName());
|
||||||
int unameIndexOf = msg.indexOf(msgModel.getUserName());
|
int unameIndexOf = msg.indexOf(msgModel.getUserName());
|
||||||
@ -199,7 +200,7 @@ public class LiveTextRender {
|
|||||||
int index = mContext.indexOf(userName);
|
int index = mContext.indexOf(userName);
|
||||||
int end = index + userName.length();
|
int end = index + userName.length();
|
||||||
int endIndex = startIndex + userName.length();
|
int endIndex = startIndex + userName.length();
|
||||||
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#fffe9b")),
|
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FBEABF")),
|
||||||
startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
mContext = mContext.substring(end + 1, mContext.length());
|
mContext = mContext.substring(end + 1, mContext.length());
|
||||||
startIndex = startIndex + end + 1;
|
startIndex = startIndex + end + 1;
|
||||||
@ -215,7 +216,7 @@ public class LiveTextRender {
|
|||||||
int end = index + name.length();
|
int end = index + name.length();
|
||||||
startIndex = index + startIndex;
|
startIndex = index + startIndex;
|
||||||
int endIndex = startIndex + name.length();
|
int endIndex = startIndex + name.length();
|
||||||
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#fffe9b")),
|
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#FBEABF")),
|
||||||
startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
mContext = mContext.substring(end, mContext.length());
|
mContext = mContext.substring(end, mContext.length());
|
||||||
startIndex = endIndex;
|
startIndex = endIndex;
|
||||||
@ -248,7 +249,7 @@ public class LiveTextRender {
|
|||||||
|
|
||||||
if (levelDrawable != null) {
|
if (levelDrawable != null) {
|
||||||
builder.append(" ");
|
builder.append(" ");
|
||||||
levelDrawable.setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(14));
|
levelDrawable.setBounds(0, 0, DpUtil.dp2px(17), DpUtil.dp2px(17));
|
||||||
builder.setSpan(new VerticalImageSpan(levelDrawable), 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();
|
||||||
}
|
}
|
||||||
@ -416,7 +417,6 @@ public class LiveTextRender {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImgLoader.DrawableCallback mCallback;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 等级设置
|
* 等级设置
|
||||||
@ -424,10 +424,9 @@ public class LiveTextRender {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
|
public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
|
||||||
mCallback = callback;
|
if (mContext instanceof Activity) {
|
||||||
if(mContext instanceof Activity){
|
if (((Activity) mContext).isDestroyed()) {
|
||||||
if(((Activity)mContext).isDestroyed()){
|
mContext = CommonAppContext.getTopActivity();
|
||||||
mContext=CommonAppContext.getTopActivity();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
|
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
|
||||||
@ -484,18 +483,76 @@ public class LiveTextRender {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getLiveLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
|
||||||
|
if (mContext instanceof Activity) {
|
||||||
|
if (((Activity) mContext).isDestroyed()) {
|
||||||
|
mContext = CommonAppContext.getTopActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
|
||||||
|
String imgUrl = "https://downs.yaoulive.com/level1/img_1-9.png";
|
||||||
|
for (NewLevelModel newLevelModel : models) {
|
||||||
|
if (newLevelModel.getLeveMin() <= userLevel && userLevel <= newLevelModel.getLeveMax()) {
|
||||||
|
imgUrl = newLevelModel.getLiveIcon();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Glide.with(mContext).asBitmap().load(imgUrl).into(new CustomTarget<Bitmap>() {
|
||||||
|
@Override
|
||||||
|
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||||
|
Observable.create(new ObservableOnSubscribe<Bitmap>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<Bitmap> emitter) throws Exception {
|
||||||
|
emitter.onNext(AddTimeLiveWatermark(resource, String.valueOf(userLevel)));//
|
||||||
|
}
|
||||||
|
}).subscribeOn(Schedulers.newThread())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Observer<Bitmap>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(Bitmap bitmap) {
|
||||||
|
BitmapDrawable drawable = new BitmapDrawable(bitmap);
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onLoadSuccess(drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onLoadFailed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
|
private void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
|
||||||
|
|
||||||
|
|
||||||
if (textView != null) {
|
if (textView != null) {
|
||||||
getLevelImage(context, bean.getLevel(), new ImgLoader.DrawableCallback() {
|
getLiveLevelImage(context, bean.getLevel(), new ImgLoader.DrawableCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadSuccess(Drawable drawable) {
|
public void onLoadSuccess(Drawable drawable) {
|
||||||
SpannableStringBuilder builder = createPrefix(drawable, bean);
|
SpannableStringBuilder builder = createPrefix(drawable, bean);
|
||||||
int color = Color.parseColor("#68F1F4");
|
int color = Color.parseColor("#68F1F4");
|
||||||
if (bean.isAnchor()) {
|
if (bean.isAnchor()) {
|
||||||
color = 0xffffdd00;
|
color =Color.parseColor("#FBEABF");
|
||||||
} else {
|
} else {
|
||||||
color = Color.parseColor("#68F1F4");
|
color = Color.parseColor("#68F1F4");
|
||||||
}
|
}
|
||||||
@ -535,6 +592,43 @@ public class LiveTextRender {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bitmap添加文字
|
||||||
|
*
|
||||||
|
* @param mBitmap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Bitmap AddTimeLiveWatermark(Bitmap mBitmap, String level) {
|
||||||
|
//获取原始图片与水印图片的宽与高
|
||||||
|
int mBitmapWidth = mBitmap.getWidth();
|
||||||
|
int mBitmapHeight = mBitmap.getHeight();
|
||||||
|
Bitmap mNewBitmap = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas mCanvas = new Canvas(mNewBitmap);
|
||||||
|
//向位图中开始画入MBitmap原始图片
|
||||||
|
mCanvas.drawBitmap(mBitmap, 0, 0, null);
|
||||||
|
//添加文字
|
||||||
|
Paint mPaint = new Paint();
|
||||||
|
Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
|
||||||
|
mPaint.setColor(Color.WHITE);
|
||||||
|
if (level.length() == 3) {
|
||||||
|
mPaint.setTextSize(27);
|
||||||
|
mPaint.setTypeface(font);
|
||||||
|
mCanvas.drawText(level, 3, 38, mPaint);
|
||||||
|
} else if (level.length() == 2) {
|
||||||
|
mPaint.setTextSize(30 );
|
||||||
|
mPaint.setTypeface(font);
|
||||||
|
mCanvas.drawText(level, 10, 38, mPaint);
|
||||||
|
}else if (level.length() == 1) {
|
||||||
|
mPaint.setTextSize(37 );
|
||||||
|
mPaint.setTypeface(font);
|
||||||
|
mCanvas.drawText(level, 16, 38, mPaint);
|
||||||
|
}
|
||||||
|
|
||||||
|
mCanvas.save();
|
||||||
|
mCanvas.restore();
|
||||||
|
return mNewBitmap;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bitmap添加文字
|
* bitmap添加文字
|
||||||
*
|
*
|
||||||
|
@ -448,15 +448,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
|||||||
if (!liveUid.equals(mLiveUid)) {
|
if (!liveUid.equals(mLiveUid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isattention == 0) {
|
LiveChatBean lvBean = new LiveChatBean();
|
||||||
LiveChatBean lvBean = new LiveChatBean();
|
lvBean.setType(-2);
|
||||||
lvBean.setType(-1);
|
lvBean.setId(url);
|
||||||
lvBean.setId(url);
|
lvBean.setAttention(isattention == 0);
|
||||||
LiveRoomViewHolder.insertChat(lvBean, 1);
|
LiveRoomViewHolder.insertChat(lvBean, 1);
|
||||||
}
|
|
||||||
LiveChatBean lvBean2 = new LiveChatBean();
|
|
||||||
lvBean2.setType(-2);
|
|
||||||
LiveRoomViewHolder.insertChat(lvBean2, 1);
|
|
||||||
Log.i("chatMgs", liveUid + "|" + mLiveUid);
|
Log.i("chatMgs", liveUid + "|" + mLiveUid);
|
||||||
}
|
}
|
||||||
}, 10000);//3秒后执行Runnable中的run方法
|
}, 10000);//3秒后执行Runnable中的run方法
|
||||||
|
5
live/src/main/res/drawable/chat_message_bg.xml
Normal file
5
live/src/main/res/drawable/chat_message_bg.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
<solid android:color="#30000000" />
|
||||||
|
</shape>
|
@ -3,22 +3,20 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/bg"
|
android:id="@+id/bg"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_txt"
|
android:id="@+id/text_txt"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="left"
|
|
||||||
android:layout_marginLeft="9dp"
|
android:layout_marginLeft="9dp"
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginRight="9dp"
|
android:layout_marginRight="9dp"
|
||||||
android:layout_marginBottom="6dp"
|
android:paddingBottom="7dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="#fff"
|
||||||
android:textSize="14sp"
|
android:textSize="12sp"
|
||||||
android:textStyle="bold"
|
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
tools:ignore="RtlHardcoded" />
|
tools:ignore="RtlHardcoded" />
|
||||||
|
|
||||||
@ -182,4 +180,40 @@
|
|||||||
android:layout_width="90dp"
|
android:layout_width="90dp"
|
||||||
android:layout_height="45dp" />
|
android:layout_height="45dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/attention_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/chat_message_bg"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<com.yunbao.common.views.weight.ClipPathCircleImage
|
||||||
|
android:id="@+id/clip_image2"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_margin="9dp"
|
||||||
|
android:scaleType="centerCrop" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginStart="48dp"
|
||||||
|
android:layout_marginEnd="73dp"
|
||||||
|
android:text="@string/automatic_chat"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btn_attention"
|
||||||
|
android:layout_width="54dp"
|
||||||
|
android:layout_height="26dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_margin="11dp"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:src="@mipmap/btn_attention" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
BIN
live/src/main/res/mipmap-xxxhdpi/btn_attention.png
Normal file
BIN
live/src/main/res/mipmap-xxxhdpi/btn_attention.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@ -70,6 +70,7 @@ import java.net.MalformedURLException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2018/9/22.
|
* Created by cxf on 2018/9/22.
|
||||||
@ -302,8 +303,15 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
|
|||||||
user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text));
|
user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text));
|
||||||
}
|
}
|
||||||
String singnature = u.getSignature();
|
String singnature = u.getSignature();
|
||||||
if (TextUtils.equals(singnature, "這個人很懶,什麼也沒留下") ||TextUtils.equals(singnature, "这家伙很懒,什么都没留下") || TextUtils.isEmpty(singnature)) {
|
if (TextUtils.equals(singnature, "這個人很懶,什麼也沒留下") || TextUtils.equals(singnature, "这家伙很懒,什么都没留下") || TextUtils.isEmpty(singnature)) {
|
||||||
singnature ="The guy was lazy and didn't write anything.";
|
String ct = Locale.getDefault().getCountry();
|
||||||
|
ct = TextUtils.equals("CN", ct) ? "HK" : ct;
|
||||||
|
if (TextUtils.equals(ct, "CN")) {
|
||||||
|
singnature = "這個人很懶,什麼也沒留下";
|
||||||
|
} else {
|
||||||
|
singnature = "The guy was lazy and didn't write anything.";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
signature.setText(singnature);
|
signature.setText(singnature);
|
||||||
CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
||||||
|
Loading…
Reference in New Issue
Block a user