补充JS跳转方法

This commit is contained in:
zlzw 2022-11-09 13:12:05 +08:00
parent 1fc417ec25
commit 24f691d4b8

View File

@ -1,5 +1,7 @@
package com.yunbao.common.activity; package com.yunbao.common.activity;
import static com.yunbao.common.utils.RouteUtil.PATH_ZHUANGBANACTIVITY;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -7,7 +9,9 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.MediaStore; import android.provider.MediaStore;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -23,6 +27,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import com.alibaba.android.arouter.launcher.ARouter;
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;
@ -185,7 +190,7 @@ public class WebViewActivity extends AbsActivity {
@JavascriptInterface @JavascriptInterface
public void gotoHomePage(String indexStr) { public void gotoHomePage(String indexStr) {
Log.e("tgasss","indexStr4"+indexStr); Log.e("tgasss", "indexStr4" + indexStr);
if (!"".equals(indexStr) && indexStr != null) { if (!"".equals(indexStr) && indexStr != null) {
int index = -1; int index = -1;
@ -216,6 +221,24 @@ public class WebViewActivity extends AbsActivity {
Constants.isTitle = true; Constants.isTitle = true;
RouteUtil.forwardZhuangBanActivity(url); RouteUtil.forwardZhuangBanActivity(url);
} }
/**
* 新跳转
*
* @param url 跳转的url
* @param title 有标题的展示标题
*/
@JavascriptInterface
public void androidClickToNewH5PageView(String url, String title) {
url = CommonAppConfig.HOST + url;
Log.i("tag", url);
ARouter.getInstance().build(PATH_ZHUANGBANACTIVITY)
.withString("url",url)
.withString("title", title)
.withBoolean("isFull", false)
.navigation();
}
} }
private void openImageChooserActivity(ValueCallback<Uri> valueCallback) { private void openImageChooserActivity(ValueCallback<Uri> valueCallback) {