1、好友邀请守护内容修改

This commit is contained in:
Martin 2024-07-04 17:59:56 +08:00
parent 9dd3619049
commit 963fe2c110
12 changed files with 413 additions and 201 deletions

View File

@ -22,6 +22,24 @@ public class GuardPriceModel extends BaseModel {
private String discount;
@SerializedName("price_key")
private int priceKey;
@SerializedName("coupon_discount")
private String couponDiscount;
@SerializedName("coupon_discount_en")
private String couponDiscountEn;
@SerializedName("coupon_discount_price")
private String couponDiscountPrice;
public String getCouponDiscount() {
return couponDiscount;
}
public String getCouponDiscountEn() {
return couponDiscountEn;
}
public String getCouponDiscountPrice() {
return couponDiscountPrice;
}
public String getOpeningTime() {
return openingTime;

View File

@ -0,0 +1,78 @@
package com.yunbao.common.dialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.text.Html;
import android.text.Spanned;
import android.view.View;
import android.widget.TextView;
import com.yunbao.common.R;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.WordUtil;
public class GuardBuyCouponTipsDialog {
/**
* @param context
* @param coin 钻石
* @param content 购买类型名称
* @param simpleCallback
*/
public static void showBuyOrRenewDialog(Context context, String coupon, String coin, String content,
DialogUitl.SimpleCallback simpleCallback) {
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_coupon_tips);
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
TextView btn_confirm = dialog.findViewById(R.id.btn_confirm);
TextView content2 = dialog.findViewById(R.id.content2);
Spanned tips;
if (WordUtil.isNewZh()) {
tips = Html.fromHtml("<font color='#FFE0BF'>您有一張</font>"
+ "<font color='#FF9937'>" + content + "優惠券</font><br>"
+ "<font color='#FFE0BF'>開通/續費" + content + "(1個月)時,</font><br><font color='#FFE0BF'>可享</font>"
+ "<strong><font color='#FF9937'>" + coupon + "折</font></strong>"
+ "<font color='#FFE0BF'>優惠 (折後:</font>"
+ "<font color='#FF9937'>" + coin + "鑽</font>)<br>"
+ "<font color='#FFE0BF'>是否使用優惠券?</font>");
} else {
tips = Html.fromHtml("<font color='#FFE0BF'>You have a </font>"
+ "<font color='#FF9937'>" + content + " coupon</font>"
+ "<font color='#FFE0BF'> When activating/renewing " + content + "(1 month), you can enjoy a</font>"
+ "<strong><font color='#FF9937'> " + coupon + "% </font></strong>"
+ "<font color='#FFE0BF'>discount (After folding:</font>"
+ "<font color='#FF9937'>" + coin + " diamonds</font>"
+ "<font color='#FFE0BF'>Do you want to use coupons?</font>");
}
content2.setText(tips);
dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.findViewById(R.id.btn_cancel1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
btn_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
simpleCallback.onConfirmClick(dialog, "");
}
});
dialog.show();
}
}

View File

@ -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);
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);
@GET("/api/public/?service=Guard.sendMoneyLong")
Observable<ResponseModel<Object>> sendMoneyLong(@Query("liveuid") String liveUid, @Query("gold_num") String goldNum);

View File

