xiu gai xinyuan dan

This commit is contained in:
18401019693 2023-04-07 17:34:39 +08:00
parent 51bf55fdeb
commit 8cbbd4015f
5 changed files with 56 additions and 32 deletions

View File

@ -1298,7 +1298,7 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case WISH_LIST_PROGRESS:
if (manager != null) {
manager.wishListProgress(event.getWishListProgress(), event.getUname());
manager.wishListProgress(event.getWishListProgress(), event.getUname(),event.getLiveType());
}
break;
case XYD_COMPLETE:

View File

@ -13,7 +13,6 @@ import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
@ -40,6 +39,7 @@ import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.custom.VerticalImageSpan;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
@ -401,18 +401,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
//加载.9图聊天气泡
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
xydComplete.setVisibility(View.VISIBLE);
textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName()));
mTextView.setVisibility(View.GONE);
textLeave.setVisibility(View.GONE);
} else if (bean.getType() == XYD_COMPLETE) {
//加载.9图聊天气泡
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
xydComplete.setVisibility(View.VISIBLE);
textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName()));
new LiveTextRender().getLiveLevelImage(mContext, bean.getLevel(), false, new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
ImgLoader.display2(mContext, drawable, textLeave);
textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName(), drawable));
}
@Override
@ -421,6 +414,25 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
}
});
mTextView.setVisibility(View.GONE);
textLeave.setVisibility(View.GONE);
} else if (bean.getType() == XYD_COMPLETE) {
//加载.9图聊天气泡
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
xydComplete.setVisibility(View.VISIBLE);
new LiveTextRender().getLiveLevelImage(mContext, bean.getLevel(), false, new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName(), drawable));
}
@Override
public void onLoadFailed() {
}
});
mTextView.setVisibility(View.GONE);
textLeave.setVisibility(View.GONE);
} else if (bean.getType() == AI_AUTOMATIC_SPEECH) {
//加载.9图聊天气泡
new LoadDian9TuUtil().loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1);
@ -633,22 +645,33 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
}
private Spanned userNicenamehighlight(String context, String keyword, String keyword2) {
String contextHtml = "";
String keywordHtml2;
String keywordHtml;
if (TextUtils.isEmpty(keyword) || TextUtils.isEmpty(keyword2)) {
keywordHtml2 = TextUtils.isEmpty(keyword) ? "1" : keyword;
keywordHtml = TextUtils.isEmpty(keyword) ? "1" : keyword;
} else {
keywordHtml2 = "</font><font color='#4BFFD4'size='42px'>" + keyword + "</font><font color='#ffffff'size='42px'>";
keywordHtml = "</font><font color='#4BFFD4'size='42px'>" + keyword2 + "</font><font color='#ffffff'size='42px'>";
private Spanned userNicenamehighlight(String context, String keyword, String keyword2, Drawable levelDrawable) {
// String contextHtml = "";
// String keywordHtml2;
// String keywordHtml;
// if (TextUtils.isEmpty(keyword) || TextUtils.isEmpty(keyword2)) {
// keywordHtml2 = TextUtils.isEmpty(keyword) ? "1" : keyword;
// keywordHtml = TextUtils.isEmpty(keyword) ? "1" : keyword;
// } else {
// keywordHtml2 = "</font><font color='#4BFFD4'size='42px'>" + keyword + "</font><font color='#ffffff'size='42px'>";
// keywordHtml = "</font><font color='#4BFFD4'size='42px'>" + keyword2 + "</font><font color='#ffffff'size='42px'>";
// }
//
// contextHtml = "<font color='#ffffff'size='42px'>" + context + "</font>";
// contextHtml = contextHtml.replace(keyword, keywordHtml2).replace(keyword2, keywordHtml);
SpannableStringBuilder builder = new SpannableStringBuilder();
int index = 0;
if (levelDrawable != null) {
builder.append(" ");
levelDrawable.setBounds(0, 0, DpUtil.dp2px(18), DpUtil.dp2px(18));
builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
index = builder.length();
}
contextHtml = "<font color='#ffffff'size='42px'>" + context + "</font>";
contextHtml = contextHtml.replace(keyword, keywordHtml2).replace(keyword2, keywordHtml);
return Html.fromHtml(contextHtml);
builder.append(context);
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#4BFFD4")), index + context.indexOf(keyword), index + context.indexOf(keyword) + keyword.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#4BFFD4")), index + context.indexOf(keyword2), index + context.indexOf(keyword2) + keyword2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return builder;
}
}

View File

@ -615,7 +615,7 @@ public class SocketRyClient {
.setWishlistName(map.getString("wishlist_name"))
.setWishlistNum(map.getString("wishlist_num"))
.setGiftType(map.getInteger("giftId"))
.setLuid(conString.toString())).setUname(map.getString("userName")));
.setLuid(conString.toString())).setUname(map.getString("userName")).setLiveType(Integer.parseInt(map.getString("level"))));
break;
}

View File

@ -4234,7 +4234,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public void wishListProgress(WishModel wishModel, String userNiceName) {
public void wishListProgress(WishModel wishModel, String userNiceName,int level) {
wishListProgress = null;
WishModel model = wishModel;
if (!TextUtils.isEmpty(model.getWishlistName()) || !TextUtils.isEmpty(model.getWishlistProgress())) {
@ -4261,6 +4261,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bean.setUserNiceName(userNiceName);
bean.setAtUserName(model.getWishlistName());
bean.setType(LiveChatBean.WISH_LIST_PROGRESS);
bean.setLevel(level);
mLiveChatAdapter.insertItem(bean);
topBanner1.update(mTopBannerList);
}

View File

@ -1945,9 +1945,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
public void wishListProgress(WishModel wishListProgress, String userNiceName) {
public void wishListProgress(WishModel wishListProgress, String userNiceName,int level) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.wishListProgress(wishListProgress, userNiceName);
mLiveRoomViewHolder.wishListProgress(wishListProgress, userNiceName,level);
}
}
public void showXydComplete(XydCompleteModel model) {