修改问题

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 androidx.fragment.app.FragmentActivity;
import com.lxj.xpopup.core.CenterPopupView; import com.lxj.xpopup.core.CenterPopupView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.CheckUpgradesModel; import com.yunbao.common.bean.CheckUpgradesModel;
import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.RewardsModel; import com.yunbao.common.bean.RewardsModel;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; 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.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
@ -29,11 +33,12 @@ public class GuardUpgradePopup extends CenterPopupView {
ImageView rewards_img1, rewards_img2, rewards_img3; ImageView rewards_img1, rewards_img2, rewards_img3;
TextView rewards_text1, rewards_text2, rewards_text3; 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); super(context);
activity = (FragmentActivity) context; activity = (FragmentActivity) context;
mLiveUid = liveUid; mLiveUid = liveUid;
mUpgradesModel = upgradesModel; mUpgradesModel = upgradesModel;
mGuardUpgradeCallBack = guardUpgradeCallBack;
} }
@Override @Override
@ -120,6 +125,7 @@ public class GuardUpgradePopup extends CenterPopupView {
.guardGetRewards(mUpgradesModel.getLevel(), mLiveUid, new HttpCallback<Object>() { .guardGetRewards(mUpgradesModel.getLevel(), mLiveUid, new HttpCallback<Object>() {
@Override @Override
public void onSuccess(Object data) { public void onSuccess(Object data) {
ToastUtil.show(WordUtil.isNewZh() ? "領取成功" : "Receive successfully");
dismiss(); 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); CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson, CheckUpgradesModel.class);
if (!TextUtils.isEmpty(upgradesModel.getLevel())) if (!TextUtils.isEmpty(upgradesModel.getLevel()))
new XPopup.Builder(mWebView.getContext()) new XPopup.Builder(mWebView.getContext())
.asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel)) .asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel,null))
.show(); .show();
} catch (JsonSyntaxException e) { } catch (JsonSyntaxException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

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

View File

@ -402,7 +402,12 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
public void onSuccess(CheckUpgradesModel data) { public void onSuccess(CheckUpgradesModel data) {
if (!data.getRewards().isEmpty()) if (!data.getRewards().isEmpty())
new XPopup.Builder(mContext) 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(); .show();
} }

View File

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