From 52f1a78e36ee2f9935c88db9c11ded18356ac8bc Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Wed, 23 Aug 2023 16:37:53 +0800 Subject: [PATCH 1/5] =?UTF-8?q?update=20=E7=BA=A2=E5=8C=85=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bean/RedPacketInfoModel.java | 10 ++++++++ .../com/yunbao/common/http/PDLiveApi.java | 5 ++-- .../common/http/live/LiveNetManager.java | 11 ++++---- common/src/main/res/values-en-rUS/string.xml | 2 +- common/src/main/res/values-zh-rHK/strings.xml | 1 + common/src/main/res/values-zh-rTW/strings.xml | 1 + common/src/main/res/values-zh/strings.xml | 2 +- common/src/main/res/values/strings.xml | 2 +- .../live/dialog/ReceiveRendPacketPopup.java | 5 ++++ .../live/dialog/SendRendPacketPopup.java | 25 ++++++++++++++----- .../res/layout/view_red_packet_luck_user.xml | 3 ++- .../res/layout/view_red_packet_user_list.xml | 2 +- .../main/res/layout/view_send_red_packet.xml | 15 +++++++++-- 13 files changed, 64 insertions(+), 20 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java index 49c05a3de..a28783b02 100644 --- a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java @@ -19,6 +19,8 @@ public class RedPacketInfoModel extends BaseModel { private String redPacketMoney; @SerializedName("red_packet_quantity") private String redPacketQuantity; + @SerializedName("is_fans") + private String isFans; @SerializedName("conditions") private String conditions; @SerializedName("create_time") @@ -270,4 +272,12 @@ public class RedPacketInfoModel extends BaseModel { this.userGoldenBean = userGoldenBean; return this; } + + public boolean getIsFans() { + return isFans.equals("1"); + } + + public void setIsFans(String isFans) { + this.isFans = isFans; + } } 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 47049923e..c7adca890 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -766,18 +766,19 @@ public interface PDLiveApi { /** - * 获取盲盒礼物当前数据 + * 创建红包 */ @GET("/api/public/?service=Live.createRedPacket") Observable> createRedPacket( @Query("liveuid") String liveUid, + @Query("is_fans") int needFansGroup, @Query("red_packet_money") String redPacketMoney, @Query("red_packet_quantity") String redPacketQuantity, @Query("conditions") String conditions ); /** - * 获取盲盒礼物当前数据 + * 获取红包数据 */ @GET("/api/public/?service=Live.redPacketInfo") Observable> redPacketInfo( 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 b385a72fb..d63b8dcff 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 @@ -1631,10 +1631,11 @@ public class LiveNetManager { * @param redPacketMoney 红包金额 * @param redPacketQuantity 红包数量 * @param conditions 红包领取条件 0.无 1.关注主播 + * @param needFansGroup 是否需要加入粉丝团条件 */ - public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, HttpCallback callback) { + public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, boolean needFansGroup, HttpCallback callback) { API.get().pdLiveApi(mContext) - .createRedPacket(liveUid, redPacketMoney, redPacketQuantity, conditions) + .createRedPacket(liveUid, needFansGroup ? 1 : 0, redPacketMoney, redPacketQuantity, conditions) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { @@ -1931,7 +1932,7 @@ public class LiveNetManager { public void giftDetail(String liveUid, String giftId, String toUid, HttpCallback callback) { API.get().pdLiveApi(mContext) - .giftDetail(liveUid, giftId,toUid) + .giftDetail(liveUid, giftId, toUid) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { @@ -2171,7 +2172,7 @@ public class LiveNetManager { }).isDisposed(); } - public void getGiftNamingInfo(String giftId,HttpCallback callback) { + public void getGiftNamingInfo(String giftId, HttpCallback callback) { API.get().pdLiveApi(mContext) .getGiftNamingInfo(giftId) .subscribeOn(Schedulers.io()) @@ -2179,7 +2180,7 @@ public class LiveNetManager { .subscribe(new Consumer>() { @Override public void accept(ResponseModel liveGiftBeanResponseModel) throws Exception { - if (callback!=null){ + if (callback != null) { callback.onSuccess(liveGiftBeanResponseModel.getData().getInfo()); } } diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index e784a8e72..9aa222dc1 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1312,6 +1312,6 @@ Limited ride And limited avatar frame cancel settings Too many gifts - + Join a fans club diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 3742dc4ea..9114c48a6 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1308,4 +1308,5 @@ 不再設置 去設置 重複添加禮物 + 加入粉絲團 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index df1963a96..00a7625d0 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1307,4 +1307,5 @@ 不再設置 去設置 重複添加禮物 + 加入粉絲團 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 673c59614..33ce7f48f 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1307,6 +1307,6 @@ 不再設置 去設置 重複添加禮物 - + 加入粉絲團 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index c802d3fd7..13c1affa6 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1313,5 +1313,5 @@ Limited ride And limited avatar frame cancel settings Too many gifts - + Join a fans club diff --git a/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java index 4dbd9a207..f09291b2c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/ReceiveRendPacketPopup.java @@ -95,6 +95,11 @@ public class ReceiveRendPacketPopup extends CenterPopupView { } userID = redPacketInfoModel.getUserId(); + if(redPacketInfoModel.getIsFans()){ + ToastUtil.show("粉丝团红包"); + }else{ + ToastUtil.show("普通红包"); + } } private Handler timeHandler = new Handler(); diff --git a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java index 3d2dd2c5a..34edceaf2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java @@ -24,7 +24,7 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; public class SendRendPacketPopup extends CenterPopupView { - private Button thereIsNo, followingAnchor; + private Button thereIsNo, followingAnchor, joinFansGroup; private TextView redEnvelopeRill, totalConsumptionOfDrill; private TextView rill, total; private FrameLayout redPacketIllustrate; @@ -58,6 +58,7 @@ public class SendRendPacketPopup extends CenterPopupView { redPacketIllustrate = findViewById(R.id.red_packet_illustrate); illustrateClose = findViewById(R.id.illustrate_close); iconInstructions = findViewById(R.id.icon_instructions); + joinFansGroup = findViewById(R.id.fans_group); rill = findViewById(R.id.rill); total = findViewById(R.id.total); selectText(thereIsNo, true); @@ -65,13 +66,21 @@ public class SendRendPacketPopup extends CenterPopupView { ViewClicksAntiShake.clicksAntiShake(thereIsNo, () -> { selectText(thereIsNo, true); selectText(followingAnchor, false); + selectText(joinFansGroup, false); conditions = "0"; }); ViewClicksAntiShake.clicksAntiShake(followingAnchor, () -> { selectText(thereIsNo, false); + selectText(joinFansGroup, false); selectText(followingAnchor, true); conditions = "1"; }); + ViewClicksAntiShake.clicksAntiShake(joinFansGroup, () -> { + selectText(thereIsNo, false); + selectText(joinFansGroup, true); + selectText(followingAnchor, false); + conditions = "0"; + }); redEnvelopeRill.setText(String.format(getContext().getString(R.string.red_envelope_rill), "0")); totalConsumptionOfDrill.setText(String.format(getContext().getString(R.string.total_consumption_of_drill), "0")); rill.addTextChangedListener(new TextWatcher() { @@ -198,7 +207,9 @@ public class SendRendPacketPopup extends CenterPopupView { .createRedPacket(mLiveID, rillNumber, number, - conditions, new HttpCallback() { + conditions, + joinFansGroup.getTag() != null && (boolean) joinFansGroup.getTag(), + new HttpCallback() { @Override public void onSuccess(String data) { ToastUtil.show(getContext().getString(R.string.red_envelope_released_successfully)); @@ -214,10 +225,10 @@ public class SendRendPacketPopup extends CenterPopupView { } }); - if(WordUtil.isNewZh()){ - ((ImageView)findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_zh); - }else{ - ((ImageView)findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_en); + if (WordUtil.isNewZh()) { + ((ImageView) findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_zh); + } else { + ((ImageView) findViewById(R.id.red_packet_info_img)).setImageResource(R.mipmap.bg_red_packet_info_en); } } @@ -225,8 +236,10 @@ public class SendRendPacketPopup extends CenterPopupView { textView.setSelected(select); if (select) { textView.setTextColor(Color.parseColor("#E12801")); + textView.setTag(true); } else { textView.setTextColor(Color.parseColor("#FDD04A")); + textView.setTag(false); } } diff --git a/live/src/main/res/layout/view_red_packet_luck_user.xml b/live/src/main/res/layout/view_red_packet_luck_user.xml index 78759e372..12ccd5791 100644 --- a/live/src/main/res/layout/view_red_packet_luck_user.xml +++ b/live/src/main/res/layout/view_red_packet_luck_user.xml @@ -11,8 +11,9 @@ android:id="@+id/gift_name" android:layout_width="0dp" android:layout_height="wrap_content" - android:text="dadsad" + android:text="中文测试中文测试" android:layout_weight="1" + android:maxEms="9" android:textColor="@color/white" android:textSize="16sp" /> diff --git a/live/src/main/res/layout/view_red_packet_user_list.xml b/live/src/main/res/layout/view_red_packet_user_list.xml index 3437d2037..bd92dfaf2 100644 --- a/live/src/main/res/layout/view_red_packet_user_list.xml +++ b/live/src/main/res/layout/view_red_packet_user_list.xml @@ -33,7 +33,7 @@ diff --git a/live/src/main/res/layout/view_send_red_packet.xml b/live/src/main/res/layout/view_send_red_packet.xml index b2165b243..afbeaea39 100644 --- a/live/src/main/res/layout/view_send_red_packet.xml +++ b/live/src/main/res/layout/view_send_red_packet.xml @@ -174,6 +174,18 @@ android:text="@string/following_anchor" android:textColor="#FDD04A" android:textSize="10sp" /> +