1、開通守護-使用優惠券
This commit is contained in:
parent
963fe2c110
commit
3dcc801331
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -1194,7 +1194,7 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<GuardGetGuardOpenInfoModel>> getGuardOpenInfo(@Query("liveuid") String liveUid);
|
||||
|
||||
@GET("/api/public/?service=Guard.openGuard")
|
||||
Observable<ResponseModel<Object>> 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<ResponseModel<Object>> 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<ResponseModel<Object>> sendMoneyLong(@Query("liveuid") String liveUid, @Query("gold_num") String goldNum);
|
||||
|
@ -3014,9 +3014,9 @@ public class LiveNetManager {
|
||||
|
||||
}
|
||||
|
||||
public void openGuard(String liveUid, String guardType, String priceKey, String stream,String coupon_type, HttpCallback<String> callback) {
|
||||
public void openGuard(String liveUid, String guardType, String priceKey, String stream,String coupon_type,String couponId, HttpCallback<String> 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<ResponseModel<Object>>() {
|
||||
|
@ -2,13 +2,13 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="310dp"
|
||||
android:layout_height="250dp"
|
||||
android:layout_height="220dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="230dp"
|
||||
android:layout_height="200dp"
|
||||
android:background="@drawable/guard_buy_tips_bg">
|
||||
|
||||
<ImageView
|
||||
@ -40,7 +40,7 @@
|
||||
android:layout_below="@+id/title"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="0.1"
|
||||
|
@ -43,6 +43,7 @@ import com.yunbao.common.custom.LiveGuardScalePageTransformer;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.dialog.GuardBuyCouponTipsDialog;
|
||||
import com.yunbao.common.dialog.GuardBuyTipsDialog;
|
||||
import com.yunbao.common.dialog.GuardBuyTipsNewDialog;
|
||||
import com.yunbao.common.dialog.GuardUpgradePopup;
|
||||
import com.yunbao.common.dialog.LiveBuyGuardSelectPopup;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
@ -247,8 +248,10 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費神之守護" : "Renew God Guardian"
|
||||
: WordUtil.getNewString(R.string.open_the_god_guard));
|
||||
}
|
||||
discountPrice.setTag("1");
|
||||
guardPriceModel = price.get(0);
|
||||
discountPrice.setTag("1");
|
||||
discount.setTag(guardPriceModel.getCouponId());
|
||||
|
||||
if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) {
|
||||
discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
|
||||
originalPrice.setVisibility(GONE);
|
||||
@ -311,6 +314,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
public void onLiveBuyGuardSelectListener(GuardPriceModel model) {
|
||||
guardPriceModel = model;
|
||||
discountPrice.setTag(String.valueOf(guardPriceModel.getPriceKey()));
|
||||
discount.setTag(guardPriceModel.getCouponId());
|
||||
if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) {
|
||||
discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
|
||||
originalPrice.setVisibility(GONE);
|
||||
@ -343,23 +347,28 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
ViewClicksAntiShake.clicksAntiShake(openTheGuard, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") &&
|
||||
dataTipModel.getGuardType() < mGuardUserInfoModel.getGuardType()) {
|
||||
//开通比当前低级的的守护
|
||||
GuardBuyTipsNewDialog.showBuyOrRenewDialog(mContext);
|
||||
}else{
|
||||
//判断是否选择的是一个月
|
||||
if(discountPrice.getTag().equals("1")){
|
||||
GuardBuyCouponTipsDialog.showBuyOrRenewDialog(mContext, WordUtil.isNewZh() ? guardPriceModel.getCouponDiscount() : guardPriceModel.getCouponDiscountEn(), guardPriceModel.getCouponDiscountPrice(), dataTipModel.getGuardName(), new DialogUitl.SimpleCallback2() {
|
||||
if(discountPrice.getTag().equals("1")&&!discount.getTag().toString().equals("0")){
|
||||
GuardBuyCouponTipsDialog.showBuyOrRenewDialog(mContext, WordUtil.isNewZh() ? guardPriceModel.getCouponDiscount() : guardPriceModel.getCouponDiscountEn(), guardPriceModel.getCouponDiscountPrice(), dataTipModel.getGuardName(), new DialogUitl.SimpleCallback3() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
|
||||
public void onConfirmClick(Dialog dialog) {
|
||||
bugGurd(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
bugGurd(true);
|
||||
dialog.dismiss();
|
||||
public void onCancel() {
|
||||
bugGurd(false);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
bugGurd(false);
|
||||
}
|
||||
}
|
||||
switch (dataTipModel.getGuardType()) {
|
||||
case 1:
|
||||
MobclickAgent.onEvent(mContext, "star_guardian_renew_btn", "星之守护开通/续费按钮点击次数及人数");
|
||||
@ -444,7 +453,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>() {
|
||||
String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0",discount.getTag().toString(), new HttpCallback<String>() {
|
||||
@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>() {
|
||||
String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0",discount.getTag().toString(), new HttpCallback<String>() {
|
||||
@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>() {
|
||||
String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0",discount.getTag().toString(), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
if (TextUtils.equals(data, "22")) {
|
||||
|
Loading…
Reference in New Issue
Block a user