From aad607ace83d11b10ce4f8a3805255faacf13554 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 4 Jan 2024 15:07:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=80=81=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=AD=89=E7=BA=A7=E4=B8=BB=E6=92=AD=E7=AD=89=E7=BA=A7?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/CommonAppConfig.java | 42 --------------- .../adapter/AnchorUserMicInfoAdapter.java | 18 +++++-- .../com/yunbao/live/adapter/GuardAdapter.java | 32 ++++++++--- .../live/adapter/LiveAdminListAdapter.java | 18 +++++-- .../yunbao/live/adapter/LiveBlackAdapter.java | 18 +++++-- .../live/adapter/LiveShutUpAdapter.java | 18 +++++-- .../live/adapter/UserMicInfoAdapter.java | 17 ++++-- .../live/adapter/UserMoreInfoAdapter.java | 25 +++++---- .../dialog/LiveGiveHotDialogFragment.java | 7 ++- .../LiveNewGuardListDialogFragment.java | 42 +++++++++------ .../dialog/LiveOldUserDialogFragment.java | 13 +++-- .../live/presenter/LiveLinkMicPresenter.java | 17 ++++-- .../com/yunbao/live/utils/LiveTextRender.java | 13 ++--- .../yunbao/live/views/DanmuViewHolder.java | 18 ++++--- .../live/views/FansDanmuViewHolder.java | 15 ++++-- .../yunbao/main/adapter/SearchAdapter.java | 16 ++++-- .../yunbao/main/views/MainMeViewHolder.java | 39 ++++++++------ .../yunbao/main/views/MainMeViewHolder1.java | 54 +++++++++++-------- .../main/views/SearchResultsViewHolder.java | 22 +++++--- .../yunbao/main/views/UserHomeViewHolder.java | 15 ++++-- .../main/views/UserHomeViewHolder2.java | 13 ++++- main/src/main/res/layout/item_search.xml | 13 ++--- 22 files changed, 298 insertions(+), 187 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index e06e1f650..6b1a7119d 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -12,7 +12,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.FansMedalBean; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserItemBean; import com.yunbao.common.http.CommonHttpUtil; @@ -29,7 +28,6 @@ import java.util.Map; /** * Created by cxf on 2017/8/4. */ - public class CommonAppConfig { //域名 public static final String HOST = getMetaDataString("SERVER_HOST"); @@ -109,7 +107,6 @@ public class CommonAppConfig { private boolean mLaunched;//App是否启动了 private String mJPushAppKey;//极光推送的AppKey private List mUserItemList;//个人中心功能列表 - private SparseArray mLevelMap; private SparseArray mAnchorFansMedalMap; private String mGiftListJson; private String mWrapListJson; @@ -520,27 +517,6 @@ public class CommonAppConfig { } - /** - * 保存用户等级信息 - */ - public void setLevel(String levelJson) { - if (TextUtils.isEmpty(levelJson)) { - return; - } - List list = JSON.parseArray(levelJson, LevelBean.class); - if (list == null || list.size() == 0) { - return; - } - if (mLevelMap == null) { - mLevelMap = new SparseArray<>(); - } - mLevelMap.clear(); - for (LevelBean bean : list) { - mLevelMap.put(bean.getLevel(), bean); - } - } - - /** * 保存主播粉丝徽章信息 */ @@ -579,24 +555,6 @@ public class CommonAppConfig { } - /** - * 获取用户等级 - */ - public LevelBean getLevel(int level) { - if (mLevelMap == null) { - String configString = SpUtil.getInstance().getStringValue(SpUtil.CONFIG); - if (!TextUtils.isEmpty(configString)) { - JSONObject obj = JSON.parseObject(configString); - setLevel(obj.getString("level")); - } - } - if (mLevelMap == null || mLevelMap.size() == 0) { - return null; - } - return mLevelMap.get(level); - } - - public String getGiftListJson() { return mGiftListJson; } diff --git a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java index 8d0d5c0c7..05b04fc0d 100644 --- a/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/AnchorUserMicInfoAdapter.java @@ -1,6 +1,7 @@ package com.yunbao.live.adapter; import android.content.Context; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -36,6 +37,7 @@ import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.socket.SocketSendBean; +import com.yunbao.live.utils.LiveTextRender; import java.net.MalformedURLException; import java.net.URL; @@ -287,10 +289,18 @@ public class AnchorUserMicInfoAdapter extends RefreshAdapter { mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); + } } diff --git a/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java b/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java index 3136aad50..7d7179083 100644 --- a/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java @@ -22,6 +22,7 @@ import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.bean.GuardUserBean; +import com.yunbao.live.utils.LiveTextRender; /** * Created by cxf on 2018/11/6. @@ -111,10 +112,18 @@ public class GuardAdapter extends RefreshAdapter { ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); mVotes.setText(Html.fromHtml(" " + bean.getContribute() + " " + mVotesName)); } } @@ -146,10 +155,17 @@ public class GuardAdapter extends RefreshAdapter { ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); mVotes.setText(bean.getContribute() + " " + mVotesName); if (bean.getType() == Constants.GUARD_TYPE_DAY) { mIcon.setImageDrawable(mGuardDrawable0); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveAdminListAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveAdminListAdapter.java index bbf0f2b15..8f4b05eaf 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveAdminListAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveAdminListAdapter.java @@ -3,6 +3,8 @@ package com.yunbao.live.adapter; import android.content.Context; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; + +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -18,6 +20,7 @@ import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.live.utils.LiveTextRender; import java.util.List; @@ -106,10 +109,17 @@ public class LiveAdminListAdapter extends RecyclerView.Adapter { ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); } } } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveShutUpAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveShutUpAdapter.java index 798104ee5..40e557ec9 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveShutUpAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveShutUpAdapter.java @@ -3,6 +3,8 @@ package com.yunbao.live.adapter; import android.content.Context; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; + +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; @@ -16,6 +18,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.live.R; import com.yunbao.live.bean.LiveShutUpBean; +import com.yunbao.live.utils.LiveTextRender; import java.util.List; @@ -103,10 +106,17 @@ public class LiveShutUpAdapter extends RefreshAdapter { ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); } } } diff --git a/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java index 4bd7681ef..25c2058e8 100644 --- a/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/UserMicInfoAdapter.java @@ -5,6 +5,7 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import android.graphics.drawable.Drawable; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -24,6 +25,7 @@ import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.common.bean.MicUserBean; +import com.yunbao.live.utils.LiveTextRender; import java.net.MalformedURLException; import java.net.URL; @@ -114,10 +116,17 @@ public class UserMicInfoAdapter extends RefreshAdapter { mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); } } diff --git a/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java b/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java index c4eaccdff..9bf903d9d 100644 --- a/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/UserMoreInfoAdapter.java @@ -24,7 +24,6 @@ import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserRankBean; import com.yunbao.common.bean.UserBean; @@ -148,7 +147,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter { } }); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); + title.setVisibility(View.GONE); title1.setVisibility(View.GONE); @@ -285,20 +284,20 @@ public class UserMoreInfoAdapter extends RefreshAdapter { } mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - if (levelBean != null) { - new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { - @Override - public void onLoadSuccess(Drawable drawable) { - ImgLoader.display2(mContext, drawable, mLevel); - } - @Override - public void onLoadFailed() { + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); - } - }); - } if (bean.isHide() && (type.equals("5") || type.equals("4"))) { mName.setText(R.string.mystery_man); ImgLoader.display2(mContext, R.mipmap.hide, mAvatar); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java index 3c5006f27..84b75209c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiveHotDialogFragment.java @@ -205,9 +205,8 @@ public class LiveGiveHotDialogFragment extends AbsDialogFragment { ImgLoader.displayAvatar(mContext, mDatas.get(position).getUser_avatar(), viewHolder.img_head); viewHolder.tv_name.setText(mDatas.get(position).getUser_name()); viewHolder.sex.setImageResource(CommonIconUtil.getSexIcon(mDatas.get(position).getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(mDatas.get(position).getLevel()); - if (levelBean != null) { - new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { + + new LiveTextRender().getLevelImage(mContext, mDatas.get(position).getLevel(), new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { ImgLoader.display2(mContext, drawable, viewHolder.level); @@ -218,7 +217,7 @@ public class LiveGiveHotDialogFragment extends AbsDialogFragment { } }); - } + String hotStr = mDatas.get(position).getHot_score().substring(0, mDatas.get(position).getHot_score().length() - 3); viewHolder.tv_hot_number.setText(hotStr + "k"); viewHolder.tv_hot_time.setText(mDatas.get(position).getHot_score_end_time()); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java index fcef13ade..665129020 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java @@ -1,5 +1,6 @@ package com.yunbao.live.dialog; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.Gravity; import android.view.View; @@ -18,21 +19,20 @@ import androidx.recyclerview.widget.LinearLayoutManager; import com.alibaba.fastjson.JSON; import com.opensource.svgaplayer.SVGAImageView; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.adapter.GuardAdapter; import com.yunbao.live.bean.GuardUserBean; import com.yunbao.live.bean.LiveGuardInfo; -import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.live.utils.LiveTextRender; import java.util.ArrayList; import java.util.Arrays; @@ -45,7 +45,7 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements private ImageView guardIcon, userSex, userLevel; private ConstraintLayout mRootLayout; private CommonRefreshView mRefreshView; - private TextView mBtnBuy, userName, userGuard,tip1, tip2; + private TextView mBtnBuy, userName, userGuard, tip1, tip2; private SVGAImageView giftSvga; private LinearLayout userLayout; @@ -54,7 +54,7 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements private String mLiveUid; private boolean mIsAnchor;//是否是主播 private boolean showBuyView; - private List list=new ArrayList<>(); + private List list = new ArrayList<>(); private RelativeLayout relativeLayout; @Override @@ -95,7 +95,7 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements } mIsAnchor = bundle.getBoolean(Constants.ANCHOR, false); mLiveUid = bundle.getString(Constants.LIVE_UID); - showBuyView = bundle.getBoolean("showBuyView",true); + showBuyView = bundle.getBoolean("showBuyView", true); guardIcon = mRootView.findViewById(R.id.guard_imageView); mRootLayout = mRootView.findViewById(R.id.guard_constraintLayout); mBtnBuy = mRootView.findViewById(R.id.guard_btn_buy); @@ -138,8 +138,8 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements @Override public List processData(String[] info) { List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); - if(!list.isEmpty()){ - LiveNewGuardListDialogFragment.this.list=list; + if (!list.isEmpty()) { + LiveNewGuardListDialogFragment.this.list = list; setAdapterData(); } return list; @@ -167,7 +167,7 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements }); mRefreshView.setRecyclerViewAdapter(mGuardAdapter); mGuardAdapter.notifyDataSetChanged(); - if(!showBuyView){ + if (!showBuyView) { relativeLayout.setVisibility(View.GONE); } } @@ -184,10 +184,11 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements initView(); return show; } - private void setAdapterData(){ + + private void setAdapterData() { if (list.isEmpty()) { userLayout.setVisibility(View.INVISIBLE); - }else { + } else { GuardUserBean bean = list.get(0); giftSvga.setImageResource(R.mipmap.guardian_img_wings_p); ImgLoader.display(mContext, bean.getAvatar(), guardIcon); @@ -196,10 +197,18 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements String guardString = mContext.getString(R.string.guard_week_con); userGuard.setText(guardString + " " + bean.getContribute()); userSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), userLevel); - } + + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, userLevel); + } + + @Override + public void onLoadFailed() { + + } + }); } if (mLiveGuardInfo != null) { int guardType = mLiveGuardInfo.getMyGuardType(); @@ -217,7 +226,8 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements } } } + public void setList(List list) { - this.list=list; + this.list = list; } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java index 80e006e29..21f31a484 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -414,12 +414,17 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View } } ImgLoader.display(mContext, imgUrl, mLevelAnchor); + new LiveTextRender().getLevelImage(mContext,obj.getIntValue("level"), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + @Override + public void onLoadFailed() { - LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level")); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getBgIcon(), mLevel); - } + } + }); mLevelAnchorText.setText(String.valueOf(levelAnchor)); mLevelText.setText(String.valueOf(level)); mSex.setImageResource(CommonIconUtil.getSexIcon(obj.getIntValue("sex"))); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java index f0a530658..94e948388 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -5,6 +5,7 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -53,6 +54,7 @@ import com.yunbao.live.interfaces.ILiveLinkMicViewHolder; import com.yunbao.live.interfaces.LivePushListener; import com.yunbao.live.socket.SocketClient; import com.yunbao.live.socket.SocketLinkMicUtil; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.views.AbsLiveLinkMicPlayViewHolder; import com.yunbao.live.views.AbsLiveLinkMicPushViewHolder; import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder; @@ -631,10 +633,17 @@ public class LiveLinkMicPresenter implements View.OnClickListener { ImgLoader.display(mContext, u.getAvatar(), avatar); name.setText(u.getUserNiceName()); sex.setImageResource(CommonIconUtil.getSexIcon(u.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(u.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), level); - } + new LiveTextRender().getLevelImage(mContext, u.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, level); + } + + @Override + public void onLoadFailed() { + + } + }); mLinkMicWaitCount = LINK_MIC_COUNT_MAX; mLinkMicWaitText.setText(mLinkMicWaitString + "(" + mLinkMicWaitCount + ")..."); mLinkMicPopWindow = new PopupWindow(v, DpUtil.dp2px(280), ViewGroup.LayoutParams.WRAP_CONTENT, true); 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 698c9bf6a..33b049c19 100644 --- a/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java +++ b/live/src/main/java/com/yunbao/live/utils/LiveTextRender.java @@ -31,11 +31,9 @@ import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.request.target.CustomTarget; import com.bumptech.glide.request.transition.Transition; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; import com.yunbao.common.Constants; import com.yunbao.common.bean.AiAutomaticSpeechModel; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.MsgModel; import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.custom.VerticalImageSpan; @@ -762,11 +760,14 @@ public class LiveTextRender { } private void renderEnterRoomTMP(Context context, final TextView textView, final LiveChatBean bean) { - final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean == null) { - return; + List models = new NewLevelManager(context).getNewLevelModels(); + String imgUrl = "https://downs.yaoulive.com/level/user_lv1_bg.png"; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= bean.getLevel() && bean.getLevel() <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } } - ImgLoader.displayDrawable(context, levelBean.getThumb(), new ImgLoader.DrawableCallback() { + ImgLoader.displayDrawable(context, imgUrl, new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { if (textView != null) { diff --git a/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java b/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java index c4606d746..548c480a0 100644 --- a/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/DanmuViewHolder.java @@ -10,9 +10,9 @@ import android.view.animation.LinearInterpolator; import android.widget.ImageView; import android.widget.TextView; -import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.views.AbsViewHolder; @@ -20,6 +20,8 @@ import com.yunbao.live.R; import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.interfaces.IDanmuActionListener; +import java.util.List; + /** * Created by cxf on 2017/8/25. * 弹幕 @@ -87,12 +89,16 @@ public class DanmuViewHolder extends AbsViewHolder { public void show(LiveDanMuBean bean, int lineNum) { mLineNum = lineNum; - ImgLoader.display(mContext,bean.getAvatar(), mAvatar); + ImgLoader.display(mContext, bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - mName.setTextColor(Color.parseColor(levelBean.getColor())); + List models = new NewLevelManager(mContext).getNewLevelModels(); + String imgUrl = "#68F1F4"; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= bean.getLevel() && bean.getLevel() <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getColour(); + } } + mName.setTextColor(Color.parseColor(imgUrl)); mContent.setText(bean.getContent()); mCanNext = false; mContentView.measure(0, 0); diff --git a/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java b/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java index 9b786b1c3..6e45cae40 100644 --- a/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/FansDanmuViewHolder.java @@ -12,13 +12,17 @@ import android.widget.TextView; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.live.R; import com.yunbao.live.bean.LiveDanMuBean; import com.yunbao.live.interfaces.IDanmuActionListener; +import java.util.List; + /** * Created by cxf on 2017/8/25. * 弹幕 @@ -89,10 +93,15 @@ public class FansDanmuViewHolder extends DanmuViewHolder { mLineNum = lineNum; ImgLoader.display(mContext,bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()+":"); - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - mName.setTextColor(Color.parseColor(levelBean.getColor())); + + List models = new NewLevelManager(mContext).getNewLevelModels(); + String imgUrl = "#68F1F4"; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= bean.getLevel() && bean.getLevel() <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getColour(); + } } + mName.setTextColor(Color.parseColor(imgUrl)); mContent.setText(bean.getContent()); mCanNext = false; mContentView.measure(0, 0); diff --git a/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java b/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java index 175ed5a40..d3ff13be0 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java @@ -1,6 +1,7 @@ package com.yunbao.main.adapter; import android.content.Context; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; @@ -27,6 +28,7 @@ import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.RouteUtil; import com.yunbao.live.bean.SearchUserBean; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.main.R; import java.util.List; @@ -172,11 +174,17 @@ public class SearchAdapter extends RefreshAdapter { } leave.setText(bean.getLevelAnchor() + ""); ImgLoader.display(itemView.getContext(), imgUrl, mLevelAnchor); + new LiveTextRender().getLevelImage(mContext, bean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } + @Override + public void onLoadFailed() { + + } + }); } } diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index 079820aee..d6f6dd28f 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -5,6 +5,7 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.graphics.Outline; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -34,7 +35,6 @@ import com.yunbao.common.Constants; import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.GoogleBean; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserItemBean; import com.yunbao.common.event.CompleteInformationEvent; @@ -55,6 +55,7 @@ import com.yunbao.live.activity.LiveRecordActivity; import com.yunbao.live.activity.RoomManageActivity; import com.yunbao.live.activity.WebViewActivityMedal; import com.yunbao.live.bean.SlideBean; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.views.CustomMyViewHolder; import com.yunbao.main.R; import com.yunbao.main.activity.EditProfileActivity; @@ -375,20 +376,28 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } else { Constants.isAnchor = false; - LevelBean levelBean = appConfig.getLevel(u.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - //用户等级 - tv_level.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - MobclickAgent.onEvent(mContext, "my_top_level", "个人中心最上面的等级"); - String url = CommonAppConfig.HOST + "/h5/Grade/index.html?" + "token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + ((IMLoginManager.get(CommonAppContext.sInstance.getBaseContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); - ZhuangBanActivity.forward(mContext, url); - } - }); - tv_level.setText(levelBean.getLevel() + ""); - } + new LiveTextRender().getLevelImage(mContext, u.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); + //用户等级 + tv_level.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + MobclickAgent.onEvent(mContext, "my_top_level", "个人中心最上面的等级"); + String url = CommonAppConfig.HOST + "/h5/Grade/index.html?" + "token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + ((IMLoginManager.get(CommonAppContext.sInstance.getBaseContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"); + ZhuangBanActivity.forward(mContext, url); + } + }); + tv_level.setText(u.getLevel() + ""); + } //修改靓号图标 个人中心 if (u.getGoodnum() != null && !u.getGoodnum().equals("")) { diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java index 0cd1dfaf1..446c466d1 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java @@ -3,8 +3,7 @@ package com.yunbao.main.views; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -14,6 +13,9 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; @@ -22,7 +24,6 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.GoogleBean; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserItemBean; @@ -37,6 +38,7 @@ import com.yunbao.common.views.AbsMainViewHolder; import com.yunbao.live.activity.LiveRecordActivity; import com.yunbao.live.activity.RoomManageActivity; import com.yunbao.live.activity.WebViewActivityMedal; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.main.R; import com.yunbao.main.activity.EditProfileActivity; import com.yunbao.main.activity.FansActivity; @@ -79,7 +81,7 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL private View v_noble; // private LinearLayout btnUserNoble; private ImageView user_noble_ico, good_nub_ico; - private TextView user_noble_text,leave; + private TextView user_noble_text, leave; private UserItemBean beanStetting = null, beanKefu = null; private boolean firstInto = true; @@ -151,16 +153,16 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL mLevelAnchor.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Level&a=index" + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0") + "&for"; - WebViewActivity.forward(mContext, url,false); + String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Level&a=index" + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0") + "&for"; + WebViewActivity.forward(mContext, url, false); } }); //用户等级 mLevel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Level&a=index" + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); - WebViewActivity.forward(mContext, url,false); + String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Level&a=index" + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); + WebViewActivity.forward(mContext, url, false); } }); @@ -297,20 +299,26 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL int anchorLevel = 0; - anchorLevel = u.getLevelAnchor(); - String imgUrl = ""; - for (NewLevelModel newLevelModel : models) { - if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { - imgUrl = newLevelModel.getThumb(); - } + anchorLevel = u.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); } - leave.setText(String.valueOf(u.getLevelAnchor())); - ImgLoader.display(mContext, imgUrl, mLevelAnchor); - - LevelBean levelBean = appConfig.getLevel(u.getLevel()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); } + leave.setText(String.valueOf(u.getLevelAnchor())); + ImgLoader.display(mContext, imgUrl, mLevelAnchor); + new LiveTextRender().getLevelImage(mContext, u.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + + @Override + public void onLoadFailed() { + + } + }); //修改靓号图标 个人中心 if (u.getGoodnum() != null && !u.getGoodnum().equals("")) { good_nub_ico.setVisibility(View.VISIBLE); @@ -387,7 +395,7 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL Log.i("tsa", url); RewardActivity.forward(mContext, url); } else { - WebViewActivity.forward(mContext, url,false); + WebViewActivity.forward(mContext, url, false); } } @@ -415,12 +423,12 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL } else if (i == R.id.btn_gold) { mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0)); } else if (i == R.id.rt_kefu) { - WebViewActivity.forward(mContext, beanKefu.getHref(),false); + WebViewActivity.forward(mContext, beanKefu.getHref(), false); } else if (i == R.id.rt_setting) { forwardSetting(); } else if (i == R.id.v_noble) { UserBean u = CommonAppConfig.getInstance().getUserBean(); - String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); + String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); ZhuangBanActivity.forward(mContext, url, false); } diff --git a/main/src/main/java/com/yunbao/main/views/SearchResultsViewHolder.java b/main/src/main/java/com/yunbao/main/views/SearchResultsViewHolder.java index 2f96dcfca..159f2f07c 100644 --- a/main/src/main/java/com/yunbao/main/views/SearchResultsViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/SearchResultsViewHolder.java @@ -1,5 +1,6 @@ package com.yunbao.main.views; +import android.graphics.drawable.Drawable; import android.text.Html; import android.text.Spanned; import android.text.TextUtils; @@ -13,8 +14,6 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; -import com.yunbao.common.CommonAppConfig; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.glide.ImgLoader; @@ -23,6 +22,7 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordsTypeUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.main.R; import com.yunbao.main.event.JumpUserHomeEvent; @@ -72,14 +72,22 @@ public class SearchResultsViewHolder extends RecyclerView.ViewHolder { ImgLoader.displayAvatar(itemView.getContext(), model.getAvatar(), avatar); Glide.with(itemView.getContext()) .asGif() - .load(WordUtil.isNewZh()?R.mipmap.icon_user_home_living:R.mipmap.icon_user_home_living_en).skipMemoryCache(false) + .load(WordUtil.isNewZh() ? R.mipmap.icon_user_home_living : R.mipmap.icon_user_home_living_en).skipMemoryCache(false) .into(isLive); //用戶直接隱藏 if (type == 3) { - LevelBean levelBean = CommonAppConfig.getInstance().getLevel(Integer.parseInt(model.getLevel())); - if (levelBean != null) { - ImgLoader.display(itemView.getContext(), levelBean.getThumb(), contribute); - } + + new LiveTextRender().getLevelImage(itemView.getContext(), Integer.parseInt(model.getLevel()), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(itemView.getContext(), drawable, contribute); + } + + @Override + public void onLoadFailed() { + + } + }); isLive.setVisibility(View.GONE); } else { List models = new NewLevelManager(itemView.getContext()).getNewAnchorLevelModels(); diff --git a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder.java index cb7ff3b25..ad4d0b625 100644 --- a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -23,7 +24,6 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.adapter.ViewPagerAdapter; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.event.FollowEvent; @@ -44,6 +44,7 @@ import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.custom.MyTextView; import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.presenter.UserHomeSharePresenter; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.views.AbsLivePageViewHolder; import com.yunbao.live.views.AbsUserHomeViewHolder; import com.yunbao.live.views.LiveRecordViewHolder; @@ -368,11 +369,17 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL } leave.setText(String.valueOf(anchorLevel)); ImgLoader.display(mContext, imgUrl, mLevelAnchor); + new LiveTextRender().getLevelImage(mContext, userBean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } + @Override + public void onLoadFailed() { - LevelBean level = appConfig.getLevel(userBean.getLevel()); - ImgLoader.display(mContext, level.getThumb(), mLevel); - + } + }); mID.setText(userBean.getLiangNameTip()); String fansNum = StringUtil.toWan(userBean.getFans()); mBtnFans.setText(fansNum + " " + mContext.getString(R.string.fans)); diff --git a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java index e4044d0fb..7f691cf41 100644 --- a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java +++ b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java @@ -59,6 +59,7 @@ import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.presenter.UserHomeSharePresenter; +import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.views.AbsLivePageViewHolder; import com.yunbao.live.views.AbsUserHomeViewHolder; import com.yunbao.live.views.LiveRecordViewHolder; @@ -516,9 +517,17 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh } leave.setText(String.valueOf(userBean.getLevelAnchor())); ImgLoader.display(mContext, imgUrl, mLevelAnchor); + new LiveTextRender().getLevelImage(mContext, userBean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLevel); + } - LevelBean level = appConfig.getLevel(userBean.getLevel()); - ImgLoader.display(mContext, level.getThumb(), mLevel); + @Override + public void onLoadFailed() { + + } + }); //修改靓号图标 个人中心子页面 if (userBean.getGoodnum() != null && !userBean.getGoodnum().equals("")) { good_nub_ico.setVisibility(View.VISIBLE); diff --git a/main/src/main/res/layout/item_search.xml b/main/src/main/res/layout/item_search.xml index 3c382bae5..f7518788a 100644 --- a/main/src/main/res/layout/item_search.xml +++ b/main/src/main/res/layout/item_search.xml @@ -56,23 +56,24 @@ + android:layout_width="30dp" + android:layout_marginStart="5dp" + android:layout_height="15dp"> + android:layout_width="30dp" + android:layout_height="15dp" />