Commit a1b5f1e9 by mergen

对获取根activity的办法进行修改。

parent 82515606
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
对系统等webview进行设置。。
1、增加了静态js加载mimetype的强制加入。
2、增加了img svg文件的mimetype的强制加入。(有bug)
*/
package org.apache.cordova.x5engine;
......@@ -77,7 +66,6 @@ public class X5WebViewClient extends WebViewClient {
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest request , Bundle bundle) {
String url = request.getUrl().toString();
if (url.contains(".js")){
//干掉file:///
......@@ -99,7 +87,7 @@ public class X5WebViewClient extends WebViewClient {
String fileName = rootDir + "/" + newUrl;
try {
InputStream is = this.activity.getAssets().open(fileName);
InputStream is = parentEngine.cordova.getActivity().getAssets().open(fileName);
Log.e("file" , "------ File loaded ---000-0-------------");
return new WebResourceResponse(mimeType, encoding, is);
} catch (IOException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment