735 lines
25 KiB
Java
735 lines
25 KiB
Java
package com.yunbao.common.utils;
|
|
|
|
import static com.yunbao.common.CommonAppConfig.isGetNewWrap;
|
|
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
|
import static com.yunbao.common.utils.RouteUtil.PATH_REWARD;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Dialog;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.webkit.JavascriptInterface;
|
|
import android.webkit.WebView;
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.JsonSyntaxException;
|
|
import com.lxj.xpopup.XPopup;
|
|
import com.yunbao.common.CommonAppConfig;
|
|
import com.yunbao.common.Constants;
|
|
import com.yunbao.common.bean.CheckUpgradesModel;
|
|
import com.yunbao.common.bean.CreateSudRoomModel;
|
|
import com.yunbao.common.bean.IMLoginModel;
|
|
import com.yunbao.common.bean.LiveBean;
|
|
import com.yunbao.common.bean.ReportCommunityBean;
|
|
import com.yunbao.common.bean.UserBean;
|
|
import com.yunbao.common.bean.VideoBean;
|
|
import com.yunbao.common.bean.VideoListBean;
|
|
import com.yunbao.common.dialog.GuardUpgradePopup;
|
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
|
import com.yunbao.common.event.LiveRoomChangeEvent;
|
|
import com.yunbao.common.event.QuickGiftingEvent;
|
|
import com.yunbao.common.http.HttpCallback;
|
|
import com.yunbao.common.http.HttpClient;
|
|
import com.yunbao.common.http.LiveHttpUtil;
|
|
import com.yunbao.common.interfaces.CommonCallback;
|
|
import com.yunbao.common.manager.IMLoginManager;
|
|
import com.yunbao.common.manager.RandomSudGameManager;
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
import java.io.File;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
//网页调用Android工具类
|
|
public class JavascriptInterfaceUtils {
|
|
private Activity mContext;
|
|
private WebView mWebView;
|
|
//判断是页面关闭还是网页回退
|
|
private boolean pageClose = false;
|
|
private boolean dialogClose = false;
|
|
//同名activity跳转问题
|
|
private boolean LiveZhuangBana = true;
|
|
private static JavascriptInterfaceUtils sInstance;
|
|
|
|
public JavascriptInterfaceUtils setPageClose(boolean pageClose) {
|
|
this.pageClose = pageClose;
|
|
return this;
|
|
}
|
|
|
|
public JavascriptInterfaceUtils setDialogClose(boolean dialogClose) {
|
|
this.dialogClose = dialogClose;
|
|
return this;
|
|
}
|
|
|
|
public JavascriptInterfaceUtils setLiveZhuangBana(boolean liveZhuangBana) {
|
|
LiveZhuangBana = liveZhuangBana;
|
|
return this;
|
|
}
|
|
|
|
public JavascriptInterfaceUtils setmContext(Activity mContext, WebView mWebView) {
|
|
this.mContext = mContext;
|
|
this.mWebView = mWebView;
|
|
return this;
|
|
}
|
|
|
|
public static JavascriptInterfaceUtils getInstance() {
|
|
|
|
synchronized (JavascriptInterfaceUtils.class) {
|
|
|
|
sInstance = new JavascriptInterfaceUtils();
|
|
|
|
return sInstance;
|
|
}
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
public void androidOpeningNoble(String svg) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidOpeningNoble")
|
|
.setSvg(svg));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidGoBack() {
|
|
if (pageClose) {
|
|
mContext.finish();
|
|
} else {
|
|
if (dialogClose) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidGoBack"));
|
|
} else {
|
|
mContext.runOnUiThread(() -> mWebView.goBack());
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void AndroidAdjustConsume() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("AndroidAdjustConsume"));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidGoToRe() {
|
|
ARouter.getInstance().build(PATH_COIN).withInt("p", 1).navigation();
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void onBack() {
|
|
mContext.finish();
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidClickToNewH5PageView(String url) {
|
|
url = CommonAppConfig.HOST + url;
|
|
if (url.contains("?")) {
|
|
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
|
+ CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
|
} else {
|
|
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
|
+ CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
|
}
|
|
if (LiveZhuangBana) {
|
|
RouteUtil.forwardLiveZhuangBanActivity(url, false);
|
|
} else {
|
|
RouteUtil.forwardZhuangBanActivity(url, false);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 新跳转
|
|
*
|
|
* @param url 跳转的url
|
|
* @param title 有标题的展示标题
|
|
*/
|
|
@JavascriptInterface
|
|
public void androidClickToNewH5PageView(String url, String title) {
|
|
url = CommonAppConfig.HOST + url;
|
|
if (url.contains("?")) {
|
|
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
|
+ CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
|
} else {
|
|
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
|
+ CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
|
}
|
|
if (LiveZhuangBana) {
|
|
RouteUtil.forwardLiveZhuangBanActivity(url, title);
|
|
} else {
|
|
RouteUtil.forwardZhuangBanActivity(url, title);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 设置超皇字体颜色
|
|
*
|
|
* @param startColor 渐变色
|
|
* @param endColor 渐变色
|
|
* @param contentColor 内容颜色
|
|
*/
|
|
@JavascriptInterface
|
|
public void androidSetColor(String startColor, String endColor, String contentColor) {
|
|
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
|
|
model.setStartColor("#" + startColor)
|
|
.setEndColor("#" + endColor)
|
|
.setContentColor("#" + contentColor);
|
|
IMLoginManager.get(mContext).upDataUserInfo(model);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidCommunityGift(String postsId) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidCommunityGift")
|
|
.setPostsId(postsId));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void reportCommunity(String info) {
|
|
ReportCommunityBean reportCommunityBean = JSON.parseObject(info, ReportCommunityBean.class);
|
|
RouteUtil.forwardLiveReportActivity(reportCommunityBean.getDynamic_id(), 1, reportCommunityBean.getCommunity_type(), reportCommunityBean.getComment_id());
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void reportUser(String touid) {
|
|
RouteUtil.forwardLiveReportActivity(touid);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void isCloseNavigation(String isClose) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("isCloseNavigation")
|
|
.setIsClose(isClose));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidPlayVideo(String list) {
|
|
list.toString();
|
|
if (!"undefined".equals(list)) {
|
|
JSONObject obj = JSON.parseObject(list);
|
|
int position = obj.getIntValue("video_index");
|
|
String videoListString = obj.getString("video_list");
|
|
List<VideoListBean> videoList = JSON.parseArray(videoListString, VideoListBean.class);
|
|
List<VideoBean> videoBeanList = new ArrayList<>();
|
|
for (VideoListBean videoListBean : videoList) {
|
|
JSONObject obj2 = JSON.parseObject(videoListBean.getContent());
|
|
String msg = obj2.getString("msg");
|
|
VideoBean videoBean = new VideoBean();
|
|
videoBean.setHref(videoListBean.getVideo());
|
|
videoBean.setCity("");
|
|
videoBean.setCommentNum(videoListBean.getComment_num());
|
|
videoBean.setAddtime(videoListBean.getCreate_time());
|
|
videoBean.setDatetime("");
|
|
videoBean.setDistance("");
|
|
videoBean.setId(videoListBean.getId());
|
|
videoBean.setLat("");
|
|
videoBean.setLike(0);
|
|
videoBean.setTitle(msg);
|
|
if ("2".endsWith(videoListBean.getIs_attention()) || "0".endsWith(videoListBean.getIs_attention())) {
|
|
videoBean.setAttent(2);
|
|
} else if ("1".endsWith(videoListBean.getIs_attention())) {
|
|
videoBean.setAttent(1);
|
|
} else {
|
|
videoBean.setAttent(-1);
|
|
}
|
|
UserBean userBean = new UserBean();
|
|
userBean.setAvatar(videoListBean.getUser_avatar());
|
|
userBean.setUserNiceName(videoListBean.getUser_name());
|
|
userBean.setId(videoListBean.getUser_id());
|
|
videoBean.setUserBean(userBean);
|
|
|
|
videoBean.setUid(videoListBean.getUser_id());
|
|
videoBeanList.add(videoBean);
|
|
}
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidPlayVideo")
|
|
.setVideoBeanList(videoBeanList)
|
|
.setPosition(position));
|
|
}
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidClickSayHiBack(String uid, String name, String img) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidClickSayHiBack")
|
|
.setUserId(uid)
|
|
.setUserId(uid)
|
|
.setImage(img)
|
|
.setName(name));
|
|
|
|
}
|
|
|
|
/**
|
|
* 跳转直播并打开礼物栏选中礼物
|
|
*
|
|
* @param liveId 直播间id
|
|
* @param giftId 礼物id
|
|
*/
|
|
@JavascriptInterface
|
|
public void androidMethodLookToLiveGift(String liveId, String giftId) {
|
|
LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() {
|
|
@Override
|
|
public void onSuccess(int code, String msg, String[] info) {
|
|
if (code == 0 && info.length > 0) {
|
|
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
|
|
|
if (liveBean == null) {
|
|
return;
|
|
}
|
|
liveBean.setGiftId(giftId);
|
|
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
|
@Override
|
|
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
|
|
|
|
if (!"".endsWith(Constants.mStream)) {
|
|
|
|
if (MicStatusManager.getInstance().isMic(liveUid)) {
|
|
MicStatusManager.getInstance().showDownMicDialog(mContext);
|
|
return;
|
|
}
|
|
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
|
|
} else {
|
|
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
|
|
}
|
|
androidGoBack();
|
|
}
|
|
|
|
@Override
|
|
public void onCheckError(String contextError) {
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidMethodLookToLive(String liveId) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidMethodLookToLive")
|
|
.setLiveId(liveId));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidClickFansList(String uid) {
|
|
RouteUtil.forwardFansActivity(uid);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public String androidMethod(String data) {
|
|
Bus.get().post(new JavascriptInterfaceEvent().setMethod("androidMethod").setData(data));
|
|
|
|
|
|
return "";
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public String androidGetNewWrap(String data) {
|
|
if (data != null && !data.isEmpty()) {
|
|
isGetNewWrap = true;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidMethodBack() {
|
|
mContext.finish();
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
public void modifyMydata() {
|
|
Bus.get().post(new JavascriptInterfaceEvent().setMethod("modifyMydata").setIndexInto(1));
|
|
RouteUtil.forwardEditProfileActivity();
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void gotoHomePage(String indexStr) {
|
|
if (!"".equals(indexStr) && indexStr != null) {
|
|
int index = -1;
|
|
if ("0".equals(indexStr)) {
|
|
index = 0;
|
|
} else if ("1".equals(indexStr)) {
|
|
index = 1;
|
|
} else if ("2".equals(indexStr)) {
|
|
index = 2;
|
|
} else if ("3".equals(indexStr)) {
|
|
index = 3;
|
|
}
|
|
if (index != -1) {
|
|
mContext.finish();
|
|
Constants.isShowPage = index;
|
|
}
|
|
}
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void openWebView(String url) {
|
|
Bus.get().post(new JavascriptInterfaceEvent().setMethod("openWebView").setData(url));
|
|
Constants.isTitle = false;
|
|
RouteUtil.forwardZhuangBanActivity(url);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void openWebViewNew(String url) {
|
|
Bus.get().post(new JavascriptInterfaceEvent().setMethod("openWebView").setData(url));
|
|
Constants.isTitle = false;
|
|
RouteUtil.forwardZhuangBanActivity(CommonAppConfig.HOST + url);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void openWebViewTitle(String url) {
|
|
Constants.isTitle = true;
|
|
RouteUtil.forwardZhuangBanActivity(url);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidNewGoToGooglePay(String ProductId, String OrderNumber, String MoneyUsd) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidNewGoToGooglePay")
|
|
.setProductId(ProductId)
|
|
.setMoneyUsd(MoneyUsd)
|
|
.setOrderNumber(OrderNumber));
|
|
}
|
|
|
|
//拉黑不感兴趣
|
|
@JavascriptInterface
|
|
public void androidLoseInterest() {
|
|
EventBus.getDefault().post("blacklist");
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void AndroidFellow() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("AndroidFellow"));
|
|
}
|
|
|
|
//跳转修改昵称
|
|
@JavascriptInterface
|
|
public void openUpdataName() {
|
|
Constants.myIntoIndex = 2;
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("openUpdataName")
|
|
.setUpdataUser(true));
|
|
RouteUtil.forwardMyWebViewActivity2(CommonAppConfig.HOST + "/h5/table/Modify-information.html" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid());
|
|
}
|
|
|
|
//跳转修改头像
|
|
@JavascriptInterface
|
|
public void openUpdataAvater() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("openUpdataAvater"));
|
|
|
|
}
|
|
|
|
//跳转修改头像
|
|
@JavascriptInterface
|
|
public void openUpdataAvater(String s) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("openUpdataAvater"));
|
|
|
|
}
|
|
|
|
//跳转修改签名
|
|
@JavascriptInterface
|
|
public void openUpdataAutograph() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("openUpdataAutograph"));
|
|
|
|
}
|
|
|
|
//跳转修改签名
|
|
@JavascriptInterface
|
|
public void openUpdataAutograph(String s) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("openUpdataAutograph"));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidGoTopUp() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidGoTopUp"));
|
|
//我们的
|
|
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).withString("tag", "&first_page=1").navigation();
|
|
|
|
}
|
|
|
|
//心愿单守護购买
|
|
@JavascriptInterface
|
|
public void BuyProtection(String by) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("BuyProtection").setData(by));
|
|
}
|
|
|
|
//心愿单贵族购买
|
|
@JavascriptInterface
|
|
public void BuyVIP(String by) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("BuyVIP").setData(by));
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
public String androidMethodLookLive(String uId, String liveId, String isLiving) {
|
|
//跳转个人主页
|
|
RouteUtil.forwardUserHome(mContext, liveId, 0);
|
|
|
|
return "";
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void AndroidClose() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("AndroidClose"));
|
|
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void sendFansCard(String id) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("sendFansCard")
|
|
.setLiveId(id));
|
|
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public String androidMethodClickUser(String userId, String liveId) {
|
|
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidMethodClickUser")
|
|
.setLiveId(liveId)
|
|
.setUserId(userId));
|
|
|
|
return "";
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void onTrickerySendGift(String id) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("onTrickerySendGift")
|
|
.setUserId(id));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidZBan(String svg) {
|
|
String[] arr = svg.split("/");
|
|
String id = arr[arr.length - 1];
|
|
String url1;
|
|
if (!svg.contains("http")) {
|
|
url1 = CommonAppConfig.HOST + svg;
|
|
} else {
|
|
url1 = svg;
|
|
}
|
|
GiftCacheUtil.getFile(mContext, Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback<File>() {
|
|
@Override
|
|
public void callback(File bean) {
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void AndroidAdjustPrank() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("AndroidAdjustPrank"));
|
|
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void openWrap() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("openWrap"));
|
|
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidSignGift(String json) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidSignGift")
|
|
.setData(json));
|
|
|
|
}
|
|
|
|
/**
|
|
* 设置webView高度
|
|
*
|
|
* @param useDp 是否用dp换算
|
|
*/
|
|
@JavascriptInterface
|
|
public void setHeight(String height, String width, boolean useDp) {
|
|
if ("0".equals(height)) {
|
|
return;
|
|
}
|
|
Handler handler = new Handler(Looper.getMainLooper());
|
|
handler.post(() -> {
|
|
ViewGroup.LayoutParams params = mWebView.getLayoutParams();
|
|
if ("-1".equals(height)) {
|
|
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
} else {
|
|
params.height = useDp ? DpUtil.dp2px(Integer.parseInt(height)) : Integer.parseInt(height);
|
|
}
|
|
mWebView.setLayoutParams(params);
|
|
mWebView.setVisibility(View.VISIBLE);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 社区分享
|
|
*
|
|
* @param avatar 头像
|
|
* @param link 分享连接
|
|
*/
|
|
@JavascriptInterface
|
|
public void androidCommunityShare(String avatar, String link) {
|
|
JSONObject json = new JSONObject();
|
|
json.put("avatar", avatar);
|
|
json.put("link", link);
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidCommunityShare")
|
|
.setData(json.toJSONString()));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidInviteShare(String url) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidInviteShare")
|
|
.setData(url));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void closeLiveRoom() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("closeLiveRoom"));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void clickLogOffAccount() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("clickLogOffAccount"));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidClickToTaskPage() {
|
|
ARouter.getInstance().build(PATH_REWARD).withString("url",
|
|
CommonAppConfig.HOST + "/h5/task/index.html?" + "uid=" + CommonAppConfig.getInstance().getUid()
|
|
+ "&token=" + CommonAppConfig.getInstance().getToken() + "&tabIndex=1" + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0")).navigation();
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidQuickGiftRemainingQuantity(int giftRemainingQuantity) {
|
|
Bus.get().post(new QuickGiftingEvent().setGiftRemainingQuantity(String.valueOf(giftRemainingQuantity)));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidFansGroupBuy(String id) {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidFansGroupBuy").setUserId(id));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidFansGroupPack() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidFansGroupPack"));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidFansGroupInfo() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidFansGroupInfo"));
|
|
}
|
|
|
|
/**
|
|
* 礼物墙
|
|
*/
|
|
@JavascriptInterface
|
|
public void toGiftNamingAlertAllPageView(String mAnchorName, String mLiveUid, String mAvatarUrl, int isAnchor) {
|
|
// RouteUtil.forwardGiftWallActivity("", mAnchorName, mLiveUid, mAvatarUrl, 0, isAnchor == 1);
|
|
new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid,mAnchorName, null,isAnchor==1).setFullWindows(true).showDialog();
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void wearOrCancelFanMedal() {
|
|
HttpClient.getInstance().get("huoquyonghujibenxinxiv2", "getBaseInfo")
|
|
.params("uid", IMLoginManager.get(mContext).getUserInfo().getId())
|
|
.params("token", IMLoginManager.get(mContext).getUserInfo().getToken())
|
|
.execute(new HttpCallback() {
|
|
@Override
|
|
public void onSuccess(int code, String msg, String[] info) {
|
|
if (code == 0 && info.length > 0) {
|
|
IMLoginManager.get(mContext).upDataUserInfo(info[0]);
|
|
JSONObject obj = JSON.parseObject(info[0]);
|
|
UserBean bean = JSON.toJavaObject(obj, UserBean.class);
|
|
CommonAppConfig.getInstance().setUserBean(bean);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidCancelAnchorAttention() {
|
|
Bus.get().post(new JavascriptInterfaceEvent()
|
|
.setMethod("androidCancelAnchorAttention"));
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidLnsufficientBalanceClick(String msg) {
|
|
DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() {
|
|
@Override
|
|
public void onCancelClick() {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onConfirmClick(Dialog dialog, String content) {
|
|
dialog.dismiss();
|
|
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation();
|
|
}
|
|
});
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidGotoCustomerService(String url) {
|
|
ToastUtil.showDebug("网页跳客服页面");
|
|
RouteUtil.forwardCustomerService(url);
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void androidtoCommunityVideo() {
|
|
RouteUtil.forwardCommunityActivity();
|
|
}
|
|
|
|
@JavascriptInterface
|
|
public void getRewards(String checkUpgradesJson) {
|
|
try {
|
|
CheckUpgradesModel upgradesModel = new Gson().fromJson(checkUpgradesJson, CheckUpgradesModel.class);
|
|
if (!TextUtils.isEmpty(upgradesModel.getLevel()))
|
|
new XPopup.Builder(mWebView.getContext())
|
|
.asCustom(new GuardUpgradePopup(mWebView.getContext(), "", upgradesModel,null))
|
|
.show();
|
|
} catch (JsonSyntaxException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
@JavascriptInterface
|
|
public void androidRandomSudGame(){
|
|
RandomSudGameManager.getManager().random(mContext);
|
|
}
|
|
@JavascriptInterface
|
|
public void androidStartSudGame(String roomName,String roomId,String gameId){
|
|
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
|
createSudRoomModel.setSudGameId(gameId);
|
|
createSudRoomModel.setSudGameRoomId(roomId);
|
|
createSudRoomModel.setRoomName(roomName);
|
|
RandomSudGameManager.getManager().start(createSudRoomModel,true,true);
|
|
}
|
|
}
|