diff --git a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java index 377ea49eb..8520bf64a 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java +++ b/common/src/main/java/com/yunbao/common/dialog/GuardUpgradePopup.java @@ -9,12 +9,16 @@ import androidx.annotation.NonNull; import androidx.fragment.app.FragmentActivity; import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.CheckUpgradesModel; +import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.RewardsModel; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -29,11 +33,12 @@ public class GuardUpgradePopup extends CenterPopupView { ImageView rewards_img1, rewards_img2, rewards_img3; TextView rewards_text1, rewards_text2, rewards_text3; - public GuardUpgradePopup(@NonNull Context context, String liveUid, CheckUpgradesModel upgradesModel) { + public GuardUpgradePopup(@NonNull Context context, String liveUid, CheckUpgradesModel upgradesModel, GuardUpgradeCallBack guardUpgradeCallBack) { super(context); activity = (FragmentActivity) context; mLiveUid = liveUid; mUpgradesModel = upgradesModel; + mGuardUpgradeCallBack = guardUpgradeCallBack; } @Override @@ -120,6 +125,7 @@ public class GuardUpgradePopup extends CenterPopupView { .guardGetRewards(mUpgradesModel.getLevel(), mLiveUid, new HttpCallback() { @Override public void onSuccess(Object data) { + ToastUtil.show(WordUtil.isNewZh() ? "領取成功" : "Receive successfully"); dismiss(); } @@ -131,6 +137,34 @@ public class GuardUpgradePopup extends CenterPopupView { } }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.view_grade), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (mGuardUpgradeCallBack != null) { + mGuardUpgradeCallBack.onGuardLevel(); + } + dismiss(); + StringBuffer htmlUrl = new StringBuffer(); + IMLoginModel userInfo = IMLoginManager.get(getContext()).getUserInfo(); + htmlUrl.append(CommonAppConfig.HOST) + .append("/h5/Guard/level.html?") + .append("&token=") + .append(userInfo.getToken()) + .append("&uid=") + .append(userInfo.getId()) + .append("&&anchorUid=") + .append(mLiveUid) + .append("&isZh=") + .append(((WordUtil.isNewZh()) ? "1" : "0")); + RouteUtil.forwardZhuangBanActivity(htmlUrl.toString()); + } + }); } + + private GuardUpgradeCallBack mGuardUpgradeCallBack; + + public interface GuardUpgradeCallBack { + void onGuardLevel(); + } } diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index cec2c3fd4..b4ca839b5 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -707,7 +707,7 @@ public class JavascriptInterfaceUtils { CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson, CheckUpgradesModel.class); if (!TextUtils.isEmpty(upgradesModel.getLevel())) new XPopup.Builder(mWebView.getContext()) - .asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel)) + .asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel,null)) .show(); } catch (JsonSyntaxException e) { throw new RuntimeException(e); diff --git a/common/src/main/res/layout/guard_upgrade_popup.xml b/common/src/main/res/layout/guard_upgrade_popup.xml index f38f18e31..2bb16b8d9 100644 --- a/common/src/main/res/layout/guard_upgrade_popup.xml +++ b/common/src/main/res/layout/guard_upgrade_popup.xml @@ -136,6 +136,7 @@ android:layout_marginBottom="38dp">