Js调用原生整改,主播踢人不退出房间问题修改
This commit is contained in:
parent
2119d75e5b
commit
9f0b6897f1
@ -21,6 +21,26 @@ public class JavascriptInterfaceEvent extends BaseModel {
|
|||||||
private String moneyUsd;
|
private String moneyUsd;
|
||||||
private boolean isUpdataUser;
|
private boolean isUpdataUser;
|
||||||
private String data;
|
private String data;
|
||||||
|
private String name;
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JavascriptInterfaceEvent setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JavascriptInterfaceEvent setImage(String image) {
|
||||||
|
this.image = image;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUserId() {
|
public String getUserId() {
|
||||||
return userId;
|
return userId;
|
||||||
|
@ -1,29 +1,33 @@
|
|||||||
package com.yunbao.common.utils;
|
package com.yunbao.common.utils;
|
||||||
|
|
||||||
import static com.yunbao.common.CommonAppConfig.isGetNewWrap;
|
import static com.yunbao.common.CommonAppConfig.isGetNewWrap;
|
||||||
|
import static com.yunbao.common.CommonAppContext.logger;
|
||||||
|
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.webkit.JavascriptInterface;
|
import android.webkit.JavascriptInterface;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import com.adjust.sdk.Adjust;
|
||||||
|
import com.adjust.sdk.AdjustEvent;
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.JsWishBean;
|
|
||||||
import com.yunbao.common.bean.ReportCommunityBean;
|
import com.yunbao.common.bean.ReportCommunityBean;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.bean.VideoBean;
|
import com.yunbao.common.bean.VideoBean;
|
||||||
import com.yunbao.common.bean.VideoListBean;
|
import com.yunbao.common.bean.VideoListBean;
|
||||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||||
import com.yunbao.common.event.MainHomeCommunityToChatEvent;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -205,8 +209,12 @@ public class JavascriptInterfaceUtils {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidClickSayHiBack(String uid, String name, String img) {
|
public void androidClickSayHiBack(String uid, String name, String img) {
|
||||||
Bus.get().post(new JavascriptInterfaceEvent()
|
Bus.get().post(new JavascriptInterfaceEvent()
|
||||||
.setMethod("androidClickSayHiBack"));
|
.setMethod("androidClickSayHiBack")
|
||||||
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(uid));
|
.setUserId(uid)
|
||||||
|
.setUserId(uid)
|
||||||
|
.setImage(img)
|
||||||
|
.setName(name));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
@ -271,6 +279,7 @@ public class JavascriptInterfaceUtils {
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void openWebView(String url) {
|
public void openWebView(String url) {
|
||||||
|
Bus.get().post(new JavascriptInterfaceEvent().setMethod("openWebView").setData(url));
|
||||||
Constants.isTitle = false;
|
Constants.isTitle = false;
|
||||||
RouteUtil.forwardZhuangBanActivity(url);
|
RouteUtil.forwardZhuangBanActivity(url);
|
||||||
}
|
}
|
||||||
@ -320,6 +329,14 @@ public class JavascriptInterfaceUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//跳转修改头像
|
||||||
|
@JavascriptInterface
|
||||||
|
public void openUpdataAvater(String s) {
|
||||||
|
Bus.get().post(new JavascriptInterfaceEvent()
|
||||||
|
.setMethod("openUpdataAvater"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//跳转修改签名
|
//跳转修改签名
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void openUpdataAutograph() {
|
public void openUpdataAutograph() {
|
||||||
@ -328,6 +345,13 @@ public class JavascriptInterfaceUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//跳转修改签名
|
||||||
|
@JavascriptInterface
|
||||||
|
public void openUpdataAutograph(String s) {
|
||||||
|
Bus.get().post(new JavascriptInterfaceEvent()
|
||||||
|
.setMethod("openUpdataAutograph"));
|
||||||
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidGoTopUp() {
|
public void androidGoTopUp() {
|
||||||
Bus.get().post(new JavascriptInterfaceEvent()
|
Bus.get().post(new JavascriptInterfaceEvent()
|
||||||
@ -376,6 +400,30 @@ public class JavascriptInterfaceUtils {
|
|||||||
Bus.get().post(new JavascriptInterfaceEvent()
|
Bus.get().post(new JavascriptInterfaceEvent()
|
||||||
.setMethod("onTrickerySendGift")
|
.setMethod("onTrickerySendGift")
|
||||||
.setUserId(id));
|
.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(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback<File>() {
|
||||||
|
@Override
|
||||||
|
public void callback(File bean) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@JavascriptInterface
|
||||||
|
public void AndroidAdjustPrank() {
|
||||||
|
AdjustEvent adjustEvent1 = new AdjustEvent("v1nekv");
|
||||||
|
Adjust.trackEvent(adjustEvent1);
|
||||||
|
mFirebaseAnalytics.logEvent("FS_prank_interaction", null);
|
||||||
|
logger.logEvent("FB_prank_interaction", null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.yunbao.live.dialog;
|
|||||||
|
|
||||||
import static com.yunbao.common.CommonAppContext.logger;
|
import static com.yunbao.common.CommonAppContext.logger;
|
||||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
|
||||||
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -26,16 +25,20 @@ import android.webkit.WebView;
|
|||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.adjust.sdk.Adjust;
|
import com.adjust.sdk.Adjust;
|
||||||
import com.adjust.sdk.AdjustEvent;
|
import com.adjust.sdk.AdjustEvent;
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.bean.JsWishBean;
|
import com.yunbao.common.bean.JsWishBean;
|
||||||
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||||
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
@ -45,12 +48,13 @@ import com.yunbao.live.activity.LiveActivity;
|
|||||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||||
import com.yunbao.common.bean.LiveBean;
|
|
||||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
public class LiveHDDialogFragment extends AbsDialogFragment {
|
public class LiveHDDialogFragment extends AbsDialogFragment {
|
||||||
|
|
||||||
@ -124,6 +128,17 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
|||||||
window.setAttributes(params);
|
window.setAttributes(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
Bus.getOff(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
Bus.getOn(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
@ -199,21 +214,8 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
|||||||
|
|
||||||
//js调用原生
|
//js调用原生
|
||||||
public class JsInteration {
|
public class JsInteration {
|
||||||
@JavascriptInterface
|
|
||||||
public void androidGoTopUp() {
|
|
||||||
|
|
||||||
ARouter.getInstance().build(PATH_COIN).withInt("p", 0).withString("tag", "&first_page=1").navigation();
|
|
||||||
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public String androidMethod(String data) {
|
|
||||||
if (data != null && !data.isEmpty()) {
|
|
||||||
onTrickerySendGiftInto(new JsWishBean(data));
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void AndroidAdjustPrank() {
|
public void AndroidAdjustPrank() {
|
||||||
@ -383,4 +385,17 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
|
|||||||
mWebView.destroy();
|
mWebView.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||||
|
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||||
|
if (TextUtils.equals(event.getMethod(), "androidGoTopUp")) {
|
||||||
|
dismiss();
|
||||||
|
} else if (TextUtils.equals(event.getMethod(), "androidMethod")) {
|
||||||
|
if (event.getData() != null && !event.getData().isEmpty()) {
|
||||||
|
onTrickerySendGiftInto(new JsWishBean(event.getData()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -185,6 +185,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
//是否成功调用进入房间接口
|
//是否成功调用进入房间接口
|
||||||
private boolean isEnterRoom = false;
|
private boolean isEnterRoom = false;
|
||||||
|
private boolean kick = false;
|
||||||
|
|
||||||
public PortraitLiveManager setQuitF(boolean quitF) {
|
public PortraitLiveManager setQuitF(boolean quitF) {
|
||||||
isQuitF = quitF;
|
isQuitF = quitF;
|
||||||
@ -319,7 +320,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST);
|
CommonHttpUtil.cancel(LiveHttpConsts.GET_WISH_LIST);
|
||||||
IMLoginManager.get(mContext).setisNewUserOne(false);
|
IMLoginManager.get(mContext).setisNewUserOne(false);
|
||||||
//子线程执行退出操作
|
//子线程执行退出操作
|
||||||
exitLiveRoom();
|
exitLiveRoom(false);
|
||||||
if (mLiveAudienceViewHolder != null) {
|
if (mLiveAudienceViewHolder != null) {
|
||||||
mLiveAudienceViewHolder.removeFromParent();
|
mLiveAudienceViewHolder.removeFromParent();
|
||||||
mLiveAudienceViewHolder.removeCallbacks();
|
mLiveAudienceViewHolder.removeCallbacks();
|
||||||
@ -371,13 +372,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
if (isQuit) {
|
if (isQuit) {
|
||||||
isQuitF = true;
|
isQuitF = true;
|
||||||
if (PermissionUtils.checkPermission(mContext)) {
|
if (PermissionUtils.checkPermission(mContext) && !kick) {
|
||||||
LiveFloatView.getInstance()
|
LiveFloatView.getInstance()
|
||||||
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
.cacheLiveData(mLiveBean, mLiveType, mLiveSDK, mLiveTypeVal)
|
||||||
.builderSystemFloat(mContext, mLiveBean.getPull());
|
.builderSystemFloat(mContext, mLiveBean.getPull());
|
||||||
mContext.finish();
|
mContext.finish();
|
||||||
} else {
|
} else {
|
||||||
if (IMLoginManager.get(mContext).isFloat()) {
|
if (IMLoginManager.get(mContext).isFloat() && !kick) {
|
||||||
EventBus.getDefault()
|
EventBus.getDefault()
|
||||||
.post(new LiveFloatEvent()
|
.post(new LiveFloatEvent()
|
||||||
.setmLiveBean(mLiveBean)
|
.setmLiveBean(mLiveBean)
|
||||||
@ -772,7 +773,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
@Override
|
@Override
|
||||||
public void onKick(String touid) {
|
public void onKick(String touid) {
|
||||||
if (!TextUtils.isEmpty(touid) && touid.equals(CommonAppConfig.getInstance().getUid())) {//被踢的是自己
|
if (!TextUtils.isEmpty(touid) && touid.equals(CommonAppConfig.getInstance().getUid())) {//被踢的是自己
|
||||||
exitLiveRoom();
|
kick = true;
|
||||||
|
exitLiveRoom(true);
|
||||||
ToastUtil.show(WordUtil.getString(R.string.live_kicked_2));
|
ToastUtil.show(WordUtil.getString(R.string.live_kicked_2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1414,7 +1416,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
exitLiveRoom();
|
exitLiveRoom(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1422,7 +1424,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
/**
|
/**
|
||||||
* 退出直播间
|
* 退出直播间
|
||||||
*/
|
*/
|
||||||
public void exitLiveRoom() {
|
public void exitLiveRoom(boolean isQuitF) {
|
||||||
if (mLiveBean == null && !isEnterRoom) {
|
if (mLiveBean == null && !isEnterRoom) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1434,6 +1436,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
LiveHttpUtil.qBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
LiveHttpUtil.qBackRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(int code, String msg, String[] info) {
|
public void onSuccess(int code, String msg, String[] info) {
|
||||||
|
if (isQuitF) {
|
||||||
|
onRemove(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1471,9 +1476,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void openDrawer() {
|
|
||||||
// drawerLayout.openDrawer(GravityCompat.END);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void onLinkMicTxAccEvent(LinkMicTxAccEvent e) {
|
public void onLinkMicTxAccEvent(LinkMicTxAccEvent e) {
|
||||||
if (mLivePlayViewHolder != null && mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
if (mLivePlayViewHolder != null && mLivePlayViewHolder instanceof LivePlayTxViewHolder) {
|
||||||
@ -1543,7 +1545,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelClick() {
|
public void onCancelClick() {
|
||||||
exitLiveRoom();
|
exitLiveRoom(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import com.yunbao.common.activity.AbsActivity;
|
|||||||
import com.yunbao.common.bean.LiveBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||||
|
import com.yunbao.common.event.MainHomeCommunityToChatEvent;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
@ -561,6 +562,7 @@ public class MyWebViewActivity extends AbsActivity {
|
|||||||
|
|
||||||
} else if (TextUtils.equals(event.getMethod(), "androidClickSayHiBack")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidClickSayHiBack")) {
|
||||||
Constants.firstInto = 0;
|
Constants.firstInto = 0;
|
||||||
|
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(event.getUserId()));
|
||||||
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
||||||
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
||||||
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
||||||
|
@ -6,14 +6,10 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import androidx.annotation.RequiresApi;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.JavascriptInterface;
|
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.ValueCallback;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
@ -24,40 +20,39 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.LiveBean;
|
||||||
import com.yunbao.common.bean.VideoListBean;
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
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.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
import com.yunbao.live.activity.LiveReportActivity;
|
|
||||||
import com.yunbao.live.activity.SystemMessageActivity;
|
import com.yunbao.live.activity.SystemMessageActivity;
|
||||||
import com.yunbao.common.bean.LiveBean;
|
|
||||||
import com.yunbao.common.bean.ReportCommunityBean;
|
|
||||||
import com.yunbao.live.event.LiveRoomChangeEvent;
|
import com.yunbao.live.event.LiveRoomChangeEvent;
|
||||||
import com.yunbao.live.http.LiveHttpUtil;
|
import com.yunbao.live.http.LiveHttpUtil;
|
||||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||||
import com.yunbao.main.dialog.EncourageDialog;
|
import com.yunbao.main.dialog.EncourageDialog;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
import com.yunbao.video.activity.VideoPlayActivity;
|
||||||
import com.yunbao.common.bean.VideoBean;
|
|
||||||
import com.yunbao.video.utils.VideoStorge;
|
import com.yunbao.video.utils.VideoStorge;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Chen Haoxuan on 2022/4/19.
|
* Created by Chen Haoxuan on 2022/4/19.
|
||||||
@ -83,10 +78,8 @@ public class MyWebViewActivity2 extends AbsActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
|
Bus.getOn(this);
|
||||||
String url = getIntent().getStringExtra(Constants.URL);
|
String url = getIntent().getStringExtra(Constants.URL);
|
||||||
// if (!"".endsWith(Constants.myUrl)) {
|
|
||||||
// url = Constants.myUrl;
|
|
||||||
// }
|
|
||||||
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
||||||
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||||
btnEdit = (ImageView) findViewById(R.id.btn_edit);
|
btnEdit = (ImageView) findViewById(R.id.btn_edit);
|
||||||
@ -179,7 +172,9 @@ public class MyWebViewActivity2 extends AbsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView)
|
||||||
|
.setPageClose(true)
|
||||||
|
.setLiveZhuangBana(false), "androidObject");
|
||||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||||
mWebView.getSettings().setDomStorageEnabled(true);
|
mWebView.getSettings().setDomStorageEnabled(true);
|
||||||
@ -221,107 +216,6 @@ public class MyWebViewActivity2 extends AbsActivity {
|
|||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
//js调用原生
|
|
||||||
public class JsInteration {
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidCommunityGift(String postsId) {
|
|
||||||
Constants.nowPostsId = postsId;
|
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
EncourageDialog fragment = new EncourageDialog();
|
|
||||||
fragment.show(((MyWebViewActivity2) mContext).getSupportFragmentManager(), "EncourageDialog");
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void reportCommunity(String info) {
|
|
||||||
ReportCommunityBean reportCommunityBean = JSON.parseObject(info, ReportCommunityBean.class);
|
|
||||||
LiveReportActivity.forward3(mContext, reportCommunityBean.getDynamic_id(), 1, reportCommunityBean.getCommunity_type(), reportCommunityBean.getComment_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void onBack() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void modifyMydata() {
|
|
||||||
indexInto = 1;
|
|
||||||
RouteUtil.forwardEditProfileActivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void reportUser(String touid) {
|
|
||||||
RouteUtil.forwardLiveReportActivity(touid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidMethodLookToLive(String liveId) {
|
|
||||||
//看直播
|
|
||||||
gotoLive(liveId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidClickSayHiBack(String uid, String name, String img) {
|
|
||||||
Constants.firstInto = 0;
|
|
||||||
SystemMessageActivity.forward(mContext, "-2", uid, name, img);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidClickFansList(String uid) {
|
|
||||||
FansActivity.forward(mContext, uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
|
||||||
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, videoBeanList);
|
|
||||||
VideoPlayActivity.forward(mContext, position, Constants.VIDEO_COMMUNITY, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void openWebView(String url) {
|
|
||||||
ZhuangBanActivity.forward(mContext, url, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private LiveRoomCheckLivePresenter mCheckLivePresenter;
|
private LiveRoomCheckLivePresenter mCheckLivePresenter;
|
||||||
|
|
||||||
@ -438,6 +332,7 @@ public class MyWebViewActivity2 extends AbsActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
Bus.getOff(this);
|
||||||
if (mWebView != null) {
|
if (mWebView != null) {
|
||||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@ -500,35 +395,25 @@ public class MyWebViewActivity2 extends AbsActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void closeFinger() {
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
// if (Build.VERSION.SDK_INT >= 21) {
|
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||||
// mWebView.post(new Runnable() {
|
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||||
// @Override
|
Constants.nowPostsId = event.getPostsId();
|
||||||
// public void run() {
|
EncourageDialog fragment = new EncourageDialog();
|
||||||
// String method = "Left()";//拼接参数,就可以把数据传递给js
|
fragment.show(((MyWebViewActivity2) mContext).getSupportFragmentManager(), "EncourageDialog");
|
||||||
// mWebView.evaluateJavascript(method, new ValueCallback<String>() {
|
} else if (TextUtils.equals(event.getMethod(), "modifyMydata")) {
|
||||||
// @Override
|
indexInto = event.getIndexInto();
|
||||||
// public void onReceiveValue(String value) {
|
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
|
||||||
// Log.i("Log", "Left()js返回" + value);
|
//看直播
|
||||||
// }
|
gotoLive(event.getLiveId());
|
||||||
// });
|
} else if (TextUtils.equals(event.getMethod(), "androidClickSayHiBack")) {
|
||||||
// }
|
Constants.firstInto = 0;
|
||||||
// });
|
SystemMessageActivity.forward(mContext, "-2", event.getUserId(), event.getName(), event.getImage());
|
||||||
// } else {
|
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
||||||
// mWebView.post(new Runnable() {
|
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
||||||
// @Override
|
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
||||||
// public void run() {
|
} else if (TextUtils.equals(event.getMethod(), "openWebView")) {
|
||||||
// mWebView.setWebViewClient(new WebViewClient() {
|
ZhuangBanActivity.forward(mContext, event.getData(), false);
|
||||||
// @Override
|
}
|
||||||
// public void onPageFinished(WebView view, String url) {
|
}
|
||||||
// super.onPageFinished(view, url);
|
|
||||||
// mWebView.loadUrl("javascript:Left()");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.webkit.JavascriptInterface;
|
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.ValueCallback;
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebChromeClient;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
@ -37,12 +36,13 @@ import com.yunbao.common.CommonAppConfig;
|
|||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
|
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.GiftCacheUtil;
|
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
import com.yunbao.common.utils.ProcessImageUtil;
|
import com.yunbao.common.utils.ProcessImageUtil;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
@ -52,6 +52,9 @@ import com.yunbao.common.utils.WordUtil;
|
|||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -150,7 +153,9 @@ public class RewardActivity extends AbsActivity {
|
|||||||
});
|
});
|
||||||
mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持
|
mWebView.getSettings().setJavaScriptEnabled(true); // 是否开启JS支持
|
||||||
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||||
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
mWebView.addJavascriptInterface(new JavascriptInterfaceUtils(mContext, mWebView)
|
||||||
|
.setPageClose(true)
|
||||||
|
.setLiveZhuangBana(false), "androidObject");
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
}
|
}
|
||||||
@ -159,180 +164,6 @@ public class RewardActivity extends AbsActivity {
|
|||||||
updataImg();
|
updataImg();
|
||||||
}
|
}
|
||||||
|
|
||||||
//js调用原生
|
|
||||||
public class JsInteration {
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidClickToNewH5PageView(String url) {
|
|
||||||
url = CommonAppConfig.HOST + url;
|
|
||||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
|
||||||
+ CommonAppConfig.getInstance().getToken();
|
|
||||||
Log.i("tag", url);
|
|
||||||
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
|
|
||||||
intent.putExtra("url", url);
|
|
||||||
intent.putExtra("isFull", false);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新跳转
|
|
||||||
*
|
|
||||||
* @param url 跳转的url
|
|
||||||
* @param title 有标题的展示标题
|
|
||||||
*/
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidClickToNewH5PageView(String url, String title) {
|
|
||||||
url = CommonAppConfig.HOST + url;
|
|
||||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
|
||||||
+ CommonAppConfig.getInstance().getToken();
|
|
||||||
Log.i("tag", url);
|
|
||||||
Intent intent = new Intent(mContext, ZhuangBanActivity.class);
|
|
||||||
intent.putExtra("url", url);
|
|
||||||
intent.putExtra("isFull", false);
|
|
||||||
intent.putExtra("title", title);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
|
|
||||||
}
|
|
||||||
@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(Constants.GIF_CAR_PREFIX + id, url1, "0", new CommonCallback<File>() {
|
|
||||||
@Override
|
|
||||||
public void callback(File bean) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidOpeningNoble(String svg) {
|
|
||||||
try {
|
|
||||||
new SVGAParser(mContext).parse(new URL(svg), new SVGAParser.ParseCompletion() {
|
|
||||||
@Override
|
|
||||||
public void onComplete(SVGAVideoEntity videoItem) {
|
|
||||||
svga.setVisibility(View.VISIBLE);
|
|
||||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
|
||||||
svga.setImageDrawable(drawable);
|
|
||||||
svga.setLoops(1);
|
|
||||||
SVGAViewUtils.playEndClear(svga);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError() {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
svga.setCallback(new SVGACallback() {
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinished() {
|
|
||||||
svga.clear();
|
|
||||||
svga.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRepeat() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStep(int i, double v) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidGoBack() {
|
|
||||||
// Log.e("Zhu", "svg" +svg);
|
|
||||||
RewardActivity.this.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void androidGoToRe() {
|
|
||||||
//我们的
|
|
||||||
// ARouter.getInstance().build(PATH_COIN).withInt("p",1).navigation();
|
|
||||||
//谷歌的
|
|
||||||
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void gotoHomePage(String indexStr) {
|
|
||||||
Log.e("tgasss", "indexStr3" + 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) {
|
|
||||||
finish();
|
|
||||||
Constants.isShowPage = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//打开无头部
|
|
||||||
@JavascriptInterface
|
|
||||||
public void openWebView(String url) {
|
|
||||||
Constants.isTitle = false;
|
|
||||||
RouteUtil.forwardZhuangBanActivity(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
//打开有头部
|
|
||||||
@JavascriptInterface
|
|
||||||
public void openWebViewTitle(String url) {
|
|
||||||
Constants.isTitle = true;
|
|
||||||
RouteUtil.forwardZhuangBanActivity(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
//跳转修改昵称
|
|
||||||
@JavascriptInterface
|
|
||||||
public void openUpdataName(String s) {
|
|
||||||
isUpdataUser = true;
|
|
||||||
Constants.myIntoIndex = 2;
|
|
||||||
Intent intent = new Intent(mContext, MyWebViewActivity2.class);
|
|
||||||
intent.putExtra(Constants.URL, CommonAppConfig.HOST + "/h5/table/Modify-information.html" + "?token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid());
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
//跳转修改头像
|
|
||||||
@JavascriptInterface
|
|
||||||
public void openUpdataAvater(String s) {
|
|
||||||
isUpdataUser = true;
|
|
||||||
RouteUtil.forwardEditProfileActivity();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//跳转修改签名
|
|
||||||
@JavascriptInterface
|
|
||||||
public void openUpdataAutograph(String s) {
|
|
||||||
isUpdataUser = true;
|
|
||||||
forwardSign();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updataImg() {
|
private void updataImg() {
|
||||||
mImageUtil = new ProcessImageUtil(this);
|
mImageUtil = new ProcessImageUtil(this);
|
||||||
@ -522,12 +353,6 @@ public class RewardActivity extends AbsActivity {
|
|||||||
if (Constants.isShowPage != -1) {
|
if (Constants.isShowPage != -1) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
// new Handler().postDelayed(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// mWebView.reload();
|
|
||||||
// }
|
|
||||||
// }, 100);
|
|
||||||
if (isUpdataUser) {
|
if (isUpdataUser) {
|
||||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||||
@Override
|
@Override
|
||||||
@ -538,4 +363,61 @@ public class RewardActivity extends AbsActivity {
|
|||||||
}
|
}
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||||
|
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||||
|
if (TextUtils.equals(event.getMethod(), "androidOpeningNoble")) {
|
||||||
|
try {
|
||||||
|
new SVGAParser(mContext).parse(new URL(event.getSvg()), new SVGAParser.ParseCompletion() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(SVGAVideoEntity videoItem) {
|
||||||
|
svga.setVisibility(View.VISIBLE);
|
||||||
|
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||||
|
svga.setImageDrawable(drawable);
|
||||||
|
svga.setLoops(1);
|
||||||
|
SVGAViewUtils.playEndClear(svga);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
svga.setCallback(new SVGACallback() {
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinished() {
|
||||||
|
svga.clear();
|
||||||
|
svga.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRepeat() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStep(int i, double v) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else if (TextUtils.equals(event.getMethod(), "openUpdataName")) {
|
||||||
|
isUpdataUser = event.isUpdataUser();
|
||||||
|
Constants.myIntoIndex = 2;
|
||||||
|
} else if (TextUtils.equals(event.getMethod(), "openUpdataAvater")) {
|
||||||
|
isUpdataUser = true;
|
||||||
|
RouteUtil.forwardEditProfileActivity();
|
||||||
|
} else if (TextUtils.equals(event.getMethod(), "openUpdataAutograph")) {
|
||||||
|
isUpdataUser = true;
|
||||||
|
forwardSign();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.yunbao.main.activity;
|
package com.yunbao.main.activity;
|
||||||
|
|
||||||
|
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||||
|
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -36,6 +38,7 @@ import com.yunbao.common.activity.AbsActivity;
|
|||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
import com.yunbao.common.utils.GiftCacheUtil;
|
import com.yunbao.common.utils.GiftCacheUtil;
|
||||||
import com.yunbao.common.utils.L;
|
import com.yunbao.common.utils.L;
|
||||||
@ -49,8 +52,6 @@ import java.io.File;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
|
||||||
|
|
||||||
@Route(path = RouteUtil.PATH_ZHUANGBANACTIVITY)
|
@Route(path = RouteUtil.PATH_ZHUANGBANACTIVITY)
|
||||||
public class ZhuangBanActivity extends AbsActivity {
|
public class ZhuangBanActivity extends AbsActivity {
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void main() {
|
protected void main() {
|
||||||
|
Bus.getOn(this);
|
||||||
String url = getIntent().getStringExtra(Constants.URL);
|
String url = getIntent().getStringExtra(Constants.URL);
|
||||||
String titleString = getIntent().getStringExtra("title");
|
String titleString = getIntent().getStringExtra("title");
|
||||||
if (!"".equals(Constants.myPackageUrl)) {
|
if (!"".equals(Constants.myPackageUrl)) {
|
||||||
@ -291,6 +293,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
Constants.isTitle = true;
|
Constants.isTitle = true;
|
||||||
RouteUtil.forwardZhuangBanActivity(url);
|
RouteUtil.forwardZhuangBanActivity(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void androidClickToNewH5PageView(String url) {
|
public void androidClickToNewH5PageView(String url) {
|
||||||
url = CommonAppConfig.HOST + url;
|
url = CommonAppConfig.HOST + url;
|
||||||
@ -303,6 +306,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新跳转
|
* 新跳转
|
||||||
*
|
*
|
||||||
@ -321,6 +325,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置超皇字体颜色
|
* 设置超皇字体颜色
|
||||||
*
|
*
|
||||||
@ -440,6 +445,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
Bus.getOff(this);
|
||||||
if (mWebView != null) {
|
if (mWebView != null) {
|
||||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
|
@ -340,10 +340,6 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (TextUtils.equals(event.getMethod(), "isCloseNavigation")) {
|
|
||||||
if (nowMainActivity != null) {
|
|
||||||
nowMainActivity.isClose(event.getIsClose());
|
|
||||||
}
|
|
||||||
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
||||||
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
||||||
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user