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