修改问题

This commit is contained in:
18401019693 2024-03-23 17:33:09 +08:00
parent f04a2865af
commit 3953e146a5
5 changed files with 49 additions and 6 deletions

View File

@ -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<Object>() {
@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();
}
}

View File

@ -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);

View File

@ -136,6 +136,7 @@
android:layout_marginBottom="38dp">
<Button
android:id="@+id/view_grade"
android:layout_width="94dp"
android:layout_height="36dp"
android:background="@drawable/button_guard_upgrade"

View File

@ -402,7 +402,12 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
public void onSuccess(CheckUpgradesModel data) {
if (!data.getRewards().isEmpty())
new XPopup.Builder(mContext)
.asCustom(new GuardUpgradePopup(mContext, mLiveUid, data))
.asCustom(new GuardUpgradePopup(mContext, mLiveUid, data, new GuardUpgradePopup.GuardUpgradeCallBack() {
@Override
public void onGuardLevel() {
LiveBuyGuardDialog.this.dismiss();
}
}))
.show();
}

View File

@ -2,7 +2,6 @@ package com.yunbao.live.dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@ -41,7 +40,6 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.activity.ZhuangBanActivity;
import com.yunbao.live.adapter.NewGuardAdapter;
import com.yunbao.live.bean.GuardUserModel;
@ -257,7 +255,12 @@ public class LiveGuardDialog extends AbsDialogPopupWindow {
public void onSuccess(CheckUpgradesModel data) {
if (!data.getRewards().isEmpty())
new XPopup.Builder(mContext)
.asCustom(new GuardUpgradePopup(mContext, mLiveUid, data))
.asCustom(new GuardUpgradePopup(mContext, mLiveUid, data, new GuardUpgradePopup.GuardUpgradeCallBack() {
@Override
public void onGuardLevel() {
LiveGuardDialog.this.dismiss();
}
}))
.show();
}