From 8f9d558043e68a4d80cd1070e16edf5eaaa49deb Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Thu, 17 Aug 2023 18:15:25 +0800 Subject: [PATCH] =?UTF-8?q?6.5.4=E7=A4=BC=E7=89=A9=E5=86=A0=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bean/GiftNamingInfoModel.java | 359 ++++++++++++++++++ .../com/yunbao/common/bean/LiveGiftBean.java | 11 + .../com/yunbao/common/http/PDLiveApi.java | 13 +- .../common/http/live/LiveNetManager.java | 26 +- .../res/layout/dialog_live_gift_popup.xml | 3 +- .../com/yunbao/live/dialog/LiveGiftPopup.java | 105 +++-- 6 files changed, 473 insertions(+), 44 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/bean/GiftNamingInfoModel.java diff --git a/common/src/main/java/com/yunbao/common/bean/GiftNamingInfoModel.java b/common/src/main/java/com/yunbao/common/bean/GiftNamingInfoModel.java new file mode 100644 index 000000000..1c238d98a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/GiftNamingInfoModel.java @@ -0,0 +1,359 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class GiftNamingInfoModel extends BaseModel { + + @SerializedName("id") + private String id; + @SerializedName("sendtype") + private String sendtype; + @SerializedName("type") + private String type; + @SerializedName("name") + private String name; + @SerializedName("release_status") + private String releaseStatus; + @SerializedName("type_sort") + private String typeSort; + @SerializedName("operate_image") + private String operateImage; + @SerializedName("operate_url") + private String operateUrl; + @SerializedName("mark") + private String mark; + @SerializedName("giftname") + private String giftname; + @SerializedName("needcoin") + private String needcoin; + @SerializedName("gifticon") + private String gifticon; + @SerializedName("gift_description") + private String giftDescription; + @SerializedName("corner_mark") + private String cornerMark; + @SerializedName("swf") + private String swf; + @SerializedName("gift_uid") + private String giftUid; + @SerializedName("type_start_time") + private String typeStartTime; + @SerializedName("type_end_time") + private String typeEndTime; + @SerializedName("gift_start_time") + private String giftStartTime; + @SerializedName("gift_end_time") + private String giftEndTime; + @SerializedName("naming_liveuid") + private String namingLiveuid; + @SerializedName("naming_uid") + private String namingUid; + @SerializedName("naming_live_name") + private String namingLiveName; + @SerializedName("naming_user_name") + private String namingUserName; + @SerializedName("naming_live_avatar") + private String namingLiveAvatar; + @SerializedName("naming_user_avatar") + private String namingUserAvatar; + @SerializedName("naming_status") + private String namingStatus; + @SerializedName("naming_coin") + private String namingCoin; + @SerializedName("fans_level") + private String fansLevel; + @SerializedName("naming_user_coin") + private String namingUserCoin; + @SerializedName("naming_live_coin") + private String namingLiveCoin; + @SerializedName("isweek") + private String isweek; + + public String getId() { + return id; + } + + public GiftNamingInfoModel setId(String id) { + this.id = id; + return this; + } + + public String getSendtype() { + return sendtype; + } + + public GiftNamingInfoModel setSendtype(String sendtype) { + this.sendtype = sendtype; + return this; + } + + public String getType() { + return type; + } + + public GiftNamingInfoModel setType(String type) { + this.type = type; + return this; + } + + public String getName() { + return name; + } + + public GiftNamingInfoModel setName(String name) { + this.name = name; + return this; + } + + public String getReleaseStatus() { + return releaseStatus; + } + + public GiftNamingInfoModel setReleaseStatus(String releaseStatus) { + this.releaseStatus = releaseStatus; + return this; + } + + public String getTypeSort() { + return typeSort; + } + + public GiftNamingInfoModel setTypeSort(String typeSort) { + this.typeSort = typeSort; + return this; + } + + public String getOperateImage() { + return operateImage; + } + + public GiftNamingInfoModel setOperateImage(String operateImage) { + this.operateImage = operateImage; + return this; + } + + public String getOperateUrl() { + return operateUrl; + } + + public GiftNamingInfoModel setOperateUrl(String operateUrl) { + this.operateUrl = operateUrl; + return this; + } + + public String getMark() { + return mark; + } + + public GiftNamingInfoModel setMark(String mark) { + this.mark = mark; + return this; + } + + public String getGiftname() { + return giftname; + } + + public GiftNamingInfoModel setGiftname(String giftname) { + this.giftname = giftname; + return this; + } + + public String getNeedcoin() { + return needcoin; + } + + public GiftNamingInfoModel setNeedcoin(String needcoin) { + this.needcoin = needcoin; + return this; + } + + public String getGifticon() { + return gifticon; + } + + public GiftNamingInfoModel setGifticon(String gifticon) { + this.gifticon = gifticon; + return this; + } + + public String getGiftDescription() { + return giftDescription; + } + + public GiftNamingInfoModel setGiftDescription(String giftDescription) { + this.giftDescription = giftDescription; + return this; + } + + public String getCornerMark() { + return cornerMark; + } + + public GiftNamingInfoModel setCornerMark(String cornerMark) { + this.cornerMark = cornerMark; + return this; + } + + public String getSwf() { + return swf; + } + + public GiftNamingInfoModel setSwf(String swf) { + this.swf = swf; + return this; + } + + public String getGiftUid() { + return giftUid; + } + + public GiftNamingInfoModel setGiftUid(String giftUid) { + this.giftUid = giftUid; + return this; + } + + public String getTypeStartTime() { + return typeStartTime; + } + + public GiftNamingInfoModel setTypeStartTime(String typeStartTime) { + this.typeStartTime = typeStartTime; + return this; + } + + public String getTypeEndTime() { + return typeEndTime; + } + + public GiftNamingInfoModel setTypeEndTime(String typeEndTime) { + this.typeEndTime = typeEndTime; + return this; + } + + public String getGiftStartTime() { + return giftStartTime; + } + + public GiftNamingInfoModel setGiftStartTime(String giftStartTime) { + this.giftStartTime = giftStartTime; + return this; + } + + public String getGiftEndTime() { + return giftEndTime; + } + + public GiftNamingInfoModel setGiftEndTime(String giftEndTime) { + this.giftEndTime = giftEndTime; + return this; + } + + public String getNamingLiveuid() { + return namingLiveuid; + } + + public GiftNamingInfoModel setNamingLiveuid(String namingLiveuid) { + this.namingLiveuid = namingLiveuid; + return this; + } + + public String getNamingUid() { + return namingUid; + } + + public GiftNamingInfoModel setNamingUid(String namingUid) { + this.namingUid = namingUid; + return this; + } + + public String getNamingLiveName() { + return namingLiveName; + } + + public GiftNamingInfoModel setNamingLiveName(String namingLiveName) { + this.namingLiveName = namingLiveName; + return this; + } + + public String getNamingUserName() { + return namingUserName; + } + + public GiftNamingInfoModel setNamingUserName(String namingUserName) { + this.namingUserName = namingUserName; + return this; + } + + public String getNamingLiveAvatar() { + return namingLiveAvatar; + } + + public GiftNamingInfoModel setNamingLiveAvatar(String namingLiveAvatar) { + this.namingLiveAvatar = namingLiveAvatar; + return this; + } + + public String getNamingUserAvatar() { + return namingUserAvatar; + } + + public GiftNamingInfoModel setNamingUserAvatar(String namingUserAvatar) { + this.namingUserAvatar = namingUserAvatar; + return this; + } + + public String getNamingStatus() { + return namingStatus; + } + + public GiftNamingInfoModel setNamingStatus(String namingStatus) { + this.namingStatus = namingStatus; + return this; + } + + public String getNamingCoin() { + return namingCoin; + } + + public GiftNamingInfoModel setNamingCoin(String namingCoin) { + this.namingCoin = namingCoin; + return this; + } + + public String getFansLevel() { + return fansLevel; + } + + public GiftNamingInfoModel setFansLevel(String fansLevel) { + this.fansLevel = fansLevel; + return this; + } + + public String getNamingUserCoin() { + return namingUserCoin; + } + + public GiftNamingInfoModel setNamingUserCoin(String namingUserCoin) { + this.namingUserCoin = namingUserCoin; + return this; + } + + public String getNamingLiveCoin() { + return namingLiveCoin; + } + + public GiftNamingInfoModel setNamingLiveCoin(String namingLiveCoin) { + this.namingLiveCoin = namingLiveCoin; + return this; + } + + public String getIsweek() { + return isweek; + } + + public GiftNamingInfoModel setIsweek(String isweek) { + this.isweek = isweek; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index dbeebfe14..2dac9e946 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -64,6 +64,17 @@ public class LiveGiftBean { private String namingStatus; @JSONField(name = "naming_coin") private String namingCoin; + @JSONField(name = "naming_user_coin") + private String namingUserCoin; + + public String getNamingUserCoin() { + return namingUserCoin; + } + + public LiveGiftBean setNamingUserCoin(String namingUserCoin) { + this.namingUserCoin = namingUserCoin; + return this; + } public View getmView() { return mView; 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 303544ac4..17566a7b4 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -17,6 +17,7 @@ import com.yunbao.common.bean.FansGroupGiftPack; import com.yunbao.common.bean.FansGroupGiftPackInfo; import com.yunbao.common.bean.GiftAlreadyWallModel; import com.yunbao.common.bean.GiftGuideModel; +import com.yunbao.common.bean.GiftNamingInfoModel; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.HourRank; @@ -932,7 +933,8 @@ public interface PDLiveApi { /** * 获取粉丝团礼物信息 - * @param packId 礼包id + * + * @param packId 礼包id */ @GET("/api/public/?service=Fans.getFansExclusivePack") Observable> getFansExclusivePack(@Query("liveuid") String liveUid, @@ -941,24 +943,29 @@ public interface PDLiveApi { /** * 购买粉丝团礼包 + * * @param packId 礼包id */ - @GET("/api/public/?service=Fans.buyFansExclusivePack") + @GET("/api/public/?service=Fans.buyFansExclusivePack") Observable> buyFansExclusivePack(@Query("liveuid") String liveUid, @Query("pack_id") String packId, @Query("stream") String stream - ); + ); /** * 获取粉丝团礼物包裹 */ @GET("/api/public/?service=Fans.userFansExclusivePackList") Observable>> userFansExclusivePackList(@Query("liveuid") String liveUid); + /** * 获取粉丝团礼物包裹 */ @GET("/api/public/?service=Fans.getCheckFansLevelUpgrade") Observable> getCheckFansLevelUpgrade(@Query("liveuid") String liveUid); + @GET("/api/public/?service=gift.getGiftNamingInfo") + Observable> getGiftNamingInfo(@Query("gift_id") String giftId); + } 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 76f942bab..a384b702a 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 @@ -18,6 +18,7 @@ import com.yunbao.common.bean.FansGroupGiftPack; import com.yunbao.common.bean.FansGroupGiftPackInfo; import com.yunbao.common.bean.GiftAlreadyWallModel; import com.yunbao.common.bean.GiftGuideModel; +import com.yunbao.common.bean.GiftNamingInfoModel; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.HttpCallbackModel; @@ -28,6 +29,7 @@ import com.yunbao.common.bean.LiveAiRobotBean; import com.yunbao.common.bean.LiveAnchorCallMeModel; import com.yunbao.common.bean.LiveAnchorSayModel; import com.yunbao.common.bean.LiveDataInfoModel; +import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.LiveRoomActivityBanner; import com.yunbao.common.bean.LiveRoomVoteModel; @@ -57,8 +59,6 @@ import com.yunbao.common.http.API; import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.base.CheckLiveCallBack; import com.yunbao.common.http.base.HttpCallback; -import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import java.util.ArrayList; import java.util.HashMap; @@ -2171,6 +2171,28 @@ public class LiveNetManager { }).isDisposed(); } + public void getGiftNamingInfo(String giftId,HttpCallback callback) { + API.get().pdLiveApi(mContext) + .getGiftNamingInfo(giftId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel liveGiftBeanResponseModel) throws Exception { + if (callback!=null){ + callback.onSuccess(liveGiftBeanResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/res/layout/dialog_live_gift_popup.xml b/common/src/main/res/layout/dialog_live_gift_popup.xml index c289530fa..9c96059d6 100644 --- a/common/src/main/res/layout/dialog_live_gift_popup.xml +++ b/common/src/main/res/layout/dialog_live_gift_popup.xml @@ -195,7 +195,6 @@ android:layout_marginStart="15dp" android:layout_marginEnd="16dp" android:layout_weight="1" - android:background="@drawable/background_gift_description" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" @@ -203,7 +202,7 @@ android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" - android:textColor="#FFFFFFFF" + android:textColor="#80FFFFFF" android:textSize="12sp" /> 0) { - JSONObject obj = JSON.parseObject(info[0]); - liveGiftList = obj.getJSONArray("listarray"); - CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray")); - getCoin(); - goldText.setText(obj.getString("gold")); - diamondText.setText(obj.getString("coin")); - setTitleData(); - - } - } - - @Override - public void onFinish() { + LiveHttpUtil.getNewGiftList(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + JSONObject obj = JSON.parseObject(info[0]); + liveGiftList = obj.getJSONArray("listarray"); + CommonAppConfig.getInstance().setGiftListJson(obj.getString("listarray")); getCoin(); -// if (mLoading != null) { -// mLoading.setVisibility(View.INVISIBLE); -// } + goldText.setText(obj.getString("gold")); + diamondText.setText(obj.getString("coin")); + setTitleData(); + } - }); - } else { - getCoin(); - setTitleData(); - } + } + + @Override + public void onFinish() { + getCoin(); + } + }); getBlindBoxInfo(); loadUserVip(); } @@ -508,7 +492,7 @@ public class LiveGiftPopup extends AbsDialogFragment { throw new RuntimeException(e); } } else { - String hint = getString(R.string.reach_the_top); + String hint = mContext.getString(R.string.reach_the_top); leaveHint.setText(hint); progressBar.setMax(10); progressBar.setProgress(10); @@ -642,6 +626,44 @@ public class LiveGiftPopup extends AbsDialogFragment { lianSongHandler.removeCallbacks(lianSongRunnable); mShowLianBtn = false; getCoin(); + LiveNetManager.get(mContext) + .getGiftNamingInfo(liveGiftModel.getId() + "", new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(GiftNamingInfoModel data) { + liveGiftModel = JSONObject.parseObject(GsonUtils.toJson(data), LiveGiftBean.class); + if (!TextUtils.isEmpty(liveGiftModel.getNamingLiveuid()) && + !TextUtils.isEmpty(liveGiftModel.getNamingUid()) && + !TextUtils.equals(liveGiftModel.getNamingLiveuid(), "0") && + !TextUtils.equals(liveGiftModel.getNamingUid(), "0")) { + namingLayout.setVisibility(View.VISIBLE); + ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar); + StringBuffer namingNameText = new StringBuffer(); + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + namingNameText.append("获取冠名:") + .append(liveGiftModel.getNamingUserCoin()) + .append("个 "); + } else { + namingNameText.append("Get title: ") + .append(liveGiftModel.getNamingUserCoin()) + .append(" "); + } + namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor)) + .append(liveGiftModel.getNamingLiveName()) + .append(" ") + .append(mContext.getText(com.yunbao.live.R.string.the_title_financier)) + .append(liveGiftModel.getNamingUserName()); + namingName.setText(namingNameText.toString()); + } else { + namingLayout.setVisibility(View.GONE); + + } + } + + @Override + public void onError(String error) { + + } + }); } /** @@ -699,6 +721,14 @@ public class LiveGiftPopup extends AbsDialogFragment { namingLayout.setVisibility(View.VISIBLE); ImgLoader.display(mContext, liveGiftModel.getNamingLiveAvatar(), namingAvatar); StringBuffer namingNameText = new StringBuffer(); + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + namingNameText.append("获取冠名:") + .append(liveGiftModel.getNamingUserCoin()) + .append("个"); + } else { + namingNameText.append("Get title: ") + .append(liveGiftModel.getNamingUserCoin()); + } namingNameText.append(mContext.getText(com.yunbao.live.R.string.title_anchor)) .append(liveGiftModel.getNamingLiveName()) .append(" ") @@ -738,6 +768,7 @@ public class LiveGiftPopup extends AbsDialogFragment { operateImage.setVisibility(View.VISIBLE); ImgLoader.display(getContext(), liveGiftModel.getOperateImage(), operateImage); } + } @Subscribe(threadMode = ThreadMode.MAIN)