添加开通接口弹窗回调添加

This commit is contained in:
18401019693 2023-12-20 15:28:41 +08:00
parent ac78268a85
commit 42cfcce1dc
7 changed files with 111 additions and 19 deletions

View File

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

View File

@ -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<ResponseModel<Object>>() {
@Override
public void onSuccess(ResponseModel<Object> 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);
}
}

View File

@ -17,11 +17,17 @@ import com.yunbao.common.views.weight.ViewClicksAntiShake;
*/
public class PromotionElitePopupWindow extends CenterPopupView {
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();
}
});

View File

@ -1091,4 +1091,7 @@ public interface PDLiveApi {
Observable<ResponseModel<Object>> buyTicket(
@Field("quantity") String quantity
);
@GET("/api/public/?service=Livebattlepass.upgradesBattlePass")
Observable<ResponseModel<Object>> upgradesBattlePass(@Query("battle_pass_type_id") String battlePassTypeId);
}

View File

@ -2460,6 +2460,29 @@ public class LiveNetManager {
}).isDisposed();
}
public void upgradesBattlePass(String battlePassTypeId, HttpCallback<ResponseModel<Object>> callback) {
API.get().pdLiveApi(mContext)
.upgradesBattlePass(battlePassTypeId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<Object>>() {
@Override
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(objectResponseModel);
}
}
}, new Consumer<Throwable>() {
@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<QuickGiftSendGiftModel> callback) {
API.get().pdLiveApi(mContext)
.quickGiftSendGift(quickGiftNumber, liveUid, stream)

View File

@ -23,28 +23,43 @@
android:layout_height="wrap_content"
android:layout_marginTop="57dp">
<Button
<LinearLayout
android:id="@+id/cancel"
android:layout_width="116dp"
android:layout_height="38dp"
android:layout_marginStart="19dp"
android:background="@mipmap/button_liberal_battle_cancel"
android:gravity="center"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/cancel"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
<Button
<LinearLayout
android:id="@+id/liberal_battle_sure"
android:layout_width="116dp"
android:layout_height="38dp"
android:layout_gravity="end"
android:layout_marginEnd="19dp"
android:background="@mipmap/button_liberal_battle_sure"
android:gravity="center"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/confirm"
android:textColor="#E03600"
android:textSize="14sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View File

@ -39,6 +39,7 @@ import com.yunbao.common.bean.CoolConfig;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.NativeCallbackModel;
import com.yunbao.common.dialog.CinemaTicketPopupWindow;
import com.yunbao.common.dialog.LiberalBattlePassPopupWindow;
import com.yunbao.common.dialog.OrderLevelPopupWindow;
import com.yunbao.common.dialog.PromotionElitePopupWindow;
import com.yunbao.common.event.JavascriptInterfaceEvent;
@ -235,7 +236,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
new XPopup.Builder(mContext)
.enableDrag(false)
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
.asCustom(new PromotionElitePopupWindow(mContext,"62,888","12,888"))
.asCustom(new LiberalBattlePassPopupWindow(mContext,"62,888",false))
.show();
}
});