Js调用原生整改,主播踢人不退出房间问题修改
This commit is contained in:
@@ -42,6 +42,7 @@ import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.event.MainHomeCommunityToChatEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
@@ -561,6 +562,7 @@ public class MyWebViewActivity extends AbsActivity {
|
||||
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidClickSayHiBack")) {
|
||||
Constants.firstInto = 0;
|
||||
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(event.getUserId()));
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
||||
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
||||
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
||||
|
||||
@@ -6,14 +6,10 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
@@ -24,40 +20,39 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.bean.VideoListBean;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.JavascriptInterfaceUtils;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.LiveReportActivity;
|
||||
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.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||
import com.yunbao.main.dialog.EncourageDialog;
|
||||
import com.yunbao.video.activity.VideoPlayActivity;
|
||||
import com.yunbao.common.bean.VideoBean;
|
||||
import com.yunbao.video.utils.VideoStorge;
|
||||
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* Created by Chen Haoxuan on 2022/4/19.
|
||||
@@ -83,10 +78,8 @@ public class MyWebViewActivity2 extends AbsActivity {
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Bus.getOn(this);
|
||||
String url = getIntent().getStringExtra(Constants.URL);
|
||||
// if (!"".endsWith(Constants.myUrl)) {
|
||||
// url = Constants.myUrl;
|
||||
// }
|
||||
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||
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().setJavaScriptEnabled(true);
|
||||
mWebView.getSettings().setDomStorageEnabled(true);
|
||||
@@ -221,107 +216,6 @@ public class MyWebViewActivity2 extends AbsActivity {
|
||||
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;
|
||||
|
||||
@@ -438,6 +332,7 @@ public class MyWebViewActivity2 extends AbsActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Bus.getOff(this);
|
||||
if (mWebView != null) {
|
||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||
if (parent != null) {
|
||||
@@ -500,35 +395,25 @@ public class MyWebViewActivity2 extends AbsActivity {
|
||||
|
||||
}
|
||||
|
||||
// private void closeFinger() {
|
||||
// if (Build.VERSION.SDK_INT >= 21) {
|
||||
// mWebView.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// String method = "Left()";//拼接参数,就可以把数据传递给js
|
||||
// mWebView.evaluateJavascript(method, new ValueCallback<String>() {
|
||||
// @Override
|
||||
// public void onReceiveValue(String value) {
|
||||
// Log.i("Log", "Left()js返回" + value);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// mWebView.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// mWebView.setWebViewClient(new WebViewClient() {
|
||||
// @Override
|
||||
// public void onPageFinished(WebView view, String url) {
|
||||
// super.onPageFinished(view, url);
|
||||
// mWebView.loadUrl("javascript:Left()");
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
|
||||
if (!TextUtils.isEmpty(event.getMethod())) {
|
||||
Constants.nowPostsId = event.getPostsId();
|
||||
EncourageDialog fragment = new EncourageDialog();
|
||||
fragment.show(((MyWebViewActivity2) mContext).getSupportFragmentManager(), "EncourageDialog");
|
||||
} else if (TextUtils.equals(event.getMethod(), "modifyMydata")) {
|
||||
indexInto = event.getIndexInto();
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidMethodLookToLive")) {
|
||||
//看直播
|
||||
gotoLive(event.getLiveId());
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidClickSayHiBack")) {
|
||||
Constants.firstInto = 0;
|
||||
SystemMessageActivity.forward(mContext, "-2", event.getUserId(), event.getName(), event.getImage());
|
||||
} else if (TextUtils.equals(event.getMethod(), "androidPlayVideo")) {
|
||||
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
||||
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
||||
} else if (TextUtils.equals(event.getMethod(), "openWebView")) {
|
||||
ZhuangBanActivity.forward(mContext, event.getData(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
@@ -37,12 +36,13 @@ import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.JavascriptInterfaceEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.ActivityResultCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
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.ProcessImageUtil;
|
||||
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.http.MainHttpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -150,7 +153,9 @@ public class RewardActivity extends AbsActivity {
|
||||
});
|
||||
mWebView.getSettings().setJavaScriptEnabled(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) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
@@ -159,180 +164,6 @@ public class RewardActivity extends AbsActivity {
|
||||
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() {
|
||||
mImageUtil = new ProcessImageUtil(this);
|
||||
@@ -522,12 +353,6 @@ public class RewardActivity extends AbsActivity {
|
||||
if (Constants.isShowPage != -1) {
|
||||
finish();
|
||||
}
|
||||
// new Handler().postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// mWebView.reload();
|
||||
// }
|
||||
// }, 100);
|
||||
if (isUpdataUser) {
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
@@ -538,4 +363,61 @@ public class RewardActivity extends AbsActivity {
|
||||
}
|
||||
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;
|
||||
|
||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
@@ -36,6 +38,7 @@ import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.GiftCacheUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
@@ -49,8 +52,6 @@ import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
@Route(path = RouteUtil.PATH_ZHUANGBANACTIVITY)
|
||||
public class ZhuangBanActivity extends AbsActivity {
|
||||
|
||||
@@ -71,6 +72,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Bus.getOn(this);
|
||||
String url = getIntent().getStringExtra(Constants.URL);
|
||||
String titleString = getIntent().getStringExtra("title");
|
||||
if (!"".equals(Constants.myPackageUrl)) {
|
||||
@@ -83,9 +85,9 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
|
||||
params.topMargin = DpUtil.dp2px(34);
|
||||
rootView.setLayoutParams(params);
|
||||
if (TextUtils.isEmpty(titleString)){
|
||||
if (TextUtils.isEmpty(titleString)) {
|
||||
lt_title.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
if (TextUtils.equals(titleString, "blank")) {
|
||||
lt_title.setVisibility(View.GONE);
|
||||
} else {
|
||||
@@ -121,9 +123,9 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
if (TextUtils.isEmpty(titleString)){
|
||||
if (TextUtils.isEmpty(titleString)) {
|
||||
setTitle(view.getTitle());
|
||||
}else {
|
||||
} else {
|
||||
setTitle(titleString);
|
||||
}
|
||||
|
||||
@@ -291,6 +293,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
Constants.isTitle = true;
|
||||
RouteUtil.forwardZhuangBanActivity(url);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidClickToNewH5PageView(String url) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
@@ -303,6 +306,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
mContext.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新跳转
|
||||
*
|
||||
@@ -321,6 +325,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
mContext.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置超皇字体颜色
|
||||
*
|
||||
@@ -331,9 +336,9 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
@JavascriptInterface
|
||||
public void androidSetColor(String startColor, String endColor, String contentColor) {
|
||||
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
|
||||
model.setStartColor("#"+startColor)
|
||||
.setEndColor("#"+endColor)
|
||||
.setContentColor("#"+contentColor);
|
||||
model.setStartColor("#" + startColor)
|
||||
.setEndColor("#" + endColor)
|
||||
.setContentColor("#" + contentColor);
|
||||
IMLoginManager.get(mContext).upDataUserInfo(model);
|
||||
}
|
||||
}
|
||||
@@ -428,7 +433,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
Intent intent = new Intent(context, ZhuangBanActivity.class);
|
||||
Log.i("tag1212", url);
|
||||
intent.putExtra(Constants.URL, url);
|
||||
if (url.contains("Noble/index.html")){
|
||||
if (url.contains("Noble/index.html")) {
|
||||
intent.putExtra("title", "");
|
||||
}
|
||||
context.startActivity(intent);
|
||||
@@ -440,6 +445,7 @@ public class ZhuangBanActivity extends AbsActivity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Bus.getOff(this);
|
||||
if (mWebView != null) {
|
||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||
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")) {
|
||||
VideoStorge.getInstance().put(Constants.VIDEO_COMMUNITY, event.getVideoBeanList());
|
||||
VideoPlayActivity.forward(mContext, event.getPosition(), Constants.VIDEO_COMMUNITY, 1);
|
||||
|
||||
Reference in New Issue
Block a user