Merge remote-tracking branch 'origin/dev_6.6.4_战令' into dev_6.6.4_战令
This commit is contained in:
commit
e06f944def
@ -10,7 +10,11 @@ import androidx.annotation.NonNull;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@ -23,6 +27,8 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
||||
private int mPoint, mLimitQuantity, mScale;
|
||||
private String mImageUrl;
|
||||
private ImageView exchangeParticulars;
|
||||
private String battlePassPointsId;
|
||||
private WarOrderExchangeDetailsCallback orderExchangeDetailsCallback;
|
||||
|
||||
/***
|
||||
*
|
||||
@ -33,12 +39,14 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
||||
* @param imageUrl 物品图片的url
|
||||
*/
|
||||
public WarOrderExchangeDetailsPopupWindow(@NonNull Context context, int limitQuantity,
|
||||
int point, int scale, String imageUrl) {
|
||||
int point, int scale, String imageUrl, String battlePassPointsId, WarOrderExchangeDetailsCallback orderExchangeDetailsCallback) {
|
||||
super(context);
|
||||
mPoint = point;
|
||||
mLimitQuantity = limitQuantity;
|
||||
mScale = scale;
|
||||
mImageUrl = imageUrl;
|
||||
this.battlePassPointsId = battlePassPointsId;
|
||||
this.orderExchangeDetailsCallback = orderExchangeDetailsCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,7 +63,7 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
||||
pointExchange = findViewById(R.id.point_exchange);
|
||||
orderLevel.setText(buyExp);
|
||||
BigDecimal needExpBigDecimal = new BigDecimal(buyExp).multiply(new BigDecimal(mScale));
|
||||
pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange),needExpBigDecimal.toString()));
|
||||
pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange), needExpBigDecimal.toString()));
|
||||
ImgLoader.display(getContext(), mImageUrl, exchangeParticulars);
|
||||
findViewById(R.id.sub).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@ -66,7 +74,7 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
||||
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||
orderLevel.setText(buyExp);
|
||||
BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale));
|
||||
pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange),needExpBigDecimal.toString()));
|
||||
pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange), needExpBigDecimal.toString()));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -80,9 +88,36 @@ public class WarOrderExchangeDetailsPopupWindow extends CenterPopupView {
|
||||
buyExp = String.valueOf(buyExpBigDecimal.intValue());
|
||||
orderLevel.setText(buyExp);
|
||||
BigDecimal needExpBigDecimal = buyExpBigDecimal.multiply(new BigDecimal(mScale));
|
||||
pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange),needExpBigDecimal.toString()));
|
||||
pointExchange.setText(String.format(WordUtil.getString(R.string.point_exchange), needExpBigDecimal.toString()));
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.point_exchange_linear), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
LiveNetManager.get(getContext())
|
||||
.pointsExchange(battlePassPointsId, buyExp, new HttpCallback<ResponseModel<Object>>() {
|
||||
@Override
|
||||
public void onSuccess(ResponseModel<Object> data) {
|
||||
dialog.dismiss();
|
||||
if (orderExchangeDetailsCallback != null) {
|
||||
orderExchangeDetailsCallback.onCallback(data.getData().getCode(), data.getData().getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
dialog.dismiss();
|
||||
if (orderExchangeDetailsCallback != null) {
|
||||
orderExchangeDetailsCallback.onCallback(102, error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface WarOrderExchangeDetailsCallback {
|
||||
void onCallback(int code, String msg);
|
||||
}
|
||||
}
|
||||
|
@ -1097,4 +1097,16 @@ public interface PDLiveApi {
|
||||
|
||||
@GET("/api/public/?service=Livebattlepass.buyingExperiencePoint")
|
||||
Observable<ResponseModel<Object>> buyingExperiencePoint(@Query("exp_count") String expCount);
|
||||
|
||||
/**
|
||||
* battle_pass_points_id => 兑换列表ID
|
||||
* count => 兑换物品的数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Livebattlepass.pointsExchange")
|
||||
Observable<ResponseModel<Object>> pointsExchange(
|
||||
@Query("battle_pass_points_id ") String battlePassPointsId,
|
||||
@Query("count ") String count
|
||||
);
|
||||
}
|
||||
|
@ -2460,6 +2460,28 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void pointsExchange(String battlePassPointsId, String count, HttpCallback<ResponseModel<Object>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.pointsExchange(battlePassPointsId, count)
|
||||
.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 buyingExperiencePoint(String expCount, HttpCallback<ResponseModel<Object>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.buyingExperiencePoint(expCount)
|
||||
|
@ -83,6 +83,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/point_exchange_linear"
|
||||
android:layout_width="140dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="center"
|
||||
|
@ -39,9 +39,6 @@ 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.dialog.WarOrderExchangeDetailsPopupWindow;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@ -234,12 +231,7 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
||||
findViewById(R.id.native_callback).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new XPopup.Builder(mContext)
|
||||
.enableDrag(false)
|
||||
.maxWidth(DeviceUtils.getScreenHeight((Activity) mContext) - DpUtil.dp2px(34))
|
||||
.asCustom(new WarOrderExchangeDetailsPopupWindow(mContext,10,90000,10,
|
||||
"https://downs.yaoulive.com/20230706/0572c0f694601f4d2695cd210effbe93.jpeg?imageView2/2/w/600/h/600"))
|
||||
.show();
|
||||
|
||||
}
|
||||
});
|
||||
}//战令等级
|
||||
|
Loading…
Reference in New Issue
Block a user