高等级飘屏修改

This commit is contained in:
18401019693 2023-04-07 16:44:02 +08:00
parent f201e0978e
commit 18a5f46133
3 changed files with 17 additions and 12 deletions

View File

@ -409,7 +409,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1); new LoadDian9TuUtil().loadDian9TuAssets(mContext, mBg, 1);
xydComplete.setVisibility(View.VISIBLE); xydComplete.setVisibility(View.VISIBLE);
textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName())); textTxt2.setText(userNicenamehighlight(bean.getContent(), bean.getAtUserName(), bean.getUserNiceName()));
new LiveTextRender().getLiveLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { new LiveTextRender().getLiveLevelImage(mContext, bean.getLevel(), false,new ImgLoader.DrawableCallback() {
@Override @Override
public void onLoadSuccess(Drawable drawable) { public void onLoadSuccess(Drawable drawable) {
ImgLoader.display2(mContext, drawable, textLeave); ImgLoader.display2(mContext, drawable, textLeave);

View File

@ -178,7 +178,7 @@ public class LiveTextRender {
} }
public void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) { public void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
Log.i("AI小助手", "aiAutomaticSpeech: "+model.getIcon()); Log.i("AI小助手", "aiAutomaticSpeech: " + model.getIcon());
ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() { ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() {
@Override @Override
public void onLoadSuccess(Drawable drawable) { public void onLoadSuccess(Drawable drawable) {
@ -485,7 +485,7 @@ public class LiveTextRender {
}); });
} }
public void getLiveLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) { public void getLiveLevelImage(Context mContext, int userLevel, boolean max, ImgLoader.DrawableCallback callback) {
if (mContext instanceof Activity) { if (mContext instanceof Activity) {
if (((Activity) mContext).isDestroyed()) { if (((Activity) mContext).isDestroyed()) {
mContext = CommonAppContext.getTopActivity(); mContext = CommonAppContext.getTopActivity();
@ -493,12 +493,17 @@ public class LiveTextRender {
} }
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels(); List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
String imgUrl = "https://downs.yaoulive.com/level1/img_1-9.png"; String imgUrl = "https://downs.yaoulive.com/level1/img_1-9.png";
for (NewLevelModel newLevelModel : models) { if (max) {
if (newLevelModel.getLeveMin() <= userLevel && userLevel <= newLevelModel.getLeveMax()) { imgUrl = models.get(models.size() - 1).getLiveIcon();
imgUrl = newLevelModel.getLiveIcon(); } else {
for (NewLevelModel newLevelModel : models) {
if (newLevelModel.getLeveMin() <= userLevel && userLevel <= newLevelModel.getLeveMax()) {
imgUrl = newLevelModel.getLiveIcon();
}
} }
} }
Glide.with(mContext).asBitmap().load(imgUrl).into(new CustomTarget<Bitmap>() { Glide.with(mContext).asBitmap().load(imgUrl).into(new CustomTarget<Bitmap>() {
@Override @Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
@ -548,13 +553,13 @@ public class LiveTextRender {
if (textView != null) { if (textView != null) {
getLiveLevelImage(context, bean.getLevel(), 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); SpannableStringBuilder builder = createPrefix(drawable, bean);
int color = Color.parseColor("#68F1F4"); int color = Color.parseColor("#68F1F4");
if (bean.isAnchor()) { if (bean.isAnchor()) {
color =Color.parseColor("#FBEABF"); color = Color.parseColor("#FBEABF");
} else { } else {
color = Color.parseColor("#68F1F4"); color = Color.parseColor("#68F1F4");
} }
@ -617,11 +622,11 @@ public class LiveTextRender {
mPaint.setTypeface(font); mPaint.setTypeface(font);
mCanvas.drawText(level, 3, 38, mPaint); mCanvas.drawText(level, 3, 38, mPaint);
} else if (level.length() == 2) { } else if (level.length() == 2) {
mPaint.setTextSize(30 ); mPaint.setTextSize(30);
mPaint.setTypeface(font); mPaint.setTypeface(font);
mCanvas.drawText(level, 10, 38, mPaint); mCanvas.drawText(level, 10, 38, mPaint);
}else if (level.length() == 1) { } else if (level.length() == 1) {
mPaint.setTextSize(37 ); mPaint.setTextSize(37);
mPaint.setTypeface(font); mPaint.setTypeface(font);
mCanvas.drawText(level, 16, 38, mPaint); mCanvas.drawText(level, 16, 38, mPaint);
} }

View File

@ -4557,7 +4557,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
enterRoomLeave2.setBackgroundResource(R.drawable.bg_100_leave); enterRoomLeave2.setBackgroundResource(R.drawable.bg_100_leave);
} }
new LiveTextRender().getLiveLevelImage(mContext, model.getLevel(), new ImgLoader.DrawableCallback() { new LiveTextRender().getLiveLevelImage(mContext, model.getLevel(), true,new ImgLoader.DrawableCallback() {
@Override @Override
public void onLoadSuccess(Drawable drawable) { public void onLoadSuccess(Drawable drawable) {
ImgLoader.display2(mContext, drawable, imageView); ImgLoader.display2(mContext, drawable, imageView);