Merge remote-tracking branch 'origin/dev_6.6.4_战令' into dev_6.6.4_战令

This commit is contained in:
zlzw 2023-12-21 16:26:04 +08:00
commit 1304ec6cde
4 changed files with 59 additions and 2 deletions

View File

@ -9,6 +9,9 @@ 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;
import java.math.BigDecimal;
@ -21,13 +24,17 @@ public class OrderLevelPopupWindow extends CenterPopupView {
private int currentExperience, totalExperience;//当前经验全部经验
private String buyExp = "100", currentLevel, balance;
private ProgressBar progressBar;
private OrderLevelCallback orderLevelCallback;
public OrderLevelPopupWindow(@NonNull Context context, int mCurrentExperience, int mTotalExperience, String mCurrentLevel, String mBalance) {
public OrderLevelPopupWindow(@NonNull Context context,
int mCurrentExperience, int mTotalExperience,
String mCurrentLevel, String mBalance, OrderLevelCallback mOrderLevelCallback) {
super(context);
currentExperience = mCurrentExperience;
totalExperience = mTotalExperience;
currentLevel = mCurrentLevel;
balance = mBalance;
orderLevelCallback = mOrderLevelCallback;
}
@Override
@ -80,5 +87,30 @@ public class OrderLevelPopupWindow extends CenterPopupView {
dialog.dismiss();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.buying_experience), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
LiveNetManager.get(getContext())
.buyingExperiencePoint(buyExp, new HttpCallback<ResponseModel<Object>>() {
@Override
public void onSuccess(ResponseModel<Object> data) {
if (orderLevelCallback != null) {
orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg());
}dialog.dismiss();
}
@Override
public void onError(String error) {
if (orderLevelCallback != null) {
orderLevelCallback.onCallback(102, error);
} dialog.dismiss();
}
});
}
});
}
public interface OrderLevelCallback {
void onCallback(int code, String msg);
}
}

View File

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

View File

@ -2460,13 +2460,34 @@ public class LiveNetManager {
}).isDisposed();
}
public void buyingExperiencePoint(String expCount, HttpCallback<ResponseModel<Object>> callback) {
API.get().pdLiveApi(mContext)
.buyingExperiencePoint(expCount)
.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 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);

View File

@ -138,6 +138,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/buying_experience"
android:layout_width="116dp"
android:layout_height="38dp"
android:layout_gravity="center"