diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index 08715be7d..e06e1f650 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -110,7 +110,6 @@ public class CommonAppConfig { private String mJPushAppKey;//极光推送的AppKey private List mUserItemList;//个人中心功能列表 private SparseArray mLevelMap; - private SparseArray mAnchorLevelMap; private SparseArray mAnchorFansMedalMap; private String mGiftListJson; private String mWrapListJson; @@ -541,25 +540,6 @@ public class CommonAppConfig { } } - /** - * 保存主播等级信息 - */ - public void setAnchorLevel(String anchorLevelJson) { - if (TextUtils.isEmpty(anchorLevelJson)) { - return; - } - List list = JSON.parseArray(anchorLevelJson, LevelBean.class); - if (list == null || list.size() == 0) { - return; - } - if (mAnchorLevelMap == null) { - mAnchorLevelMap = new SparseArray<>(); - } - mAnchorLevelMap.clear(); - for (LevelBean bean : list) { - mAnchorLevelMap.put(bean.getLevel(), bean); - } - } /** * 保存主播粉丝徽章信息 @@ -616,22 +596,6 @@ public class CommonAppConfig { return mLevelMap.get(level); } - /** - * 获取主播等级 - */ - public LevelBean getAnchorLevel(int level) { - if (mAnchorLevelMap == null) { - String configString = SpUtil.getInstance().getStringValue(SpUtil.CONFIG); - if (!TextUtils.isEmpty(configString)) { - JSONObject obj = JSON.parseObject(configString); - setAnchorLevel(obj.getString("levelanchor")); - } - } - if (mAnchorLevelMap == null || mAnchorLevelMap.size() == 0) { - return null; - } - return mAnchorLevelMap.get(level); - } public String getGiftListJson() { return mGiftListJson; diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 88f65b4b3..9b4b6b10d 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -181,8 +181,6 @@ public class CommonHttpUtil { JSONObject obj = JSON.parseObject(info[0]); ConfigBean bean = JSON.toJavaObject(obj, ConfigBean.class); CommonAppConfig.getInstance().setConfig(bean); - CommonAppConfig.getInstance().setLevel(obj.getString("level")); - CommonAppConfig.getInstance().setAnchorLevel(obj.getString("levelanchor")); CommonAppConfig.getInstance().alert_time = obj.getInteger("alert_time"); CommonAppConfig.getInstance().alert_end_time = obj.getInteger("alert_end_time"); //解析粉丝徽章 diff --git a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java index e496f63c7..b05f8f9e2 100644 --- a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java @@ -350,7 +350,11 @@ public class LiveHttpUtil { .params("p", p) .execute(callback); } - + public static void getContactMsg(int page, HttpCallback callback) { + HttpClient.getInstance().get("Live.getContactMsg", "getContactMsg") + .params("p", page) + .execute(callback); + } /** * 观众跟主播连麦时,获取自己的流地址 diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 3b09f2fcb..327394ceb 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -667,7 +667,9 @@ public interface PDLiveApi { * 获取收件箱信息 */ @GET("/api/public/?service=Live.getContactMsg") - Observable>> getContactMsg(); + Observable>> getContactMsg( + @Query("p") int page + ); /** * 删除联系方式信件 diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 5d3cf9a68..e42a30f05 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -1267,20 +1267,25 @@ public class LiveNetManager { * * @param callback 回调 */ - public void getContactMsg(HttpCallback> callback) { - API.get().pdLiveApi(mContext) - .getContactMsg() + private Disposable contactMsgApi; + + public synchronized void getContactMsg(int page, HttpCallback> callback) { + contactMsgApi = API.get().pdLiveApi(mContext) + .getContactMsg(page) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(listResponseModel -> { if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); } + contactMsgApi = null; }, throwable -> { if (callback != null) { callback.onError(throwable.getMessage()); } - }).isDisposed(); + contactMsgApi = null; + }); } /** @@ -2619,6 +2624,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void getBattlePassUserInfo(HttpCallback callback) { API.get().pdLiveApi(mContext) .getBattlePassUserInfo() @@ -2638,6 +2644,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void getLiveBattlePassRewards(HttpCallback callback) { API.get().pdLiveApi(mContext) .getLiveBattlePassRewards() @@ -2658,7 +2665,7 @@ public class LiveNetManager { }).isDisposed(); } - public void getRewards(String rewardLevelId,String rewardId,HttpCallback callback) { + public void getRewards(String rewardLevelId, String rewardId, HttpCallback callback) { API.get().pdLiveApi(mContext) .getRewards(rewardLevelId, rewardId) .subscribeOn(Schedulers.io()) @@ -2679,6 +2686,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void getBattlePassTask(HttpCallback callback) { API.get().pdLiveApi(mContext) .getBattlePassTask() @@ -2698,7 +2706,8 @@ public class LiveNetManager { } }).isDisposed(); } - public void getBattlePassTaskOver(String taskId,HttpCallback callback) { + + public void getBattlePassTaskOver(String taskId, HttpCallback callback) { API.get().pdLiveApi(mContext) .getTask(taskId) .subscribeOn(Schedulers.io()) @@ -2719,6 +2728,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void getBattlePassPoints(HttpCallback> callback) { API.get().pdLiveApi(mContext) .getBattlePassPoints() @@ -2738,6 +2748,7 @@ public class LiveNetManager { } }).isDisposed(); } + public void getBattlePassRule(HttpCallback callback) { API.get().pdLiveApi(mContext) .battlePassRule() @@ -2771,5 +2782,8 @@ public class LiveNetManager { if (randomPkApi != null) { randomPkApi.dispose(); } + if (contactMsgApi != null) { + contactMsgApi.dispose(); + } } } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 4084f182c..2bfd738cd 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1902,9 +1902,11 @@ public class LiveAudienceActivity extends LiveActivity { /** * 检查消息,有未读就要显示红点 */ + private void checkMsgRed() { + LiveNetManager.get(mContext) - .getContactMsg(new com.yunbao.common.http.base.HttpCallback>() { + .getContactMsg(1, new com.yunbao.common.http.base.HttpCallback>() { @Override public void onSuccess(List data) { Log.i(TAG, "onSuccess: " + data.size()); @@ -1927,6 +1929,8 @@ public class LiveAudienceActivity extends LiveActivity { return; } } + + showMsgRed(-1); } }); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRecordPlayActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRecordPlayActivity.java index 39a3f44e4..e42756575 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRecordPlayActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRecordPlayActivity.java @@ -9,14 +9,14 @@ import android.widget.ImageView; import android.widget.SeekBar; import android.widget.TextView; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; -import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.StringUtil; import com.yunbao.live.R; import com.yunbao.live.bean.SearchUserBean; @@ -24,6 +24,8 @@ import com.yunbao.live.dialog.LiveShareDialogFragment; import com.yunbao.live.presenter.UserHomeSharePresenter; import com.yunbao.live.views.LiveRecordPlayViewHolder; +import java.util.List; + /** * Created by cxf on 2018/10/29. */ @@ -82,10 +84,14 @@ public class LiveRecordPlayActivity extends AbsActivity implements mName = (TextView) findViewById(R.id.name); mID = (TextView) findViewById(R.id.id_val); mBtnFollow = findViewById(R.id.btn_follow); - ImgLoader.displayAvatar(mContext,mUserBean.getAvatar(), mAvatar); - LevelBean levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor()); - if (levelBean != null) { - ImgLoader.display(mContext,levelBean.getThumbIcon(), mLevelAnchor); + ImgLoader.displayAvatar(mContext, mUserBean.getAvatar(), mAvatar); + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= mUserBean.getLevelAnchor() && mUserBean.getLevelAnchor() <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getIcon(); + } + ImgLoader.display(mContext, imgUrl, mLevelAnchor); } mName.setText(mUserBean.getUserNiceName()); mID.setText(mUserBean.getLiangNameTip()); diff --git a/live/src/main/java/com/yunbao/live/adapter/LivePkAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LivePkAdapter.java index f9d4411f9..45abbf8e3 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LivePkAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LivePkAdapter.java @@ -1,22 +1,24 @@ package com.yunbao.live.adapter; import android.content.Context; -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import com.yunbao.common.CommonAppConfig; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + import com.yunbao.common.adapter.RefreshAdapter; -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.CommonIconUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.bean.LivePkBean; +import java.util.List; + /** * Created by cxf on 2018/11/15. */ @@ -39,7 +41,7 @@ public class LivePkAdapter extends RefreshAdapter { } }; mLivePkInviteString = "PK"; - mLivePkInviteString2 =mContext.getString(R.string.live_pk_invite_2); + mLivePkInviteString2 = mContext.getString(R.string.live_pk_invite_2); } @NonNull @@ -57,7 +59,7 @@ public class LivePkAdapter extends RefreshAdapter { class Vh extends RecyclerView.ViewHolder { ImageView mAvatar; - TextView mName; + TextView mName, leave; ImageView mSex; ImageView mLevel; TextView mBtnInvite; @@ -66,6 +68,7 @@ public class LivePkAdapter extends RefreshAdapter { super(itemView); mAvatar = (ImageView) itemView.findViewById(R.id.avatar); mName = (TextView) itemView.findViewById(R.id.name); + leave = itemView.findViewById(R.id.leave); mSex = (ImageView) itemView.findViewById(R.id.sex); mLevel = (ImageView) itemView.findViewById(R.id.level); mBtnInvite = (TextView) itemView.findViewById(R.id.btn_invite); @@ -74,13 +77,22 @@ public class LivePkAdapter extends RefreshAdapter { void setData(LivePkBean bean) { mBtnInvite.setTag(bean); - ImgLoader.display(mContext,bean.getAvatar(), mAvatar); + ImgLoader.display(mContext, bean.getAvatar(), mAvatar); mName.setText(bean.getUserNiceName()); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor()); - if (levelBean != null) { - ImgLoader.display(mContext,levelBean.getThumb(), mLevel); + + List models = new NewLevelManager(itemView.getContext()).getNewAnchorLevelModels(); + int anchorLevel = 0; + anchorLevel = bean.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } } + leave.setText(String.valueOf(bean.getLevelAnchor())); + ImgLoader.display(itemView.getContext(), imgUrl, mLevel); + if (bean.isLinkMic()) { mBtnInvite.setText(mLivePkInviteString2); mBtnInvite.setEnabled(false); diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java index 6e47eb322..3cb4d8540 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveUserAnchorMailBoxAdapter.java @@ -12,6 +12,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; @@ -21,28 +22,15 @@ import com.yunbao.common.views.weight.MarqueeTextView; import com.yunbao.live.R; import com.yunbao.live.dialog.LiveUserAnchorMailBoxWebInfoPopDialog; -import java.util.ArrayList; -import java.util.List; +public class LiveUserAnchorMailBoxAdapter extends RefreshAdapter { -public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter { - private Context mContext; - private List list; OnItemClickListener onItemClickListener; DialogInterface.OnDismissListener onWebDismissListener; - public LiveUserAnchorMailBoxAdapter(Context mContext) { - this.mContext = mContext; - list = new ArrayList<>(); + public LiveUserAnchorMailBoxAdapter(Context context) { + super(context); } - public void setList(List list) { - this.list = list; - notifyDataSetChanged(); - } - - public List getList() { - return list; - } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; @@ -56,18 +44,20 @@ public class LiveUserAnchorMailBoxAdapter extends RecyclerView.Adapter= Build.VERSION_CODES.N) { - list.removeIf(it -> it.getId() == box.getId()); + mList.removeIf(it -> it.getId() == box.getId()); } - System.err.println("-----> list size = " + list.size()); + System.err.println("-----> list size = " + mList.size()); notifyDataSetChanged(); if (onItemClickListener != null) { onItemClickListener.onItemClick(box, position); 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 08dc458b4..80e006e29 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -23,12 +23,11 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.tencent.imsdk.v2.V2TIMCallback; -import com.tencent.imsdk.v2.V2TIMManager; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.event.LiveRoomChangeEvent; @@ -38,6 +37,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpConsts; import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.CommonCallback; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.LiveRoomCheckLivePresenter; @@ -58,9 +58,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; -import io.rong.imlib.IRongCoreCallback; -import io.rong.imlib.IRongCoreEnum; -import io.rong.imlib.chatroom.base.RongChatRoomClient; import pl.droidsonroids.gif.GifImageView; /** @@ -406,10 +403,19 @@ public class LiveOldUserDialogFragment extends AbsDialogFragment implements View int levelAnchor = obj.getIntValue("level_anchor"); int level = obj.getIntValue("level"); mSign.setText(obj.getString("signature")); - LevelBean anchorLevelBean = appConfig.getAnchorLevel(obj.getIntValue("level_anchor")); - if (anchorLevelBean != null) { - ImgLoader.display(mContext, anchorLevelBean.getBgIcon(), mLevelAnchor); + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + + anchorLevel = obj.getIntValue("level_anchor"); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getIcon(); + } } + ImgLoader.display(mContext, imgUrl, mLevelAnchor); + + LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level")); if (levelBean != null) { ImgLoader.display(mContext, levelBean.getBgIcon(), mLevel); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java index 6ef819417..18b98a080 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserAnchorMailBoxPopDialog.java @@ -1,33 +1,35 @@ package com.yunbao.live.dialog; import android.content.Context; -import android.content.DialogInterface; import android.util.Log; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; +import com.alibaba.fastjson.JSON; import com.lxj.xpopup.XPopup; +import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.LiveUserMailBoxModel; +import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; -import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.Bus; import com.yunbao.live.R; import com.yunbao.live.adapter.LiveUserAnchorMailBoxAdapter; import com.yunbao.live.event.LiveAudienceEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** * 用户获取主播联系方式信箱弹框 */ public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow { - private RecyclerView list; + private CommonRefreshView list; private LiveUserAnchorMailBoxAdapter adapter; private View empty; @@ -48,26 +50,84 @@ public class LiveUserAnchorMailBoxPopDialog extends AbsDialogPopupWindow { @Override protected void onCreate() { super.onCreate(); - adapter = new LiveUserAnchorMailBoxAdapter(getContext()); list = findViewById(R.id.mailbox); empty = findViewById(R.id.ic_empty); list.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); - list.setAdapter(adapter); + if (adapter == null) { + adapter = new LiveUserAnchorMailBoxAdapter(getContext()); + } + list.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + if (adapter == null) { + adapter = new LiveUserAnchorMailBoxAdapter(getContext()); + } + return adapter; + } + + @Override + public void loadData(int p, com.yunbao.common.http.HttpCallback callback) { + LiveHttpUtil.getContactMsg(p, callback); + } + + @Override + public List processData(String[] info) { + if (info != null) { + if (info.length > 0) { + empty.setVisibility(View.GONE); + list.setVisibility(View.VISIBLE); + return JSON.parseArray(Arrays.toString(info), LiveUserMailBoxModel.class); + } else { + empty.setVisibility(VISIBLE); + list.setVisibility(GONE); + return new ArrayList(); + } + + } else { + empty.setVisibility(VISIBLE); + list.setVisibility(GONE); + return new ArrayList(); + } + + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + if (loadItemList.size() > 0) + adapter.insertList(loadItemList); + } + + @Override + public void onLoadMoreFailure() { + + } + }); + list.initData(); adapter.setOnItemClickListener((bean, position) -> { if (adapter.getItemCount() == 0) { empty.setVisibility(VISIBLE); list.setVisibility(GONE); } }); - adapter.setOnWebDismissListener(dialog -> initData()); - initData(); +// adapter.setOnWebDismissListener(dialog -> initData()); +// initData(); } String TAG = "信箱"; void initData() { LiveNetManager.get(getContext()) - .getContactMsg(new HttpCallback>() { + .getContactMsg(1, new HttpCallback>() { @Override public void onSuccess(List data) { Log.i(TAG, "onSuccess: " + data.size()); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index 7ed21d2d1..b14e3e0be 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -22,14 +22,12 @@ import com.opensource.svgaplayer.SVGADrawable; import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; -import com.tencent.imsdk.v2.V2TIMCallback; -import com.tencent.imsdk.v2.V2TIMManager; import com.umeng.analytics.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.FansModel; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.OlineUserlistModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; @@ -65,9 +63,6 @@ import java.net.URL; import java.util.ArrayList; import java.util.List; -import io.rong.imlib.IRongCoreCallback; -import io.rong.imlib.IRongCoreEnum; -import io.rong.imlib.chatroom.base.RongChatRoomClient; import pl.droidsonroids.gif.GifImageView; /** @@ -415,21 +410,33 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On // textGiftWall.setText(mContext.getString(R.string.gift_wall)); // valueGiftWall.setText(String.format(mContext.getString(R.string.has_been_lit), obj.getString("gift_wall_lighten_number"))); } - LevelBean levelBean; if (isAnchor) { - levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor()); userLv.setText("Lv." + mUserBean.getLevelAnchor()); mLvDesc.setText(R.string.live_user_level_anchor); + } else { - levelBean = CommonAppConfig.getInstance().getLevel(mUserBean.getLevel()); userLv.setText("Lv." + mUserBean.getLevel()); mLvDesc.setText(R.string.live_user_card_level); + } if (isAnchor) { - ImgLoader.display2(mContext, obj.getJSONObject("level_thumb").getString("thumb"), mLiveIcon); + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + + + anchorLevel = mUserBean.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } + } mLvVal.setText(obj.getInteger("level_anchor") + ""); + ImgLoader.display2(mContext, imgUrl, mLiveIcon); + + } else { - new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { + new LiveTextRender().getLevelImage(mContext, mUserBean.getLevel(), new ImgLoader.DrawableCallback() { @Override public void onLoadSuccess(Drawable drawable) { ImgLoader.display2(mContext, drawable, mLiveIcon); @@ -441,7 +448,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } }); } - ImgLoader.display(mContext, levelBean.getBgIcon(), mLiveIcon2); + + FansModel fansMedalBean = new NewLevelManager(mContext).getFansModel(obj.getIntValue("medal_level")); if (fansMedalBean != null && !isAnchor) { ImgLoader.display(mContext, fansMedalBean.getThumb(), mNoble); diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicAnchorPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicAnchorPresenter.java index a620d9556..050271bbd 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicAnchorPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicAnchorPresenter.java @@ -16,12 +16,13 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; -import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; @@ -31,7 +32,6 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveAnchorActivity; import com.yunbao.live.event.LinkMicTxMixStreamEvent; -import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.live.interfaces.ILiveLinkMicViewHolder; import com.yunbao.live.socket.SocketClient; import com.yunbao.live.socket.SocketLinkMicAnchorUtil; @@ -40,6 +40,8 @@ import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder; import org.greenrobot.eventbus.EventBus; +import java.util.List; + /** * Created by cxf on 2018/11/16. * 主播与主播连麦逻辑 @@ -84,7 +86,7 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener { mPkContainer = linkMicViewHolder.getPkContainer(); - mLinkMicWaitString =mContext.getString(R.string.link_mic_wait); + mLinkMicWaitString = mContext.getString(R.string.link_mic_wait); mHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -174,17 +176,25 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener { ImageView avatar = (ImageView) v.findViewById(R.id.avatar); TextView name = (TextView) v.findViewById(R.id.name); ImageView sex = (ImageView) v.findViewById(R.id.sex); - ImageView level = (ImageView) v.findViewById(R.id.level); + TextView level = (TextView) v.findViewById(R.id.level); + ImageView contribute = (ImageView) v.findViewById(R.id.contribute); mLinkMicWaitText = v.findViewById(R.id.wait_text); v.findViewById(R.id.btn_refuse).setOnClickListener(this); v.findViewById(R.id.btn_accept).setOnClickListener(this); ImgLoader.display(mContext, u.getAvatar(), avatar); name.setText(u.getUserNiceName()); sex.setImageResource(CommonIconUtil.getSexIcon(u.getSex())); - LevelBean levelBean = CommonAppConfig.getInstance().getAnchorLevel(u.getLevelAnchor()); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), level); + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + anchorLevel = u.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } } + level.setText(anchorLevel + ""); + ImgLoader.display(mContext, imgUrl, contribute); mLinkMicWaitCount = LINK_MIC_COUNT_MAX; mLinkMicWaitText.setText(mLinkMicWaitString + "(" + mLinkMicWaitCount + ")..."); mLinkMicPopWindow = new PopupWindow(v, DpUtil.dp2px(280), ViewGroup.LayoutParams.WRAP_CONTENT, true); @@ -279,7 +289,7 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener { */ private void acceptLinkMic() { if (((LiveAnchorActivity) mContext).isBgmPlaying()) { - DialogUitl.showSimpleDialog(mContext,mContext.getString(R.string.link_mic_close_bgm), new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleDialog(mContext, mContext.getString(R.string.link_mic_close_bgm), new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { ((LiveAnchorActivity) mContext).stopBgm(); @@ -493,10 +503,10 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener { */ public void onlinkMicPlayGaming() { mLastApplyLinkMicTime = 0; - DialogUitl.showSimpleTipDialog(mContext,mContext.getString(R.string.link_mic_play_game)); + DialogUitl.showSimpleTipDialog(mContext, mContext.getString(R.string.link_mic_play_game)); } public void setLiveSdk(int mLiveSDK) { - this.mLiveSdk=mLiveSDK; + this.mLiveSdk = mLiveSDK; } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index c218370bf..5e71701ad 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -74,7 +74,6 @@ import com.yunbao.common.bean.GiftModel; import com.yunbao.common.bean.GuardUserModel; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.IMLoginModel; -import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LinkMicUserBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorSayModel; @@ -85,6 +84,7 @@ import com.yunbao.common.bean.LiveRoomVoteModel; import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.LiveUserMailBoxModel; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.bean.NewPeopleTaskModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.RankHourModel; @@ -114,6 +114,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.manager.RandomPkManager; import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.Bus; @@ -387,7 +388,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private FrameLayout pa_pao_layout; private LinearLayout combo_layout; private TextView combo_number; - private View quick_gift_reminder ; + private View quick_gift_reminder; @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { @@ -720,6 +721,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } } + public void onQuickGifting3() { IMLoginManager.get(mContext).setQuickGiftIfFirst(); quick_gift_reminder.setVisibility(View.GONE); @@ -1201,11 +1203,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mAvatar = (ImageView) findViewById(R.id.avatar); mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); - mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); - mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); - - mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); mName = (TextView) findViewById(R.id.name); mID = (TextView) findViewById(R.id.id_val); mBtnFollow = findViewById(R.id.btn_follow); @@ -1565,7 +1563,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis pa_pao_layout = (FrameLayout) findViewById(R.id.pa_pao_layout); combo_layout = (LinearLayout) findViewById(R.id.combo_layout); combo_number = (TextView) findViewById(R.id.combo_number); - quick_gift_reminder = findViewById(R.id.quick_gift_reminder); + quick_gift_reminder = findViewById(R.id.quick_gift_reminder); pa_pao_layout.setVisibility(View.GONE); combo_layout.setVisibility(View.GONE); @@ -1825,6 +1823,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 重置数据 */ public void resetView() { + contactMsgPage = -1; svgaImageViewHashMap.clear(); pa_pao_layout.removeAllViews(); timeHandler.removeCallbacks(timeRunnable); @@ -2555,7 +2554,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * @param rank 小时榜 */ public void setHourRankData(long rank) { - if (mHotText != null) { + if (mHotText != null) { if (rank == 0) { mHotText.setText(R.string.no_rank_data); } else { @@ -2584,9 +2583,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } + public void setHotNum(String hotNum) { setHotData(formatBigNum.formatBigNum(hotNum)); } + /** * 更新心愿单进度 * @@ -2824,12 +2825,16 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 显示主播等级 */ public void setAnchorLevel(int anchorLevel) { - if (mLevelAnchor != null) { - LevelBean levelBean = CommonAppConfig.getInstance().getAnchorLevel(anchorLevel); - if (levelBean != null) { - ImgLoader.display2(mContext, levelBean.getThumbIcon(), mLevelAnchor); + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getIcon(); } } + ImgLoader.display(mContext, imgUrl, mLevelAnchor); + } /** @@ -4098,6 +4103,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void clearData() { + contactMsgPage = -1; svgaImageViewHashMap.clear(); pa_pao_layout.removeAllViews(); timeHandler.removeCallbacks(timeRunnable); @@ -5498,6 +5504,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void initTopBanner() { + contactMsgPage = 1; checkNewLetter(); if (mTopBannerList == null) { mTopBannerList = new ArrayList<>(); @@ -5699,25 +5706,37 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } - private void checkNewLetter() { - LiveNetManager.get(mContext).getContactMsg(new com.yunbao.common.http.base.HttpCallback>() { - @Override - public void onSuccess(List data) { - for (LiveUserMailBoxModel model : data) { - if (model.getIsRead() == 0 && mContext instanceof LiveAudienceActivity) { - ((LiveAudienceActivity) mContext).showMsgRed(0); - return; + private int contactMsgPage = 1; + + private synchronized void checkNewLetter() { + if (contactMsgPage > 0) { + LiveNetManager.get(mContext).getContactMsg(contactMsgPage, new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + if (data.size() > 0 && data != null) { + for (LiveUserMailBoxModel model : data) { + if (model.getIsRead() == 0 && mContext instanceof LiveAudienceActivity) { + ((LiveAudienceActivity) mContext).showMsgRed(0); + return; + } + } + contactMsgPage = contactMsgPage + 1; + checkNewLetter(); + } else { + ((LiveAudienceActivity) mContext).showMsgRed(-1); + contactMsgPage = 1; } + + } - ((LiveAudienceActivity) mContext).showMsgRed(-1); - } + @Override + public void onError(String error) { + contactMsgPage = 1; + } + }); + } - @Override - public void onError(String error) { - - } - }); } public void blindBoxAllServerNotify(AllServerNotifyEvent event) { diff --git a/live/src/main/res/layout/dialog_link_mic_wait.xml b/live/src/main/res/layout/dialog_link_mic_wait.xml index 2e5df1eb4..9dcbfc943 100644 --- a/live/src/main/res/layout/dialog_link_mic_wait.xml +++ b/live/src/main/res/layout/dialog_link_mic_wait.xml @@ -1,13 +1,11 @@ - + android:orientation="vertical"> + app:riv_oval="true" /> + android:textSize="16sp" /> + android:orientation="horizontal"> + android:layout_height="15dp" /> + + + + + + + + - + android:textSize="14sp" /> - + + android:layout_height="40dp"> + android:textSize="14sp" /> + android:background="@color/gray2" /> + android:textSize="14sp" /> \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_user.xml b/live/src/main/res/layout/dialog_live_user.xml index 165988890..be9f099e3 100644 --- a/live/src/main/res/layout/dialog_live_user.xml +++ b/live/src/main/res/layout/dialog_live_user.xml @@ -237,7 +237,7 @@ android:layout_width="wrap_content" android:layout_height="45dp" android:layout_marginTop="10dp" - android:visibility="gone"> + android:visibility="visible"> - - + - + android:paddingRight="12dp"> + app:riv_oval="true" /> + android:textSize="16sp" /> + android:layout_toRightOf="@id/name" /> - + android:layout_toRightOf="@id/sex"> + + + + + + + + android:textSize="10sp" /> + android:layout_alignParentBottom="true" /> \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 9a7a5a8cc..29b64aeeb 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -43,6 +43,7 @@ android:id="@+id/level_anchor" android:layout_width="13dp" android:layout_height="13dp" + android:visibility="gone" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" /> diff --git a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java index a56ee4332..e1864e676 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainListAdapter.java @@ -239,15 +239,15 @@ public class MainListAdapter extends RefreshAdapter { mVotes.setText(bean.getTotalCoinFormat() + " "); mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); - LevelBean levelBean = null; - if (mType == TYPE_PROFIT) { - levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor()); - } else { - levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); - } - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getThumb(), mLevel); - } +// LevelBean levelBean = null; +// if (mType == TYPE_PROFIT) { +// levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor()); +// } else { +// levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); +// } +// if (levelBean != null) { +// ImgLoader.display(mContext, levelBean.getThumb(), mLevel); +// } } liveing.setVisibility(View.INVISIBLE); if (bean.getIslive() == 1) { 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 0a7c24506..175ed5a40 100644 --- a/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/SearchAdapter.java @@ -16,15 +16,17 @@ import com.yunbao.common.Constants; import com.yunbao.common.adapter.RefreshAdapter; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.manager.NewLevelManager; 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.common.http.LiveHttpUtil; -import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.main.R; import java.util.List; @@ -47,8 +49,8 @@ public class SearchAdapter extends RefreshAdapter { public SearchAdapter(Context context, int from) { super(context); mFrom = from; - mFollow =mContext.getString(R.string.follow); - mFollowing =mContext.getString(R.string.following); + mFollow = mContext.getString(R.string.follow); + mFollowing = mContext.getString(R.string.following); mFollowClickListener = new View.OnClickListener() { @Override public void onClick(View v) { @@ -117,7 +119,7 @@ public class SearchAdapter extends RefreshAdapter { class Vh extends RecyclerView.ViewHolder { ImageView mAvatar; - TextView mName; + TextView mName, leave; TextView mSign; ImageView mSex; ImageView mLevelAnchor; @@ -130,6 +132,7 @@ public class SearchAdapter extends RefreshAdapter { mAvatar = (ImageView) itemView.findViewById(R.id.avatar); mName = (TextView) itemView.findViewById(R.id.name); mSign = (TextView) itemView.findViewById(R.id.sign); + leave = (TextView) itemView.findViewById(R.id.leave); mSex = (ImageView) itemView.findViewById(R.id.sex); mLevelAnchor = (ImageView) itemView.findViewById(R.id.level_anchor); mLevel = (ImageView) itemView.findViewById(R.id.level); @@ -158,31 +161,24 @@ public class SearchAdapter extends RefreshAdapter { gotoLive(bean.getId()); } }); - LevelBean anchorLevelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor()); - if (anchorLevelBean != null) { - ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevelAnchor); + List models = new NewLevelManager(itemView.getContext()).getNewAnchorLevelModels(); + int anchorLevel = 0; + anchorLevel = bean.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } } + leave.setText(bean.getLevelAnchor() + ""); + ImgLoader.display(itemView.getContext(), imgUrl, mLevelAnchor); + LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); if (levelBean != null) { ImgLoader.display(mContext, levelBean.getThumb(), mLevel); } } -// if (mUid.equals(bean.getId())) { -// if (mBtnFollow.getVisibility() == View.VISIBLE) { -// mBtnFollow.setVisibility(View.INVISIBLE); -// } -// } else { -// if (mBtnFollow.getVisibility() != View.VISIBLE) { -// mBtnFollow.setVisibility(View.VISIBLE); -// } -// if (bean.getAttention() == 1) { -// mBtnFollow.doChecked(true); -// mBtnFollow.setText(mFollowing); -// } else { -// mBtnFollow.doChecked(false); -// mBtnFollow.setText(mFollow); -// } -// } + } } @@ -200,7 +196,7 @@ public class SearchAdapter extends RefreshAdapter { new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { @Override public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { - RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); } @Override diff --git a/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java b/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java index 3ba19ec60..63f0821ab 100644 --- a/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/EncourageDialog.java @@ -2,15 +2,10 @@ package com.yunbao.main.dialog; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; -import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; - -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -21,10 +16,15 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.makeramen.roundedimageview.RoundedImageView; -import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; @@ -32,6 +32,7 @@ import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.main.R; +import com.yunbao.main.adapter.MainHomeRemFollLiveAdapter; import com.yunbao.main.bean.EncourageGiftBean; import com.yunbao.main.http.MainHttpUtil; @@ -46,7 +47,7 @@ public class EncourageDialog extends AbsDialogFragment implements View.OnClickLi private View v_encourage, v_encourage_list, v_close; private ImageView img_gift1, img_gift2, img_gift3; private LinearLayout lt_gift1, lt_gift2, lt_gift3, lt_lt1, lt_lt2, lt_no_data; - private RecyclerView rc_encourage; + private CommonRefreshView rc_encourage; private EncourageAdapter encourageAdapter; private List encourageList; private List encourageList2; @@ -151,30 +152,68 @@ public class EncourageDialog extends AbsDialogFragment implements View.OnClickLi } private void getDataList() { - MainHttpUtil.getDynamicSendGiftList(id, new HttpCallback() { + gridLayoutManager = new GridLayoutManager(getContext(), 1); + rc_encourage.setLayoutManager(gridLayoutManager); + lt_no_data.setVisibility(View.GONE); + rc_encourage.setVisibility(View.VISIBLE); + rc_encourage.setDataHelper(new CommonRefreshView.DataHelper() { @Override - public void onSuccess(int code, String msg, String[] info) { + public RefreshAdapter getAdapter() { + if (encourageAdapter == null) { + encourageAdapter = new EncourageAdapter(mContext); + } + return encourageAdapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + MainHttpUtil.getDynamicSendGiftList(id, p, callback); + } + + @Override + public List processData(String[] info) { if (info != null) { if (info.length > 0) { lt_no_data.setVisibility(View.GONE); rc_encourage.setVisibility(View.VISIBLE); - encourageList = JSON.parseArray(Arrays.toString(info), EncourageGiftBean.class); - - encourageAdapter = new EncourageAdapter(getContext(), encourageList); - gridLayoutManager = new GridLayoutManager(getContext(), 1); - rc_encourage.setLayoutManager(gridLayoutManager); - rc_encourage.setAdapter(encourageAdapter); + return JSON.parseArray(Arrays.toString(info), EncourageGiftBean.class); } else { lt_no_data.setVisibility(View.VISIBLE); rc_encourage.setVisibility(View.GONE); + return new ArrayList(); } } else { lt_no_data.setVisibility(View.VISIBLE); rc_encourage.setVisibility(View.GONE); + return new ArrayList(); } + + + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + if (loadItemList.size() > 0) + encourageAdapter.insertList(loadItemList); + } + + @Override + public void onLoadMoreFailure() { + } }); + rc_encourage.initData(); } private void initView() { @@ -193,7 +232,7 @@ public class EncourageDialog extends AbsDialogFragment implements View.OnClickLi lt_gift3 = (LinearLayout) findViewById(R.id.lt_gift3); lt_lt1 = (LinearLayout) findViewById(R.id.lt_lt1); lt_lt2 = (LinearLayout) findViewById(R.id.lt_lt2); - rc_encourage = (RecyclerView) findViewById(R.id.rc_encourage); + rc_encourage = (CommonRefreshView) findViewById(R.id.rc_encourage); img_gift1 = (ImageView) findViewById(R.id.img_gift1); img_gift2 = (ImageView) findViewById(R.id.img_gift2); @@ -344,16 +383,10 @@ public class EncourageDialog extends AbsDialogFragment implements View.OnClickLi } } - public class EncourageAdapter extends RecyclerView.Adapter { - private LayoutInflater mInflater; - private List mDatas; + public class EncourageAdapter extends RefreshAdapter { - /** - * - */ - public EncourageAdapter(Context context, List datats) { - mInflater = LayoutInflater.from(context); - mDatas = datats; + public EncourageAdapter(Context context) { + super(context); } public class ViewHolder extends RecyclerView.ViewHolder { @@ -374,43 +407,24 @@ public class EncourageDialog extends AbsDialogFragment implements View.OnClickLi } } - @Override - public int getItemCount() { - return mDatas.size(); - } - /** * 创建ViewHolder */ @Override public EncourageAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { - View view; - view = mInflater.inflate(R.layout.item_encourage_list, - viewGroup, false); - EncourageAdapter.ViewHolder viewHolder = new EncourageAdapter.ViewHolder(view); - - return viewHolder; + return new EncourageAdapter.ViewHolder(mInflater.inflate(R.layout.item_encourage_list, viewGroup, false)); } - /** - * 设置值 - */ @Override - public void onBindViewHolder(final EncourageAdapter.ViewHolder viewHolder, @SuppressLint("RecyclerView") final int position) { - ImgLoader.displayAvatar(mContext, mDatas.get(position).getUser_avatar(), viewHolder.avatar); -// LevelBean anchorLevelBean = CommonAppConfig.getInstance().getAnchorLevel(mDatas.getLevelAnchor()); -// if (anchorLevelBean != null) { -// ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), viewHolder.level_anchor); -// } -// LevelBean levelBean = CommonAppConfig.getInstance().getLevel(mDatas.getLevel()); -// if (levelBean != null) { -// ImgLoader.display(mContext, levelBean.getThumb(), viewHolder.level); -// } - ImgLoader.display(mContext, mDatas.get(position).getGift_img(), viewHolder.tv_gift_pic); - viewHolder.name.setText(mDatas.get(position).getUser_name()); - viewHolder.tv_gift_num.setText(mDatas.get(position).getGift_num()); + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + ViewHolder viewHolder = (ViewHolder) holder; + ImgLoader.displayAvatar(mContext, mList.get(position).getUser_avatar(), viewHolder.avatar); + ImgLoader.display(mContext, mList.get(position).getGift_img(), viewHolder.tv_gift_pic); + viewHolder.name.setText(mList.get(position).getUser_name()); + viewHolder.tv_gift_num.setText(mList.get(position).getGift_num()); } + } } diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index 4850c1eb1..0a29ea40c 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -692,12 +692,15 @@ public class MainHttpUtil { /** * 社区动态礼物信息列表 */ - public static void getDynamicSendGiftList(String id, HttpCallback callback) { + public static void getDynamicSendGiftList(String id, int page, HttpCallback callback) { HttpClient.getInstance().get("Community.getDynamicSendGiftList", MainHttpConsts.GET_DYNAMICSENDGIFTLIST) .params("dynamic_id", id) + .params("page", page) .execute(callback); } + + /** * 是否是主播 */ 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 8072915e5..079820aee 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -251,10 +251,10 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi coin.setText(coins); } BigDecimal yuanbao = new BigDecimal(yuanbaos); - String yuanbaoStr =String.valueOf(yuanbao.intValue()); + String yuanbaoStr = String.valueOf(yuanbao.intValue()); if (yuanbaoStr.length() > 9) { - star_coin.setText(yuanbaoStr.substring(0,yuanbaoStr.length() - 6) + "M"); - } else if (yuanbaoStr.length()>7) { + star_coin.setText(yuanbaoStr.substring(0, yuanbaoStr.length() - 6) + "M"); + } else if (yuanbaoStr.length() > 7) { star_coin.setText(yuanbaoStr.substring(0, yuanbaoStr.length() - 3) + "K"); } else { star_coin.setText(yuanbaos); @@ -326,7 +326,6 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } signature.setText(singnature); CommonAppConfig appConfig = CommonAppConfig.getInstance(); - LevelBean anchorLevelBean = appConfig.getAnchorLevel(u.getLevelAnchor()); if (u.getDress().getAvatar_frame() != null) { if (u.getDress().getAvatar_frame().contains("svga")) { @@ -360,20 +359,20 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi if ("C".equals(u.getUsers_type())) { Constants.isAnchor = true; good_nub_ico.setImageResource(R.mipmap.usercard_good_nub); - if (anchorLevelBean != null) { - ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevel); - ImgLoader.display(mContext, R.mipmap.icon_zhubolv, img_lv_pic); - //主播等级 - 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() + "&for"; - ZhuangBanActivity.forward(mContext, url); - } - }); - tv_level.setText(anchorLevelBean.getLevel() + ""); - } + + + ImgLoader.display(mContext, R.mipmap.icon_zhubolv, img_lv_pic); + //主播等级 + 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() + "&for"; + ZhuangBanActivity.forward(mContext, url); + } + }); + tv_level.setText(u.getLevel() + ""); + } else { Constants.isAnchor = false; LevelBean levelBean = appConfig.getLevel(u.getLevel()); 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 965f4567e..0cd1dfaf1 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder1.java @@ -23,11 +23,13 @@ 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; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.WordUtil; @@ -77,7 +79,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; + private TextView user_noble_text,leave; private UserItemBean beanStetting = null, beanKefu = null; private boolean firstInto = true; @@ -124,6 +126,7 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL btnCopy = (TextView) findViewById(R.id.btn_copy); // btnUserNoble = (LinearLayout) findViewById(R.id.btn_user_noble); user_noble_text = (TextView) findViewById(R.id.user_noble_text); + leave = (TextView) findViewById(R.id.leave); img_kefu = (ImageView) findViewById(R.id.img_kefu); img_setting = (ImageView) findViewById(R.id.img_setting); @@ -258,7 +261,7 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL gold.setText(u.getCoin()); signature.setText(u.getSignature()); CommonAppConfig appConfig = CommonAppConfig.getInstance(); - LevelBean anchorLevelBean = appConfig.getAnchorLevel(u.getLevelAnchor()); + if (u.getDress().getAvatar_frame() != null) { if (u.getDress().getAvatar_frame().contains("svga")) { @@ -290,9 +293,20 @@ public class MainMeViewHolder1 extends AbsMainViewHolder implements OnItemClickL user_noble_ico.setImageResource(R.mipmap.df_nobe); } - if (anchorLevelBean != null) { - ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevelAnchor); - } + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + + + 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); 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 3da1069b4..cb7ff3b25 100644 --- a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder.java @@ -4,9 +4,6 @@ import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; -import com.google.android.material.appbar.AppBarLayout; -import androidx.core.content.ContextCompat; -import androidx.viewpager.widget.ViewPager; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; @@ -16,24 +13,29 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.core.content.ContextCompat; +import androidx.viewpager.widget.ViewPager; + import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.google.android.material.appbar.AppBarLayout; 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; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.live.activity.LiveContributeActivity; import com.yunbao.live.activity.LiveGuardListActivity; import com.yunbao.live.activity.SystemMessageActivity; @@ -87,7 +89,7 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL private AppBarLayout mAppBarLayout; private ImageView mAvatarBg; private ImageView mAvatar; - private TextView mName; + private TextView mName, leave; private ImageView mSex; private ImageView mLevelAnchor; private ImageView mLevel; @@ -158,6 +160,7 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL mAvatarBg = (ImageView) findViewById(R.id.bg_avatar); mAvatar = (ImageView) findViewById(R.id.avatar); mName = (TextView) findViewById(R.id.name); + leave = (TextView) findViewById(R.id.leave); mSex = (ImageView) findViewById(R.id.sex); mLevelAnchor = (ImageView) findViewById(R.id.level_anchor); mLevel = (ImageView) findViewById(R.id.level); @@ -205,8 +208,8 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL } }); - mVideoString =mContext.getString(R.string.video); - mLiveString =mContext.getString(R.string.live); + mVideoString = mContext.getString(R.string.video); + mLiveString = mContext.getString(R.string.live); mIndicator = (MagicIndicator) findViewById(R.id.indicator); final String[] titles = new String[]{mVideoString, mLiveString}; CommonNavigator commonNavigator = new CommonNavigator(mContext); @@ -354,15 +357,26 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL mTitleView.setText(toName); mSex.setImageResource(CommonIconUtil.getSexIcon(userBean.getSex())); CommonAppConfig appConfig = CommonAppConfig.getInstance(); - LevelBean levelAnchor = appConfig.getAnchorLevel(userBean.getLevelAnchor()); - ImgLoader.display(mContext, levelAnchor.getThumb(), mLevelAnchor); + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + anchorLevel = userBean.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } + } + leave.setText(String.valueOf(anchorLevel)); + ImgLoader.display(mContext, imgUrl, mLevelAnchor); + + 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)); - mBtnFollow.setText(StringUtil.toWan(userBean.getFollows()) + " " +mContext.getString(R.string.follow)); + mBtnFans.setText(fansNum + " " + mContext.getString(R.string.fans)); + mBtnFollow.setText(StringUtil.toWan(userBean.getFollows()) + " " + mContext.getString(R.string.follow)); mSign.setText(userBean.getSignature()); mBtnFollow2.setText(obj.getIntValue("isattention") == 1 ? R.string.following : R.string.follow); mBtnBlack.setText(obj.getIntValue("isblack") == 1 ? R.string.black_ing : R.string.black); @@ -374,7 +388,7 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL mLiveCountTextView.setText(mLiveString + " " + obj.getString("livenums")); } showImpress(obj.getString("label")); - mVotesName.setText(appConfig.getVotesName() +mContext.getString(R.string.live_user_home_con)); + mVotesName.setText(appConfig.getVotesName() + mContext.getString(R.string.live_user_home_con)); mUserHomeSharePresenter.setToUid(mToUid).setToName(toName).setAvatarThumb(userBean.getAvatarThumb()).setFansNum(fansNum); showContribute(obj.getString("contribute")); showGuardList(obj.getString("guardlist")); @@ -396,7 +410,7 @@ public class UserHomeViewHolder extends AbsLivePageViewHolder implements AppBarL } if (!mSelf) { ImpressBean lastBean = new ImpressBean(); - lastBean.setName("+ " +mContext.getString(R.string.impress_add)); + lastBean.setName("+ " + mContext.getString(R.string.impress_add)); lastBean.setColor("#ffdd00"); list.add(lastBean); } else { 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 a52f191fe..e4044d0fb 100644 --- a/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java +++ b/main/src/main/java/com/yunbao/main/views/UserHomeViewHolder2.java @@ -35,15 +35,21 @@ import com.yunbao.common.adapter.ViewPagerAdapter; import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.NewLevelModel; import com.yunbao.common.event.FollowEvent; +import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.event.UpdateFieldEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.LiveHttpConsts; +import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.manager.NewLevelManager; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; @@ -52,10 +58,6 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.bean.SearchUserBean; import com.yunbao.live.dialog.LiveShareDialogFragment; -import com.yunbao.common.event.LiveRoomChangeEvent; -import com.yunbao.common.http.LiveHttpConsts; -import com.yunbao.common.http.LiveHttpUtil; -import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.UserHomeSharePresenter; import com.yunbao.live.views.AbsLivePageViewHolder; import com.yunbao.live.views.AbsUserHomeViewHolder; @@ -112,7 +114,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh private ImageView mLevel; private TextView mID; private View mBtnLive; - private TextView mBtnFans; + private TextView mBtnFans , leave;; private TextView mBtnFollow; private ImageView mFollowImage; private int isblack; @@ -166,7 +168,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh } - String s =mContext.getString(R.string.black); + String s = mContext.getString(R.string.black); @Override public void init() { @@ -266,6 +268,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh mID = (TextView) findViewById(R.id.id_val); good_nub_ico = (ImageView) findViewById(R.id.good_nub_ico); mBtnFans = (TextView) findViewById(R.id.btn_fans); + leave = (TextView) findViewById(R.id.leave); mBtnFollow = (TextView) findViewById(R.id.btn_follow); gift_svga = (SVGAImageView) findViewById(com.yunbao.live.R.id.gift_svga); mAvatar = (ImageView) findViewById(R.id.avatar); @@ -316,8 +319,8 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh } }); - mVideoString =mContext.getString(R.string.video); - mLiveString =mContext.getString(R.string.honor); + mVideoString = mContext.getString(R.string.video); + mLiveString = mContext.getString(R.string.honor); mIndicator = (MagicIndicator) findViewById(R.id.indicator); final String[] titles = new String[]{mContext.getString(R.string.live_user_home_detail), mLiveString, mVideoString,}; // final String[] titles = new String[]{mContext.getString(R.string.live_user_home_detail), mVideoString}; //mxj update 2019-9-19 @@ -500,9 +503,20 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh mName.setText(toName); mSex.setImageResource(CommonIconUtil.getSexIcon(userBean.getSex())); CommonAppConfig appConfig = CommonAppConfig.getInstance(); - LevelBean levelAnchor = appConfig.getAnchorLevel(userBean.getLevelAnchor()); - Log.i("Tag", CommonAppConfig.getInstance().HOST + levelAnchor.getThumb()); - ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + levelAnchor.getThumb(), mLevelAnchor); + + List models = new NewLevelManager(mContext).getNewAnchorLevelModels(); + int anchorLevel = 0; + + anchorLevel = userBean.getLevelAnchor(); + String imgUrl = ""; + for (NewLevelModel newLevelModel : models) { + if (newLevelModel.getLeveMin() <= anchorLevel && anchorLevel <= newLevelModel.getLeveMax()) { + imgUrl = newLevelModel.getThumb(); + } + } + leave.setText(String.valueOf(userBean.getLevelAnchor())); + ImgLoader.display(mContext, imgUrl, mLevelAnchor); + LevelBean level = appConfig.getLevel(userBean.getLevel()); ImgLoader.display(mContext, level.getThumb(), mLevel); //修改靓号图标 个人中心子页面 @@ -515,8 +529,8 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh } // mID.setText(" "+userBean.getLiangNameTip()); String fansNum = StringUtil.toWan(userBean.getFans()); - mBtnFans.setText(fansNum + " " +mContext.getString(R.string.fans)); - mBtnFollow.setText(StringUtil.toWan(userBean.getFollows()) + " " +mContext.getString(R.string.follow)); + mBtnFans.setText(fansNum + " " + mContext.getString(R.string.fans)); + mBtnFollow.setText(StringUtil.toWan(userBean.getFollows()) + " " + mContext.getString(R.string.follow)); if (obj.getIntValue("isattention") == 1) { if (mFollowImage != null) { @@ -774,7 +788,7 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { if (mFromLiveRoom) { - if(MicStatusManager.getInstance().isMic(liveUid)){ + if (MicStatusManager.getInstance().isMic(liveUid)) { MicStatusManager.getInstance().showDownMicDialog(mContext); return; } @@ -864,8 +878,8 @@ public class UserHomeViewHolder2 extends AbsLivePageViewHolder implements LiveSh mSex.setImageResource(CommonIconUtil.getSexIcon(userBean.getSex())); mID.setText(userBean.getLiangNameTip()); String fansNum = StringUtil.toWan(userBean.getFans()); - mBtnFans.setText(fansNum + " " +mContext.getString(R.string.fans)); - mBtnFollow.setText(StringUtil.toWan(userBean.getFollows()) + " " +mContext.getString(R.string.follow)); + mBtnFans.setText(fansNum + " " + mContext.getString(R.string.fans)); + mBtnFollow.setText(StringUtil.toWan(userBean.getFollows()) + " " + mContext.getString(R.string.follow)); if (mDetailViewHolder != null) { mDetailViewHolder.refreshData(userBean, obj); } diff --git a/main/src/main/res/layout/dialog_encourage.xml b/main/src/main/res/layout/dialog_encourage.xml index 009921d9d..ba2b256e7 100644 --- a/main/src/main/res/layout/dialog_encourage.xml +++ b/main/src/main/res/layout/dialog_encourage.xml @@ -406,7 +406,7 @@ android:orientation="vertical" android:visibility="visible"> - - + android:paddingRight="15dp"> + app:riv_oval="true" /> + android:textSize="16sp" /> + android:textSize="14sp" /> - + + + + + + + + + android:layout_marginLeft="5dp" /> @@ -86,23 +96,21 @@ android:gravity="center" android:textColor="@color/fg_btn_follow" android:textSize="11sp" - android:visibility="gone" - /> + android:visibility="gone" /> + android:adjustViewBounds="true" + android:src="@mipmap/icon_user_home_living" + android:visibility="gone" /> + android:layout_alignParentBottom="true" /> \ No newline at end of file diff --git a/main/src/main/res/layout/view_live_user_home.xml b/main/src/main/res/layout/view_live_user_home.xml index fa8afd24c..dfe3cb2d8 100644 --- a/main/src/main/res/layout/view_live_user_home.xml +++ b/main/src/main/res/layout/view_live_user_home.xml @@ -1,28 +1,22 @@ - + android:background="@color/white"> + android:layout_alignParentBottom="true"> - + + android:orientation="horizontal"> + android:textStyle="bold" /> + android:layout_marginBottom="10dp" + android:background="@color/gray2" /> + android:textStyle="bold" /> + android:layout_marginBottom="10dp" + android:background="@color/gray2" /> + android:textStyle="bold" /> @@ -82,8 +71,7 @@ + android:layout_above="@id/bottom"> + app:layout_behavior="com.yunbao.common.custom.FixAppBarLayoutBehavior"> + app:layout_scrollFlags="scroll|exitUntilCollapsed"> + android:layout_height="220dp"> + android:scaleType="centerCrop" /> + android:background="#b3000000" /> + app:riv_oval="true" /> + android:textStyle="bold" /> + android:layout_marginRight="5dp" + android:layout_toRightOf="@id/avatar" /> - + android:layout_toRightOf="@id/sex"> + + + + + + + + android:layout_toRightOf="@id/level_anchor" /> + android:textSize="14sp" /> + android:textSize="14sp" /> + android:background="@color/white" /> + android:textSize="14sp" /> + android:textSize="14sp" /> + android:textStyle="bold" /> + android:layout_marginLeft="15dp"> + android:orientation="horizontal" /> + android:visibility="invisible" /> + android:background="@color/gray2" /> + android:paddingRight="15dp"> + android:src="@mipmap/icon_live_user_home_1" /> + android:textStyle="bold" /> + android:orientation="horizontal" /> + android:src="@mipmap/icon_arrow_right" /> - + + android:paddingRight="15dp"> + android:src="@mipmap/icon_live_user_home_2" /> + android:textStyle="bold" /> + android:orientation="horizontal" /> + android:src="@mipmap/icon_arrow_right" /> @@ -372,14 +345,12 @@ + android:orientation="vertical"> + android:background="@color/gray2" /> + android:layout_marginBottom="5dp" /> - + @@ -403,8 +371,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:overScrollMode="never" - app:layout_behavior="@string/appbar_scrolling_view_behavior" - /> + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> @@ -412,8 +379,7 @@ android:id="@+id/top" android:layout_width="match_parent" android:layout_height="65dp" - android:clickable="true" - > + android:clickable="true"> + android:textStyle="bold" /> + android:tint="@color/white" /> + android:tint="@color/white" /> \ No newline at end of file diff --git a/main/src/main/res/layout/view_live_user_home_2.xml b/main/src/main/res/layout/view_live_user_home_2.xml index 98e29d59b..0f6f7d5ba 100644 --- a/main/src/main/res/layout/view_live_user_home_2.xml +++ b/main/src/main/res/layout/view_live_user_home_2.xml @@ -219,10 +219,27 @@ android:gravity="bottom" android:orientation="horizontal"> - + + + + + + + + - + android:visibility="gone"> + + + + + + +