From ac78268a850483857434b70ef1f5fe9b5a203793 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 19 Dec 2023 15:59:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dialog/ActivityEndPopupWindow.java | 35 ++++++++++++++++ .../main/res/layout/activity_end_popup.xml | 40 +++++++++++++++++++ common/src/main/res/values/strings.xml | 1 + 3 files changed, 76 insertions(+) create mode 100644 common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java create mode 100644 common/src/main/res/layout/activity_end_popup.xml diff --git a/common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java new file mode 100644 index 000000000..3993f2911 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/ActivityEndPopupWindow.java @@ -0,0 +1,35 @@ +package com.yunbao.common.dialog; + +import android.content.Context; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +/** + * 活动结束 + */ +public class ActivityEndPopupWindow extends CenterPopupView { + public ActivityEndPopupWindow(@NonNull Context context) { + super(context); + } + + @Override + protected int getImplLayoutId() { + return R.layout.activity_end_popup; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.confirm), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dialog.dismiss(); + } + }); + } +} diff --git a/common/src/main/res/layout/activity_end_popup.xml b/common/src/main/res/layout/activity_end_popup.xml new file mode 100644 index 000000000..09a2d5882 --- /dev/null +++ b/common/src/main/res/layout/activity_end_popup.xml @@ -0,0 +1,40 @@ + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 01dc883b5..60edd53e5 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1412,5 +1412,6 @@ Limited ride And limited avatar frame 我的等級 購買經驗值: 購買 + 本期活動已結束,請儘快領取未領取的獎勵積分可保留下次使用 From 42cfcce1dc3efe09accd9426d486634458513959 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 20 Dec 2023 15:28:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=80=E9=80=9A?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=B9=E7=AA=97=E5=9B=9E=E8=B0=83=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivateEliteBattleOrderPopupWindow.java | 12 +++++- .../dialog/LiberalBattlePassPopupWindow.java | 38 ++++++++++++++++++- .../dialog/PromotionElitePopupWindow.java | 14 +++++-- .../com/yunbao/common/http/PDLiveApi.java | 3 ++ .../common/http/live/LiveNetManager.java | 23 +++++++++++ .../res/layout/liberal_battle_pass_popup.xml | 37 ++++++++++++------ .../views/MainHomeCommunityViewHolder.java | 3 +- 7 files changed, 111 insertions(+), 19 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java index f028bd1e2..efe82b89d 100644 --- a/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/ActivateEliteBattleOrderPopupWindow.java @@ -17,11 +17,18 @@ public class ActivateEliteBattleOrderPopupWindow extends CenterPopupView { private boolean elites;//是否精英战令 private String spendMoney;//花费钱 private Button buttonWarOrder; + private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback; + private String mBattlePassTypeId; - public ActivateEliteBattleOrderPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites) { + public ActivateEliteBattleOrderPopupWindow(@NonNull Context context, String mSpendMoney, + boolean elites, + LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback + , String battlePassTypeId) { super(context); this.elites = elites; spendMoney = mSpendMoney; + mPassCallback=passCallback; + mBattlePassTypeId = battlePassTypeId; } @Override @@ -64,9 +71,10 @@ public class ActivateEliteBattleOrderPopupWindow extends CenterPopupView { new XPopup.Builder(getContext()) .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) - .asCustom(new LiberalBattlePassPopupWindow(getContext(), spendMoney, elites)) + .asCustom(new LiberalBattlePassPopupWindow(getContext(), spendMoney, elites,mPassCallback,mBattlePassTypeId)) .show(); } }); + } } diff --git a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java index 08123554c..b2767f518 100644 --- a/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/LiberalBattlePassPopupWindow.java @@ -11,17 +11,24 @@ import androidx.annotation.NonNull; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; +import com.yunbao.common.http.ResponseModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.views.weight.ViewClicksAntiShake; public class LiberalBattlePassPopupWindow extends CenterPopupView { private String spendMoney;//花费钱 private boolean mElites;//是否精英战令 private TextView liberalBattlePass; + private LiberalBattlePassCallback mPassCallback; + private String mBattlePassTypeId; - public LiberalBattlePassPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites) { + public LiberalBattlePassPopupWindow(@NonNull Context context, String mSpendMoney, boolean elites, LiberalBattlePassCallback passCallback, String battlePassTypeId) { super(context); spendMoney = mSpendMoney; mElites = elites; + mPassCallback = passCallback; + mBattlePassTypeId = battlePassTypeId; } protected int getImplLayoutId() { @@ -53,7 +60,36 @@ public class LiberalBattlePassPopupWindow extends CenterPopupView { dialog.dismiss(); } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.liberal_battle_sure), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(getContext()). + upgradesBattlePass(mBattlePassTypeId, new HttpCallback>() { + @Override + public void onSuccess(ResponseModel data) { + dialog.dismiss(); + if (mPassCallback != null) { + mPassCallback.onCallback(data.getData().getCode(), data.getData().getMsg()); + } + } + + @Override + public void onError(String error) { + + dialog.dismiss(); + if (mPassCallback != null) { + mPassCallback.onCallback(102, error); + } + } + }); + + } + }); } + + public interface LiberalBattlePassCallback { + void onCallback(int code, String msg); + } } diff --git a/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java index cefbcbfd5..1283582d7 100644 --- a/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/PromotionElitePopupWindow.java @@ -16,12 +16,18 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake; * 升級精英/尊享戰令 */ public class PromotionElitePopupWindow extends CenterPopupView { - private String enjoySpendMoney,quintessenceSpendMoney;//花费钱 + private String enjoySpendMoney, quintessenceSpendMoney;//花费钱 + private LiberalBattlePassPopupWindow.LiberalBattlePassCallback mPassCallback; + private String mBattlePassTypeId; - public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney, String mQuintessenceSpendMoney) { + public PromotionElitePopupWindow(@NonNull Context context, String mEnjoySpendMoney, + String mQuintessenceSpendMoney, LiberalBattlePassPopupWindow.LiberalBattlePassCallback passCallback, + String battlePassTypeId) { super(context); enjoySpendMoney = mEnjoySpendMoney; quintessenceSpendMoney = mQuintessenceSpendMoney; + mPassCallback = passCallback; + mBattlePassTypeId = battlePassTypeId; } @Override @@ -46,7 +52,7 @@ public class PromotionElitePopupWindow extends CenterPopupView { new XPopup.Builder(getContext()) .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) - .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), quintessenceSpendMoney, true, mPassCallback, mBattlePassTypeId)) .show(); } }); @@ -57,7 +63,7 @@ public class PromotionElitePopupWindow extends CenterPopupView { new XPopup.Builder(getContext()) .enableDrag(false) .maxWidth(DeviceUtils.getScreenHeight((Activity) getContext()) - DpUtil.dp2px(34)) - .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false)) + .asCustom(new ActivateEliteBattleOrderPopupWindow(getContext(), enjoySpendMoney, false, mPassCallback, mBattlePassTypeId)) .show(); } }); 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 b0f7ca437..e3d996bb8 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1091,4 +1091,7 @@ public interface PDLiveApi { Observable> buyTicket( @Field("quantity") String quantity ); + + @GET("/api/public/?service=Livebattlepass.upgradesBattlePass") + Observable> upgradesBattlePass(@Query("battle_pass_type_id") String battlePassTypeId); } 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 5716e4c33..3e3df7f99 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 @@ -2460,6 +2460,29 @@ public class LiveNetManager { }).isDisposed(); } + public void upgradesBattlePass(String battlePassTypeId, HttpCallback> callback) { + API.get().pdLiveApi(mContext) + .upgradesBattlePass(battlePassTypeId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel objectResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(objectResponseModel); + } + + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void quickGiftSendGift(String quickGiftNumber, String liveUid, String stream, HttpCallback callback) { API.get().pdLiveApi(mContext) .quickGiftSendGift(quickGiftNumber, liveUid, stream) diff --git a/common/src/main/res/layout/liberal_battle_pass_popup.xml b/common/src/main/res/layout/liberal_battle_pass_popup.xml index 57f1ce146..e49136d12 100644 --- a/common/src/main/res/layout/liberal_battle_pass_popup.xml +++ b/common/src/main/res/layout/liberal_battle_pass_popup.xml @@ -23,28 +23,43 @@ android:layout_height="wrap_content" android:layout_marginTop="57dp"> - -