@ -3014,9 +3014,9 @@ public class LiveNetManager {
}
public void openGuard(String liveUid, String guardType, String priceKey, String stream, HttpCallback<String> callback) {
public void openGuard(String liveUid, String guardType, String priceKey, String stream,String coupon_type, HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.openGuard(liveUid, guardType, priceKey, stream)
.openGuard(liveUid, guardType, priceKey, stream,coupon_type)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<Object>>() {

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<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="260dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="243dp"
android:background="@drawable/guard_buy_tips_bg">
<ImageView
android:id="@+id/btn_cancel"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/icon_guard_buy_tips_close" />
<com.flyjingfish.gradienttextviewlib.GradientTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:letterSpacing="0.1"
android:text="@string/dialog_tip"
android:textSize="22dp"
app:gradient_angle="45"
app:gradient_endColor="#F9E1AE"
app:gradient_startColor="#C28413" />
<TextView
android:id="@+id/content2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:letterSpacing="0.1"
android:text="@string/current_guard_expires"
android:textColor="#FFE0BF"
android:textSize="14dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content">
<TextView
android:id="@+id/btn_cancel1"
android:layout_width="100dp"
android:gravity="center"
android:layout_height="38dp"
android:textColor="#F7F7F7"
android:textSize="15sp"
android:textStyle="bold"
android:background="@mipmap/guard_buy_tips_cancel_bg"
android:letterSpacing="0.1"
android:text="@string/live_guard_buy_coupon_tips_cancel" />
<TextView
android:layout_marginLeft="40dp"
android:id="@+id/btn_confirm"
android:layout_width="100dp"
android:gravity="center"
android:layout_height="38dp"
android:textColor="#893D0D"
android:textSize="15sp"
android:textStyle="bold"
android:background="@drawable/guard_buy_tips_sure_bg"
android:letterSpacing="0.1"
android:text="@string/live_guard_buy_coupon_tips_use" />
</LinearLayout>
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1501,4 +1501,6 @@
<string name="main_type_theater">短劇</string>
<string name="prank_complete">完成*1</string>
<string name="pking_over">主播正在PK稍後再試</string>
<string name="live_guard_buy_coupon_tips_use">使用</string>
<string name="live_guard_buy_coupon_tips_cancel">取消</string>
</resources>

View File

@ -1500,4 +1500,6 @@
<string name="main_type_theater">短劇</string>
<string name="prank_complete">完成*1</string>
<string name="pking_over">主播正在PK稍後再試</string>
<string name="live_guard_buy_coupon_tips_use">使用</string>
<string name="live_guard_buy_coupon_tips_cancel">取消</string>
</resources>

View File

@ -1497,5 +1497,7 @@
<string name="main_type_theater">短劇</string>
<string name="prank_complete">完成*1</string>
<string name="pking_over">主播正在PK稍後再試</string>
<string name="live_guard_buy_coupon_tips_use">使用</string>
<string name="live_guard_buy_coupon_tips_cancel">取消</string>
</resources>

View File

@ -1506,4 +1506,6 @@ Limited ride And limited avatar frame</string>
<string name="main_type_theater" >Theater</string>
<string name="pking_over">The anchor is in PK, please try again later</string>
<string name="prank_complete">once</string>
<string name="live_guard_buy_coupon_tips_use">Use</string>
<string name="live_guard_buy_coupon_tips_cancel">Cancel</string>
</resources>

View File

@ -41,6 +41,7 @@ import com.yunbao.common.bean.GuardUserInfoModel;
import com.yunbao.common.bean.IMLoginModel;
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.GuardUpgradePopup;
import com.yunbao.common.dialog.LiveBuyGuardSelectPopup;
@ -246,6 +247,7 @@ 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);
if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) {
discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
@ -308,6 +310,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
@Override
public void onLiveBuyGuardSelectListener(GuardPriceModel model) {
guardPriceModel = model;
discountPrice.setTag(String.valueOf(guardPriceModel.getPriceKey()));
if (TextUtils.isEmpty(guardPriceModel.getDiscountPrice())) {
discountPrice.setText(String.valueOf(guardPriceModel.getOriginalPrice()));
originalPrice.setVisibility(GONE);
@ -340,10 +343,94 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
ViewClicksAntiShake.clicksAntiShake(openTheGuard, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
//判断是否选择的是一个月
if(discountPrice.getTag().equals("1")){
GuardBuyCouponTipsDialog.showBuyOrRenewDialog(mContext, WordUtil.isNewZh() ? guardPriceModel.getCouponDiscount() : guardPriceModel.getCouponDiscountEn(), guardPriceModel.getCouponDiscountPrice(), dataTipModel.getGuardName(), new DialogUitl.SimpleCallback2() {
@Override
public void onCancelClick() {
}
@Override
public void onConfirmClick(Dialog dialog, String content) {
bugGurd(true);
dialog.dismiss();
}
});
}else{
bugGurd(false);
}
switch (dataTipModel.getGuardType()) {
case 1:
MobclickAgent.onEvent(mContext, "star_guardian_renew_btn", "星之守护开通/续费按钮点击次数及人数");
break;
case 2:
MobclickAgent.onEvent(mContext, "king_guardian_renew_btn", "王之守护开通/续费按钮点击次数及人数");
break;
case 3:
MobclickAgent.onEvent(mContext, "god_guardian_renew_btn", "神之守护开通/续费按钮点击次数及人数");
break;
}
// new XPopup.Builder(mContext)
// .asCustom(new DragonSendsMoneyPopup(mContext))
// .show();
}
});
LiveNetManager.get(getContext())
.checkUpgrades(mLiveUid, new com.yunbao.common.http.base.HttpCallback<CheckUpgradesModel>() {
@Override
public void onSuccess(CheckUpgradesModel data) {
if (!data.getRewards().isEmpty())
new XPopup.Builder(mContext)
.asCustom(new GuardUpgradePopup(mContext, mLiveUid, data, new GuardUpgradePopup.GuardUpgradeCallBack() {
@Override
public void onGuardLevel() {
LiveBuyGuardDialog.this.dismiss();
}
}))
.show();
}
@Override
public void onError(String error) {
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.guard_rule), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
StringBuffer htmlUrl = new StringBuffer();
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
htmlUrl.append(CommonAppConfig.HOST)
.append("/h5/Guard/rules.html")
.append("?token=")
.append(userInfo.getToken())
.append("&uid=")
.append(userInfo.getId())
.append("&anchorUid=")
.append(mLiveUid)
.append("&isZh=")
.append(((WordUtil.isNewZh()) ? "1" : "0"));
Bundle bundle = new Bundle();
bundle.putString("url", htmlUrl.toString());
bundle.putInt("height", DeviceUtils.getScreenHeight(getActivity()) / 5 * 3);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
});
}
private void bugGurd(boolean isCoupon) {
if (TextUtils.equals(userInfo.getIsOpen(), "1")) {
GuardBuyTipsDialog
.showBuyOrRenewDialog(mContext,
discountPrice.getText().toString(),
isCoupon?guardPriceModel.getCouponDiscountPrice():discountPrice.getText().toString(),
dataTipModel.getGuardName(), dataTipModel.isOpen(),
mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() {
@Override
@ -357,7 +444,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
LiveNetManager.get(activity)
.openGuard(mLiveUid,
String.valueOf(dataTipModel.getGuardType()),
String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback<String>() {
String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0", new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
if (TextUtils.equals(data, "22")) {
@ -430,7 +517,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
public void onConfirmClick(Dialog dialog, String content) {
GuardBuyTipsDialog
.showBuyOrRenewDialog(mContext,
discountPrice.getText().toString(),
isCoupon?guardPriceModel.getCouponDiscountPrice():discountPrice.getText().toString(),
dataTipModel.getGuardName(), dataTipModel.isOpen(),
mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() {
@Override
@ -444,7 +531,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
LiveNetManager.get(activity)
.openGuard(mLiveUid,
String.valueOf(dataTipModel.getGuardType()),
String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback<String>() {
String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0", new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
if (TextUtils.equals(data, "22")) {
@ -485,7 +572,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
}else {
GuardBuyTipsDialog
.showBuyOrRenewDialog(mContext,
discountPrice.getText().toString(),
isCoupon?guardPriceModel.getCouponDiscountPrice():discountPrice.getText().toString(),
dataTipModel.getGuardName(), dataTipModel.isOpen(),
mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() {
@Override
@ -499,7 +586,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
LiveNetManager.get(activity)
.openGuard(mLiveUid,
String.valueOf(dataTipModel.getGuardType()),
String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback<String>() {
String.valueOf(guardPriceModel.getPriceKey()), mStream,isCoupon?"1":"0", new HttpCallback<String>() {
@Override
public void onSuccess(String data) {
if (TextUtils.equals(data, "22")) {
@ -539,70 +626,6 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
}
switch (dataTipModel.getGuardType()) {
case 1:
MobclickAgent.onEvent(mContext, "star_guardian_renew_btn", "星之守护开通/续费按钮点击次数及人数");
break;
case 2:
MobclickAgent.onEvent(mContext, "king_guardian_renew_btn", "王之守护开通/续费按钮点击次数及人数");
break;
case 3:
MobclickAgent.onEvent(mContext, "god_guardian_renew_btn", "神之守护开通/续费按钮点击次数及人数");
break;
}
// new XPopup.Builder(mContext)
// .asCustom(new DragonSendsMoneyPopup(mContext))
// .show();
}
});
LiveNetManager.get(getContext())
.checkUpgrades(mLiveUid, new com.yunbao.common.http.base.HttpCallback<CheckUpgradesModel>() {
@Override
public void onSuccess(CheckUpgradesModel data) {
if (!data.getRewards().isEmpty())
new XPopup.Builder(mContext)
.asCustom(new GuardUpgradePopup(mContext, mLiveUid, data, new GuardUpgradePopup.GuardUpgradeCallBack() {
@Override
public void onGuardLevel() {
LiveBuyGuardDialog.this.dismiss();
}
}))
.show();
}
@Override
public void onError(String error) {
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.guard_rule), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
StringBuffer htmlUrl = new StringBuffer();
IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo();
htmlUrl.append(CommonAppConfig.HOST)
.append("/h5/Guard/rules.html")
.append("?token=")
.append(userInfo.getToken())
.append("&uid=")
.append(userInfo.getId())
.append("&anchorUid=")
.append(mLiveUid)
.append("&isZh=")
.append(((WordUtil.isNewZh()) ? "1" : "0"));
Bundle bundle = new Bundle();
bundle.putString("url", htmlUrl.toString());
bundle.putInt("height", DeviceUtils.getScreenHeight(getActivity()) / 5 * 3);
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
fragment.setArguments(bundle);
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
}
});
}
private void closeAnimSudGameListEvent(View view) {

View File

@ -15,12 +15,9 @@ import com.lxj.xpopup.XPopup;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.MobclickAgent;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.dialog.SkitCheckInWasSuccessfulPopup;
import com.yunbao.common.event.FloatWarOrderEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.live.dialog.LiveBuyGuardDialog;
import com.yunbao.live.dialog.LiveGuardDialog;
import com.yunbao.live.dialog.LivePrankDialogFragment;
import com.yunbao.main.R;