修改守护购买页过期用户购买逻辑
This commit is contained in:
parent
7c006e8e03
commit
88b96267ef
@ -27,7 +27,7 @@ public class GuardUserInfoModel extends BaseModel {
|
||||
@SerializedName("live_avatar")
|
||||
private String liveAvatar;
|
||||
@SerializedName("guard_type")
|
||||
private String guardType;
|
||||
private int guardType;
|
||||
@SerializedName("exp")
|
||||
private String exp;
|
||||
@SerializedName("level")
|
||||
@ -38,6 +38,17 @@ public class GuardUserInfoModel extends BaseModel {
|
||||
private String userLanguage;
|
||||
@SerializedName("live_language")
|
||||
private String liveLanguage;
|
||||
@SerializedName("is_open")
|
||||
private String isOpen;
|
||||
|
||||
public String getIsOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
public GuardUserInfoModel setIsOpen(String isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
@ -75,11 +86,11 @@ public class GuardUserInfoModel extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGuardType() {
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public GuardUserInfoModel setGuardType(String guardType) {
|
||||
public GuardUserInfoModel setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
return this;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
@ -43,6 +42,13 @@ public class GuardBuyTipsDialog {
|
||||
contentTextView.setVisibility(View.VISIBLE);
|
||||
buyTypeTextView.setVisibility(View.VISIBLE);
|
||||
content2.setVisibility(View.GONE);
|
||||
if (TextUtils.isEmpty(coin) && mGuardUserInfoModel == null && !isOpen && guardType == -200) {
|
||||
content1.setVisibility(View.GONE);
|
||||
contentTextView.setVisibility(View.VISIBLE);
|
||||
buyTypeTextView.setVisibility(View.GONE);
|
||||
content2.setVisibility(View.GONE);
|
||||
contentTextView.setText(content);
|
||||
} else {
|
||||
if (!isOpen) {
|
||||
if (!TextUtils.isEmpty(coin)) {
|
||||
contentTextView.setText(context.getString(R.string.guard_buy_tips_1, coin));
|
||||
@ -60,15 +66,16 @@ public class GuardBuyTipsDialog {
|
||||
}
|
||||
if (mGuardUserInfoModel != null) {
|
||||
if (mGuardUserInfoModel.getGuardType() != 0) {
|
||||
if (guardType < mGuardUserInfoModel.getGuardType()) {
|
||||
if (TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1") &&
|
||||
guardType < mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.GONE);
|
||||
contentTextView.setVisibility(View.GONE);
|
||||
buyTypeTextView.setVisibility(View.GONE);
|
||||
content2.setVisibility(View.VISIBLE);
|
||||
|
||||
} else if (guardType==mGuardUserInfoModel.getGuardType()){
|
||||
} else if (guardType == mGuardUserInfoModel.getGuardType()) {
|
||||
content1.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
content1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
@ -78,6 +85,8 @@ public class GuardBuyTipsDialog {
|
||||
content1.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dialog.findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -88,9 +97,9 @@ public class GuardBuyTipsDialog {
|
||||
btn_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (content2.getVisibility()==View.VISIBLE){
|
||||
if (content2.getVisibility() == View.VISIBLE) {
|
||||
dialog.dismiss();
|
||||
}else {
|
||||
} else {
|
||||
simpleCallback.onConfirmClick(dialog, "");
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import com.yunbao.common.bean.GuardDataTipModel;
|
||||
import com.yunbao.common.bean.GuardGetGuardOpenInfoModel;
|
||||
import com.yunbao.common.bean.GuardGetGuardUserInfoModel;
|
||||
import com.yunbao.common.bean.GuardPriceModel;
|
||||
import com.yunbao.common.bean.GuardUserInfoModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.dialog.AbsDialogPopupWindow;
|
||||
import com.yunbao.common.dialog.GuardBuyTipsDialog;
|
||||
@ -85,6 +86,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
List<String> guardPrivilegeStrings = new ArrayList<>();
|
||||
GuardDataTipModel dataTipModel;
|
||||
GuardGetGuardUserInfoModel mGuardUserInfoModel;
|
||||
GuardUserInfoModel userInfo;
|
||||
|
||||
public LiveBuyGuardDialog(@NonNull Context context, String liveUid, String stream, GuardGetGuardUserInfoModel guardUserInfoModel) {
|
||||
super(context);
|
||||
@ -131,6 +133,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
public void onSuccess(GuardGetGuardOpenInfoModel data) {
|
||||
guardDataTipModels = data.getGuardData();
|
||||
userInfo = data.getUserInfo();
|
||||
// guardDataTipModels.get(0).setOpen(true);
|
||||
for (GuardDataTipModel guardDataTipModel : guardDataTipModels) {
|
||||
BuyGuardBannerModel guardBannerModel = new BuyGuardBannerModel();
|
||||
@ -161,7 +164,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
@Override
|
||||
public void run() {
|
||||
if (mGuardUserInfoModel != null) {
|
||||
if (mGuardUserInfoModel.getGuardType() != 0) {
|
||||
if (mGuardUserInfoModel.getGuardType() != 0 && TextUtils.equals(mGuardUserInfoModel.getIsOpen(), "1")) {
|
||||
buyGuardBanner.setBannerCurrentItem(mGuardUserInfoModel.getGuardType() - 1);
|
||||
}
|
||||
|
||||
@ -225,20 +228,20 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
MobclickAgent.onEvent(mContext, "star_guardian_people", "星之守护页面观看次数及人数");
|
||||
bottomPanel.setBackgroundResource(R.drawable.bg_star_guard_bottom_panel);
|
||||
ImgLoader.display(getContext(), R.mipmap.btn_star_guard, btnGuard);
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh()?"續費星之守護":"Renew Star Guardian"
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費星之守護" : "Renew Star Guardian"
|
||||
: WordUtil.getNewString(R.string.open_the_start_guard));
|
||||
|
||||
} else if (position == 1) {
|
||||
MobclickAgent.onEvent(mContext, "king_guardian_people", "王之守护页面观看次数及人数");
|
||||
bottomPanel.setBackgroundResource(R.drawable.bg_king_guard_bottom_panel);
|
||||
ImgLoader.display(getContext(), R.mipmap.btn_king_guard, btnGuard);
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh()?"續費王之守護":"Renew King Guardian"
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費王之守護" : "Renew King Guardian"
|
||||
: WordUtil.getNewString(R.string.open_the_kings_guard));
|
||||
} else if (position == 2) {
|
||||
MobclickAgent.onEvent(mContext, "god_guardian_people", "神之守护页面观看次数及人数");
|
||||
bottomPanel.setBackgroundResource(R.drawable.bg_god_guard_bottom_panel);
|
||||
ImgLoader.display(getContext(), R.mipmap.btn_god_guard, btnGuard);
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh()?"續費神之守護":"Renew God Guardian"
|
||||
openTheGuard.setText(dataTipModel.isOpen() ? WordUtil.isNewZh() ? "續費神之守護" : "Renew God Guardian"
|
||||
: WordUtil.getNewString(R.string.open_the_god_guard));
|
||||
}
|
||||
guardPriceModel = price.get(0);
|
||||
@ -335,19 +338,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
ViewClicksAntiShake.clicksAntiShake(openTheGuard, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
if (TextUtils.equals(userInfo.getIsOpen(), "1")) {
|
||||
GuardBuyTipsDialog
|
||||
.showBuyOrRenewDialog(mContext,
|
||||
discountPrice.getText().toString(),
|
||||
@ -400,6 +391,166 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (userInfo.getGuardType() > dataTipModel.getGuardType()) {
|
||||
String name = "星之守護";
|
||||
switch (userInfo.getGuardType()) {
|
||||
case 1:
|
||||
name = WordUtil.isNewZh() ? "星之守護" : "star guardian";
|
||||
break;
|
||||
case 2:
|
||||
name = WordUtil.isNewZh() ? "王之守護" : "king guardian";
|
||||
break;
|
||||
case 3:
|
||||
name = WordUtil.isNewZh() ? "神之守護" : "god guardian";
|
||||
break;
|
||||
|
||||
}
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if (WordUtil.isNewZh()) {
|
||||
buffer.append("您的【")
|
||||
.append(name).append("】已過期\n").append("開通相同或更高等級守護將會保留您的守護等級").append("開通低等級守護將重新計算您的守護等級");
|
||||
} else {
|
||||
buffer.append("Your [")
|
||||
.append(name).append("] has expired").append("active the same or higher level of guardian will retain your guardian level").append("active lower level guardian will recalculate your guardian level");
|
||||
}
|
||||
GuardBuyTipsDialog
|
||||
.showBuyOrRenewDialog(mContext,
|
||||
null,
|
||||
buffer.toString(), false,
|
||||
null, -200, new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
GuardBuyTipsDialog
|
||||
.showBuyOrRenewDialog(mContext,
|
||||
discountPrice.getText().toString(),
|
||||
dataTipModel.getGuardName(), dataTipModel.isOpen(),
|
||||
mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
|
||||
LiveNetManager.get(activity)
|
||||
.openGuard(mLiveUid,
|
||||
String.valueOf(dataTipModel.getGuardType()),
|
||||
String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
if (TextUtils.equals(data, "22")) {
|
||||
new DialogUitl.Builder(mContext)
|
||||
.setView(R.layout.dialog_live_unfollow)
|
||||
.setConfirmString(mContext.getString(R.string.charge))
|
||||
.setContent(mContext.getString(R.string.insufficient_balance))
|
||||
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
LiveBuyGuardDialog.this.dismiss();
|
||||
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation();
|
||||
}
|
||||
}).build().show();
|
||||
} else {
|
||||
IMLoginManager.get(mContext).setGuardType(dataTipModel.getGuardType());
|
||||
ToastUtil.show(data);
|
||||
dismiss();
|
||||
if (dataTipModel.getGuardType() == 3) {
|
||||
new XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
|
||||
.asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else {
|
||||
GuardBuyTipsDialog
|
||||
.showBuyOrRenewDialog(mContext,
|
||||
discountPrice.getText().toString(),
|
||||
dataTipModel.getGuardName(), dataTipModel.isOpen(),
|
||||
mGuardUserInfoModel, dataTipModel.getGuardType(), new DialogUitl.SimpleCallback2() {
|
||||
@Override
|
||||
public void onCancelClick() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
|
||||
LiveNetManager.get(activity)
|
||||
.openGuard(mLiveUid,
|
||||
String.valueOf(dataTipModel.getGuardType()),
|
||||
String.valueOf(guardPriceModel.getPriceKey()), mStream, new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
if (TextUtils.equals(data, "22")) {
|
||||
new DialogUitl.Builder(mContext)
|
||||
.setView(R.layout.dialog_live_unfollow)
|
||||
.setConfirmString(mContext.getString(R.string.charge))
|
||||
.setContent(mContext.getString(R.string.insufficient_balance))
|
||||
.setClickCallback(new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
LiveBuyGuardDialog.this.dismiss();
|
||||
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation();
|
||||
}
|
||||
}).build().show();
|
||||
} else {
|
||||
IMLoginManager.get(mContext).setGuardType(dataTipModel.getGuardType());
|
||||
ToastUtil.show(data);
|
||||
dismiss();
|
||||
if (dataTipModel.getGuardType() == 3) {
|
||||
new XPopup.Builder(mContext)
|
||||
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
|
||||
.asCustom(new DragonSendsMoneyPopup(mContext, mLiveUid))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user