From 7005895d90092a39d76ac340b0e604aa5948b107 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sat, 26 Nov 2022 16:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=8E=A5=E5=8F=A3=E7=AC=ACli?= =?UTF-8?q?u=E6=AC=A1=E6=AC=A1=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/bean/GiftModel.java | 105 +++++++++++++++++ .../common/bean/NewPeopleTaskModel.java | 53 +++++++-- .../yunbao/common/bean/RewardAllModel.java | 28 +++++ .../com/yunbao/common/bean/TaskModel.java | 50 ++++++++ .../yunbao/live/views/LiveRoomViewHolder.java | 109 +++++++++--------- .../live/views/PortraitLiveManager.java | 2 + 6 files changed, 282 insertions(+), 65 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/GiftModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/RewardAllModel.java create mode 100644 common/src/main/java/com/yunbao/common/bean/TaskModel.java diff --git a/common/src/main/java/com/yunbao/common/bean/GiftModel.java b/common/src/main/java/com/yunbao/common/bean/GiftModel.java new file mode 100644 index 000000000..d03401e0e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GiftModel.java @@ -0,0 +1,105 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GiftModel extends BaseModel{ + @SerializedName("id") + private String id; + @SerializedName("sendtype") + private String sendtype; + @SerializedName("type") + private String type; + @SerializedName("mark") + private String mark; + @SerializedName("giftname") + private String giftname; + @SerializedName("needcoin") + private String needcoin; + @SerializedName("gifticon") + private String gifticon; + @SerializedName("swf") + private String swf; + @SerializedName("gift_uid") + private String giftUid; + + public String getId() { + return id; + } + + public GiftModel setId(String id) { + this.id = id; + return this; + } + + public String getSendtype() { + return sendtype; + } + + public GiftModel setSendtype(String sendtype) { + this.sendtype = sendtype; + return this; + } + + public String getType() { + return type; + } + + public GiftModel setType(String type) { + this.type = type; + return this; + } + + public String getMark() { + return mark; + } + + public GiftModel setMark(String mark) { + this.mark = mark; + return this; + } + + public String getGiftname() { + return giftname; + } + + public GiftModel setGiftname(String giftname) { + this.giftname = giftname; + return this; + } + + public String getNeedcoin() { + return needcoin; + } + + public GiftModel setNeedcoin(String needcoin) { + this.needcoin = needcoin; + return this; + } + + public String getGifticon() { + return gifticon; + } + + public GiftModel setGifticon(String gifticon) { + this.gifticon = gifticon; + return this; + } + + public String getSwf() { + return swf; + } + + public GiftModel setSwf(String swf) { + this.swf = swf; + return this; + } + + public String getGiftUid() { + return giftUid; + } + + public GiftModel setGiftUid(String giftUid) { + this.giftUid = giftUid; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java b/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java index 8d13676fa..e5e4114c7 100644 --- a/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java +++ b/common/src/main/java/com/yunbao/common/bean/NewPeopleTaskModel.java @@ -3,12 +3,49 @@ package com.yunbao.common.bean; import com.google.gson.annotations.SerializedName; public class NewPeopleTaskModel extends BaseModel { -// @SerializedName("task") -// private TaskModel task; -// @SerializedName("gift") -// private GiftModel gift; -// @SerializedName("reward_all") -// private RewardAllModel rewardAll; -// @SerializedName("reward_one") -// private RewardAllModel rewardOne; + + @SerializedName("task") + private TaskModel task; + @SerializedName("gift") + private GiftModel gift; + @SerializedName("reward_all") + private RewardAllModel rewardAll; + @SerializedName("reward_one") + private RewardAllModel rewardOne; + + public TaskModel getTask() { + return task; + } + + public NewPeopleTaskModel setTask(TaskModel task) { + this.task = task; + return this; + } + + public GiftModel getGift() { + return gift; + } + + public NewPeopleTaskModel setGift(GiftModel gift) { + this.gift = gift; + return this; + } + + public RewardAllModel getRewardAll() { + return rewardAll; + } + + public NewPeopleTaskModel setRewardAll(RewardAllModel rewardAll) { + this.rewardAll = rewardAll; + return this; + } + + public RewardAllModel getRewardOne() { + return rewardOne; + } + + public NewPeopleTaskModel setRewardOne(RewardAllModel rewardOne) { + this.rewardOne = rewardOne; + return this; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/RewardAllModel.java b/common/src/main/java/com/yunbao/common/bean/RewardAllModel.java new file mode 100644 index 000000000..cae2b2d2e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/RewardAllModel.java @@ -0,0 +1,28 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class RewardAllModel extends BaseModel{ + @SerializedName("gold") + private String gold; + @SerializedName("experience") + private String experience; + + public String getGold() { + return gold; + } + + public RewardAllModel setGold(String gold) { + this.gold = gold; + return this; + } + + public String getExperience() { + return experience; + } + + public RewardAllModel setExperience(String experience) { + this.experience = experience; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/TaskModel.java b/common/src/main/java/com/yunbao/common/bean/TaskModel.java new file mode 100644 index 000000000..fb804317e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/TaskModel.java @@ -0,0 +1,50 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class TaskModel extends BaseModel{ + @SerializedName("uid") + private String uid; + @SerializedName("attent") + private String attent; + @SerializedName("illumine") + private String illumine; + @SerializedName("sendgift") + private String sendgift; + + public String getUid() { + return uid; + } + + public TaskModel setUid(String uid) { + this.uid = uid; + return this; + } + + public String getAttent() { + return attent; + } + + public TaskModel setAttent(String attent) { + this.attent = attent; + return this; + } + + public String getIllumine() { + return illumine; + } + + public TaskModel setIllumine(String illumine) { + this.illumine = illumine; + return this; + } + + public String getSendgift() { + return sendgift; + } + + public TaskModel setSendgift(String sendgift) { + this.sendgift = sendgift; + return this; + } +} 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 f2e4b922f..a523f1d9e 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -39,7 +39,6 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.blankj.utilcode.util.GsonUtils; import com.bumptech.glide.Glide; import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.engine.GlideException; @@ -47,7 +46,6 @@ import com.bumptech.glide.load.resource.gif.GifDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.Target; -import com.google.gson.reflect.TypeToken; import com.makeramen.roundedimageview.RoundedImageView; import com.ms.banner.Banner; import com.ms.banner.BannerConfig; @@ -61,6 +59,7 @@ import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.AiAutomaticSpeechModel; import com.yunbao.common.bean.BannerBean; +import com.yunbao.common.bean.GiftModel; import com.yunbao.common.bean.GuardUserModel; import com.yunbao.common.bean.HourRank; import com.yunbao.common.bean.IMLoginModel; @@ -70,9 +69,12 @@ import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveUserGiftBean; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.NewPeopleTaskModel; import com.yunbao.common.bean.PkRankBean; import com.yunbao.common.bean.RankHourModel; +import com.yunbao.common.bean.RewardAllModel; import com.yunbao.common.bean.StarChallengeStatusModel; +import com.yunbao.common.bean.TaskModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.API; @@ -87,6 +89,7 @@ import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DeviceUtils; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ScreenDimenUtil; @@ -137,7 +140,6 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter; import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import com.yunbao.common.utils.MicStatusManager; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -319,7 +321,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //接口整合新加参数 private GuardUserModel guardUserModel; - private ViewFlipper flipper; + private ViewFlipper flipper; + public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -1052,8 +1055,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis findViewById(R.id.open_sidebar).setVisibility(View.GONE); findViewById(R.id.btn_follow).setVisibility(View.GONE); findViewById(R.id.live_rank_pk).setVisibility(View.GONE); - } else { - configBanner3(); } reloadIM(); initStarChallengeStatus(); @@ -1488,7 +1489,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } public void initHourRank(RankHourModel model) { - if (flipper.getChildCount()>0){ + if (flipper.getChildCount() > 0) { flipper.removeAllViews(); } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); @@ -1536,7 +1537,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 初始化小时榜 */ public void initHourRankList() { - if (flipper.getChildCount()>0){ + if (flipper.getChildCount() > 0) { flipper.removeAllViews(); } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16)); @@ -3161,59 +3162,53 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis /** * 初始化新人任务 */ - private void configBanner3() { - LiveHttpUtil.getFrontTask(IMLoginManager.get(mContext).getUserInfo().getToken(), "" + IMLoginManager.get(mContext).getUserInfo().getId(), new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - JSONObject old_obj = JSON.parseObject(info[0]); + public void configBanner3(NewPeopleTaskModel newPeopleTask) { + TaskModel taskModel = newPeopleTask.getTask(); - JSONObject obj = old_obj.getJSONObject("task"); - if (obj != null) { - JSONObject obj1 = old_obj.getJSONObject("gift"); - JSONObject reward_one = old_obj.getJSONObject("reward_one"); + if (taskModel != null) { + GiftModel giftModel = newPeopleTask.getGift(); + RewardAllModel rewardOne = newPeopleTask.getRewardOne(); + String gold = rewardOne.getGold(); + String experience = rewardOne.getExperience(); + bean1 = new LiveGiftBean(); + bean1.setSwf(giftModel.getSwf()); + bean1.setChecked(false); + bean1.setIcon(giftModel.getGifticon()); + bean1.setId(Integer.parseInt(giftModel.getId())); + bean1.setName(giftModel.getGiftname()); + bean1.setTag("1"); - String gold = reward_one.getString("gold"); - String experience = reward_one.getString("experience"); - bean1 = new LiveGiftBean(); - bean1.setSwf(obj1.getString("swf")); - bean1.setChecked(false); - bean1.setIcon(obj1.getString("gifticon")); - bean1.setId(obj1.getIntValue("id")); - bean1.setName(obj1.getString("giftname")); - bean1.setTag("1"); - - if (IMLoginManager.get(mContext).isisNewUserOne() == false) { - if (obj.getString("sendgift").equals("0")) { - IMLoginManager.get(mContext).setNewUserGif(true); - EventBus.getDefault().post("svga_new_user_gif"); - } - } - BannerBean banner3Bean = new BannerBean(); - banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean.setLink(obj.getString("sendgift")); - mBannerList3.add(banner3Bean); - - - BannerBean banner3Bean1 = new BannerBean(); - banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean1.setLink(obj.getString("attent")); - mBannerList3.add(banner3Bean1); - - BannerBean banner3Bean2 = new BannerBean(); - banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); - banner3Bean2.setLink(obj.getString("illumine")); - mBannerList3.add(banner3Bean2); - - if (obj.getString("sendgift").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { - showBanner3(bean1); - } else if (obj.getString("attent").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { - showBanner3(bean1); - } else if (obj.getString("illumine").equals("0") && !IMLoginManager.get(mContext).isisNewUserOne()) { - showBanner3(bean1); - } + if (!IMLoginManager.get(mContext).isisNewUserOne()) { + if (TextUtils.equals(taskModel.getSendgift(), "0")) { + IMLoginManager.get(mContext).setNewUserGif(true); + EventBus.getDefault().post("svga_new_user_gif"); } } - }); + BannerBean banner3Bean = new BannerBean(); + banner3Bean.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean.setLink(taskModel.getSendgift()); + mBannerList3.add(banner3Bean); + + + BannerBean banner3Bean1 = new BannerBean(); + banner3Bean1.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean1.setLink(taskModel.getAttent()); + mBannerList3.add(banner3Bean1); + + BannerBean banner3Bean2 = new BannerBean(); + banner3Bean2.setImageUrl("https://downs.yaoulive.com/live_Mission_box.png"); + banner3Bean2.setLink(taskModel.getIllumine()); + mBannerList3.add(banner3Bean2); + + if (TextUtils.equals(taskModel.getSendgift(), "0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } else if (TextUtils.equals(taskModel.getAttent(), "0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } else if (TextUtils.equals(taskModel.getIllumine(), "0") && !IMLoginManager.get(mContext).isisNewUserOne()) { + showBanner3(bean1); + } + } + } /** diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index da036bbd1..23d318fc7 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -299,6 +299,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe isEnterRoom = true; //加入房间发送Im消息 LiveNetManager.get(mContext).userJoinRoomNew(mLiveBean.getStream(), mLiveBean.getUid()); + //新人任務 + mLiveRoomViewHolder.configBanner3(data.getNewPeopleTask()); //小时榜 mLiveRoomViewHolder.initHourRank(data.getRankHour()); //守护