update 红包优化

This commit is contained in:
zlzw 2023-08-23 16:37:53 +08:00
parent 75b176a81e
commit 52f1a78e36
13 changed files with 64 additions and 20 deletions

View File

@ -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;
}
}

View File

@ -766,18 +766,19 @@ public interface PDLiveApi {
/**
* 获取盲盒礼物当前数据
* 创建红包
*/
@GET("/api/public/?service=Live.createRedPacket")
Observable<ResponseModel<Object>> 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<ResponseModel<RedPacketInfoModel>> redPacketInfo(

View File

@ -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<String> callback) {
public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, boolean needFansGroup, HttpCallback<String> 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<ResponseModel<Object>>() {
@ -1931,7 +1932,7 @@ public class LiveNetManager {
public void giftDetail(String liveUid, String giftId, String toUid, HttpCallback<GiftWallGiftDetail> callback) {
API.get().pdLiveApi(mContext)
.giftDetail(liveUid, giftId,toUid)
.giftDetail(liveUid, giftId, toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<GiftWallGiftDetail>>() {
@ -2171,7 +2172,7 @@ public class LiveNetManager {
}).isDisposed();
}
public void getGiftNamingInfo(String giftId,HttpCallback<GiftNamingInfoModel> callback) {
public void getGiftNamingInfo(String giftId, HttpCallback<GiftNamingInfoModel> callback) {
API.get().pdLiveApi(mContext)
.getGiftNamingInfo(giftId)
.subscribeOn(Schedulers.io())
@ -2179,7 +2180,7 @@ public class LiveNetManager {
.subscribe(new Consumer<ResponseModel<GiftNamingInfoModel>>() {
@Override
public void accept(ResponseModel<GiftNamingInfoModel> liveGiftBeanResponseModel) throws Exception {
if (callback!=null){
if (callback != null) {
callback.onSuccess(liveGiftBeanResponseModel.getData().getInfo());
}
}

View File

@ -1312,6 +1312,6 @@ Limited ride And limited avatar frame</string>
<string name="cancel_ca">cancel</string>
<string name="settings_ser">settings</string>
<string name="too_many_gifts">Too many gifts</string>
<string name="live_send_red_packge_fans_group">Join a fans club</string>
</resources>

View File

@ -1308,4 +1308,5 @@
<string name="cancel_ca">不再設置</string>
<string name="settings_ser">去設置</string>
<string name="too_many_gifts">重複添加禮物</string>
<string name="live_send_red_packge_fans_group">加入粉絲團</string>
</resources>

View File

@ -1307,4 +1307,5 @@
<string name="cancel_ca">不再設置</string>
<string name="settings_ser">去設置</string>
<string name="too_many_gifts">重複添加禮物</string>
<string name="live_send_red_packge_fans_group">加入粉絲團</string>
</resources>

View File

@ -1307,6 +1307,6 @@
<string name="cancel_ca">不再設置</string>
<string name="settings_ser">去設置</string>
<string name="too_many_gifts">重複添加禮物</string>
<string name="live_send_red_packge_fans_group">加入粉絲團</string>
</resources>

View File

@ -1313,5 +1313,5 @@ Limited ride And limited avatar frame</string>
<string name="cancel_ca">cancel</string>
<string name="settings_ser">settings</string>
<string name="too_many_gifts">Too many gifts</string>
<string name="live_send_red_packge_fans_group">Join a fans club</string>
</resources>

View File

@ -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();

View File

@ -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<String>() {
conditions,
joinFansGroup.getTag() != null && (boolean) joinFansGroup.getTag(),
new HttpCallback<String>() {
@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);
}
}

View File

@ -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" />

View File

@ -33,7 +33,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/user_list"
android:layout_width="200dp"
android:layout_width="250dp"
tools:listitem="@layout/view_red_packet_luck_user"
android:layout_height="241dp"
android:layout_marginTop="26dp" />

View File

@ -174,6 +174,18 @@
android:text="@string/following_anchor"
android:textColor="#FDD04A"
android:textSize="10sp" />
<Button
android:id="@+id/fans_group"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="end"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:background="@drawable/background_red_packet_select"
android:gravity="center"
android:text="@string/live_send_red_packge_fans_group"
android:textColor="#FDD04A"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
@ -232,8 +244,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_send_red_packet_illustrate"
android:visibility="gone"
tools:visibility="visible">
android:visibility="gone">
<androidx.core.widget.NestedScrollView