购买经验
This commit is contained in:
parent
1495bfee99
commit
f46d14ce28
@ -9,6 +9,9 @@ import androidx.annotation.NonNull;
|
|||||||
|
|
||||||
import com.lxj.xpopup.core.CenterPopupView;
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
import com.yunbao.common.R;
|
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 com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -21,13 +24,17 @@ public class OrderLevelPopupWindow extends CenterPopupView {
|
|||||||
private int currentExperience, totalExperience;//当前经验,全部经验
|
private int currentExperience, totalExperience;//当前经验,全部经验
|
||||||
private String buyExp = "100", currentLevel, balance;
|
private String buyExp = "100", currentLevel, balance;
|
||||||
private ProgressBar progressBar;
|
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);
|
super(context);
|
||||||
currentExperience = mCurrentExperience;
|
currentExperience = mCurrentExperience;
|
||||||
totalExperience = mTotalExperience;
|
totalExperience = mTotalExperience;
|
||||||
currentLevel = mCurrentLevel;
|
currentLevel = mCurrentLevel;
|
||||||
balance = mBalance;
|
balance = mBalance;
|
||||||
|
orderLevelCallback = mOrderLevelCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -80,5 +87,30 @@ public class OrderLevelPopupWindow extends CenterPopupView {
|
|||||||
dialog.dismiss();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1094,4 +1094,7 @@ public interface PDLiveApi {
|
|||||||
|
|
||||||
@GET("/api/public/?service=Livebattlepass.upgradesBattlePass")
|
@GET("/api/public/?service=Livebattlepass.upgradesBattlePass")
|
||||||
Observable<ResponseModel<Object>> upgradesBattlePass(@Query("battle_pass_type_id") String battlePassTypeId);
|
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);
|
||||||
}
|
}
|
||||||
|
@ -2460,13 +2460,34 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).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) {
|
public void upgradesBattlePass(String battlePassTypeId, HttpCallback<ResponseModel<Object>> callback) {
|
||||||
API.get().pdLiveApi(mContext)
|
API.get().pdLiveApi(mContext)
|
||||||
.upgradesBattlePass(battlePassTypeId)
|
.upgradesBattlePass(battlePassTypeId)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Consumer<ResponseModel<Object>>() {
|
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||||
@Override
|
|
||||||
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onSuccess(objectResponseModel);
|
callback.onSuccess(objectResponseModel);
|
||||||
|
@ -138,6 +138,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/buying_experience"
|
||||||
android:layout_width="116dp"
|
android:layout_width="116dp"
|
||||||
android:layout_height="38dp"
|
android:layout_height="38dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
Loading…
Reference in New Issue
Block a user