修改用户等级

This commit is contained in:
18401019693 2022-11-02 18:11:38 +08:00
parent 0f2fbeb114
commit c57486b69c
9 changed files with 144 additions and 71 deletions

View File

@ -0,0 +1,62 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
/**
* 新用户等级牌
*/
public class NewLevelModel extends BaseModel {
@SerializedName("id")
private String id;
@SerializedName("levemin")
private String levemin;
@SerializedName("levemax")
private String levemax;
@SerializedName("thumb")
private String thumb;
public String getId() {
return id;
}
public NewLevelModel setId(String id) {
this.id = id;
return this;
}
public String getLevemin() {
return levemin;
}
public int getLeveMin() {
return Integer.parseInt(levemin);
}
public int getLeveMax() {
return Integer.parseInt(levemax);
}
public NewLevelModel setLevemin(String levemin) {
this.levemin = levemin;
return this;
}
public String getLevemax() {
return levemax;
}
public NewLevelModel setLevemax(String levemax) {
this.levemax = levemax;
return this;
}
public String getThumb() {
return thumb;
}
public NewLevelModel setThumb(String thumb) {
this.thumb = thumb;
return this;
}
}

View File

@ -6,6 +6,7 @@ import android.util.Log;
import com.adjust.sdk.Adjust;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
@ -18,6 +19,7 @@ import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NewLevelManager;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.MD5Util;
import com.yunbao.common.utils.SpUtil;
@ -190,6 +192,10 @@ public class CommonHttpUtil {
if (obj.containsKey("is_chat")) {
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
}
if (obj.containsKey("level_new")) {//缓存等级数据
JSONArray levelArray = obj.getJSONArray("level_new");
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
}
} catch (Exception e) {
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
ErrorActivity.forward("GetConfig接口返回数据异常", error);

View File

@ -7,8 +7,10 @@ import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.cosmos.baseutil.app.AppContext;
import com.google.gson.Gson;
import com.lzf.easyfloat.EasyFloat;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.event.DataUserInfoEvent;
import com.yunbao.common.http.HttpCallback;
@ -25,18 +27,18 @@ import org.greenrobot.eventbus.EventBus;
* 登录者信息管理
*/
public class IMLoginManager extends BaseCacheManager {
private final static String KEY_USER_INFO = "keyUserInfo";
private final String KEY_USER_INFO = "keyUserInfo";
private static IMLoginManager manager;
private IMLoginModel userInfo;
private final static String isNewUserGif = "isNewUserGif";
private final static String isNewUserOne = "isNewUserOne";
private final static String GiftEffect = "giftEffect";
private final static String MountEffect = "mountEffect";
private final static String IS_CHAT = "isChat";
private final static String IS_SLIDE = "isSlide";
private final static String IS_FLOAT = "is_float";
private final static String IS_HINT = "is_hint";
private final static String IS_HINT2 = "is_hint2";
private final String isNewUserGif = "isNewUserGif";
private final String isNewUserOne = "isNewUserOne";
private final String GiftEffect = "giftEffect";
private final String MountEffect = "mountEffect";
private final String IS_CHAT = "isChat";
private final String IS_SLIDE = "isSlide";
private final String IS_FLOAT = "is_float";
private final String IS_HINT = "is_hint";
private final String IS_HINT2 = "is_hint2";
public boolean isHint() {
@ -151,7 +153,7 @@ public class IMLoginManager extends BaseCacheManager {
*/
public static IMLoginManager get(Context context) {
if (null == manager) {
manager = new IMLoginManager(context);
manager = new IMLoginManager(CommonAppContext.sInstance.getBaseContext());
}
return manager;
}

View File

@ -0,0 +1,45 @@
package com.yunbao.common.manager;
import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yunbao.common.bean.NewLevelModel;
import com.yunbao.common.manager.base.BaseCacheManager;
import java.util.ArrayList;
import java.util.List;
/**
* 新粉丝牌管理
*/
public class NewLevelManager extends BaseCacheManager {
private final String KEY_USER_LEVEL = "keyUserLevel";
private List<NewLevelModel> newLevelModels = new ArrayList<>();
public NewLevelManager(Context context) {
super(context);
}
/**
* 缓存等级图标
*
* @param json
*/
public void UpDataLevel(String json) {
newLevelModels = new Gson().fromJson(json, new TypeToken<List<NewLevelModel>>() {
}.getType());
put(KEY_USER_LEVEL, newLevelModels);
}
/**
* 获取等级数据
*
* @return
*/
public List<NewLevelModel> getNewLevelModels() {
return getList(KEY_USER_LEVEL, new TypeToken<List<NewLevelModel>>() {
}.getType());
}
}

View File

@ -10,9 +10,9 @@ ext {
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",

View File

@ -65,7 +65,7 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener {
private String mPkUid;//正在连麦的对方主播的uid
private TextView mLinkMicWaitText;
private int mLinkMicWaitCount;//连麦弹窗等待倒计时
private static final int LINK_MIC_COUNT_MAX = 10;
private final int LINK_MIC_COUNT_MAX = 10;
private String mLinkMicWaitString;
private PopupWindow mLinkMicPopWindow;
private Handler mHandler;
@ -326,23 +326,10 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener {
}
if (mLiveSdk == Constants.LIVE_SDK_TX) {
mLiveLinkMicPlayViewHolder = new LiveLinkMicPlayTxViewHolder(mContext, mRightContainer);
} else {
// mLiveLinkMicPlayViewHolder = new LiveLinkMicPlayKsyViewHolder(mContext, mRightContainer);
}
mLiveLinkMicPlayViewHolder.setOnCloseListener(mIsAnchor ? this : null);
mLiveLinkMicPlayViewHolder.addToParent();
mLiveLinkMicPlayViewHolder.play(playUrl);
// if (mIsAnchor){
// try {
// int index=playUrl.indexOf("?");
// String subUrl= playUrl.substring(0,index);
// Log.d("subUrl",playUrl+" "+subUrl);
// mLiveLinkMicPlayViewHolder.play(subUrl);
// }catch (Exception e){e.printStackTrace();}
// }else {
// mLiveLinkMicPlayViewHolder.play(playUrl);
// }
if (mIsAnchor) {
ToastUtil.show(R.string.link_mic_anchor_accept_2);
((LiveAnchorActivity) mContext).setPkBtnVisible(true);

View File

@ -29,7 +29,6 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
@ -58,7 +57,6 @@ 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.CountDownView;
import com.yunbao.live.views.AbsLiveLinkMicPlayViewHolder;
import com.yunbao.live.views.AbsLiveLinkMicPushViewHolder;
import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder;
@ -95,7 +93,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
private boolean mAcceptLinkMic;//是否接受连麦
private String mLinkMicWaitString;
private int mLinkMicWaitCount;//连麦弹窗等待倒计时
private static final int LINK_MIC_COUNT_MAX = 10;
private final int LINK_MIC_COUNT_MAX = 10;
private PopupWindow mLinkMicPopWindow;
private Handler mHandler;
private AbsLiveLinkMicPlayViewHolder mLiveLinkMicPlayViewHolder;//连麦播放小窗口
@ -113,14 +111,11 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
private List<BannerBean> mBannerList3 = new ArrayList<>();
public static CountDownView date;
public static String link = "";
String gold, experience;
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
if ("stop_svga_new_user_double1".equals(str)) {
if ("stop_svga_new_user_double1".equals(str)) {
AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi");
Adjust.trackEvent(adjustEvent1);
CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() {
@ -225,7 +220,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
public LiveLinkMicPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, int liveSdk, View root) {
mContext = context;
EventBus.getDefault().register(this);
@ -244,7 +238,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
btnTurnTable.setOnClickListener(this);
//周星
BannerBean bannerBean = new BannerBean();
bannerBean.setImageUrl("https://downs.yaoulive.com/img/BTN_WEEKSTAR%20%281%29.png");
@ -252,8 +245,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
mBannerList1.add(bannerBean);
btn_onecz_event = root.findViewById(R.id.btn_onecz_event);
btn_onecz_event.setOnClickListener(new View.OnClickListener() {
@Override
@ -625,7 +616,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
//获取活动
private void getEvent() {
if (btn_onecz_event != null) {

View File

@ -35,9 +35,10 @@ 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;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.BitmapUtil;
import com.yunbao.common.manager.NewLevelManager;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
@ -45,6 +46,7 @@ import com.yunbao.live.R;
import com.yunbao.live.bean.LiveChatBean;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
@ -398,34 +400,14 @@ public class LiveTextRender {
*/
public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
mCallback = callback;
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
String imgUrl = "https://downs.yaoulive.com/level/user_lv1_bg.png";
if (0 < userLevel && userLevel < 10) {
imgUrl = "https://downs.yaoulive.com/level/user_lv1_bg.png";
} else if (9 < userLevel && userLevel < 20) {
imgUrl = "https://downs.yaoulive.com/level/user_lv10_bg.png";
} else if (19 < userLevel && userLevel < 30) {
imgUrl = "https://downs.yaoulive.com/level/user_lv20_bg.png";
} else if (29 < userLevel && userLevel < 40) {
imgUrl = "https://downs.yaoulive.com/level/user_lv30_bg.png";
} else if (39 < userLevel && userLevel < 50) {
imgUrl = "https://downs.yaoulive.com/level/user_lv40_bg.png";
} else if (49 < userLevel && userLevel < 60) {
imgUrl = "https://downs.yaoulive.com/level/user_lv50_bg.png";
} else if (59 < userLevel && userLevel < 70) {
imgUrl = "https://downs.yaoulive.com/level/user_lv60_bg.png";
} else if (69 < userLevel && userLevel < 80) {
imgUrl = "https://downs.yaoulive.com/level/user_lv70_bg.png";
} else if (79 < userLevel && userLevel < 90) {
imgUrl = "https://downs.yaoulive.com/level/user_lv80_bg.png";
} else if (89 < userLevel && userLevel < 100) {
imgUrl = "https://downs.yaoulive.com/level/user_lv90_bg.png";
} else if (99 < userLevel && userLevel < 110) {
imgUrl = "https://downs.yaoulive.com/level/user_lv100_bg.png";
} else if (109 < userLevel && userLevel < 120) {
imgUrl = "https://downs.yaoulive.com/level/user_lv110_bg.png";
} else if (userLevel == 120) {
imgUrl = "https://downs.yaoulive.com/level/user_lv120_bg.png";
for (NewLevelModel newLevelModel : models) {
if (newLevelModel.getLeveMin() <= userLevel && userLevel <= newLevelModel.getLeveMax()) {
imgUrl = newLevelModel.getThumb();
}
}
Glide.with(mContext).asBitmap().load(imgUrl).into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
@ -473,7 +455,6 @@ public class LiveTextRender {
}
private void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());

View File

@ -389,11 +389,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
}
};
public static Handler handler = new Handler();
public static Runnable runnable;
public Handler handler = new Handler();
public Runnable runnable;
public static Handler handler1 = new Handler();
public static Runnable runnable1;
public Handler handler1 = new Handler();
public Runnable runnable1;
public void removeCallbacks() {