diff --git a/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java b/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java index c93e6cdee..bdaebd67e 100644 --- a/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java +++ b/common/src/main/java/com/yunbao/common/bean/GuardPriceModel.java @@ -28,11 +28,17 @@ public class GuardPriceModel extends BaseModel { private String couponDiscountEn; @SerializedName("coupon_discount_price") private String couponDiscountPrice; + @SerializedName("coupon_id") + private String couponId; public String getCouponDiscount() { return couponDiscount; } + public String getCouponId() { + return couponId; + } + public String getCouponDiscountEn() { return couponDiscountEn; } diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardBuyCouponTipsDialog.java b/common/src/main/java/com/yunbao/common/dialog/GuardBuyCouponTipsDialog.java index 3bc277ea0..fdb48d71e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GuardBuyCouponTipsDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyCouponTipsDialog.java @@ -21,7 +21,7 @@ public class GuardBuyCouponTipsDialog { * @param simpleCallback */ public static void showBuyOrRenewDialog(Context context, String coupon, String coin, String content, - DialogUitl.SimpleCallback simpleCallback) { + DialogUitl.SimpleCallback3 simpleCallback) { if (context instanceof Activity) { if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { return; @@ -57,19 +57,22 @@ public class GuardBuyCouponTipsDialog { dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + simpleCallback.onCancel(); dialog.dismiss(); } }); dialog.findViewById(R.id.btn_cancel1).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + simpleCallback.onCancel(); dialog.dismiss(); } }); btn_confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - simpleCallback.onConfirmClick(dialog, ""); + simpleCallback.onConfirmClick(dialog); + dialog.dismiss(); } }); dialog.show(); diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsNewDialog.java b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsNewDialog.java new file mode 100644 index 000000000..f8742fd99 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/GuardBuyTipsNewDialog.java @@ -0,0 +1,44 @@ +package com.yunbao.common.dialog; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.view.View; +import android.widget.TextView; + +import com.yunbao.common.R; +import com.yunbao.common.utils.WordUtil; + +public class GuardBuyTipsNewDialog { + /** + * @param context + */ + public static void showBuyOrRenewDialog(Context context) { + if (context instanceof Activity) { + if (((Activity) context).isDestroyed() || ((Activity) context).isFinishing()) { + return; + } + } + + final Dialog dialog = new Dialog(context, R.style.dialog2); + dialog.setContentView(R.layout.dialog_guard_buy_tips); + dialog.setCancelable(true); + dialog.setCanceledOnTouchOutside(true); + TextView btn_confirm = dialog.findViewById(R.id.btn_confirm); + btn_confirm.setText(WordUtil.isNewZh() ? "確認" : "Confirm"); + dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + dialog.findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + dialog.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 c0fda5d37..69c866049 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1194,7 +1194,7 @@ public interface PDLiveApi { Observable> getGuardOpenInfo(@Query("liveuid") String liveUid); @GET("/api/public/?service=Guard.openGuard") - Observable> openGuard(@Query("liveuid") String liveUid, @Query("guard_type") String guardType, @Query("price_key") String priceKey, @Query("stream") String stream,@Query("coupon_type") String coupon_type); + Observable> openGuard(@Query("liveuid") String liveUid, @Query("guard_type") String guardType, @Query("price_key") String priceKey, @Query("stream") String stream,@Query("coupon_type") String coupon_type,@Query("coupon_id") String coupon_id); @GET("/api/public/?service=Guard.sendMoneyLong") Observable> sendMoneyLong(@Query("liveuid") String liveUid, @Query("gold_num") String goldNum); 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 5df075a35..02a97ecda 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 @@ -3014,9 +3014,9 @@ public class LiveNetManager { } - public void openGuard(String liveUid, String guardType, String priceKey, String stream,String coupon_type, HttpCallback callback) { + public void openGuard(String liveUid, String guardType, String priceKey, String stream,String coupon_type,String couponId, HttpCallback callback) { API.get().pdLiveApi(mContext) - .openGuard(liveUid, guardType, priceKey, stream,coupon_type) + .openGuard(liveUid, guardType, priceKey, stream,coupon_type,couponId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { diff --git a/common/src/main/res/layout/dialog_guard_buy_tips.xml b/common/src/main/res/layout/dialog_guard_buy_tips.xml index 349c6fab4..c72c7269f 100644 --- a/common/src/main/res/layout/dialog_guard_buy_tips.xml +++ b/common/src/main/res/layout/dialog_guard_buy_tips.xml @@ -2,13 +2,13 @@ () { + String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0",discount.getTag().toString(), new HttpCallback() { @Override public void onSuccess(String data) { if (TextUtils.equals(data, "22")) { @@ -531,7 +540,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { LiveNetManager.get(activity) .openGuard(mLiveUid, String.valueOf(dataTipModel.getGuardType()), - String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0", new HttpCallback() { + String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0",discount.getTag().toString(), new HttpCallback() { @Override public void onSuccess(String data) { if (TextUtils.equals(data, "22")) { @@ -586,7 +595,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow { LiveNetManager.get(activity) .openGuard(mLiveUid, String.valueOf(dataTipModel.getGuardType()), - String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0", new HttpCallback() { + String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0",discount.getTag().toString(), new HttpCallback() { @Override public void onSuccess(String data) { if (TextUtils.equals(data, "22")) {