fix #232
This commit is contained in:
@@ -2,7 +2,9 @@ package com.stardust.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
@@ -98,13 +100,16 @@ public class EWebView extends FrameLayout implements SwipeRefreshLayout.OnRefres
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||
view.loadUrl(request.getUrl().toString());
|
||||
return true;
|
||||
return shouldOverrideUrlLoading(view, request.getUrl().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url);
|
||||
if (url.startsWith("http://") || url.startsWith("https://")) {
|
||||
view.loadUrl(url);
|
||||
} else {
|
||||
getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.stardust.autojs.runtime.api.Console;
|
||||
import com.stardust.autojs.script.JavaScriptSource;
|
||||
import com.stardust.autojs.script.ScriptSource;
|
||||
import com.stardust.lang.ThreadCompat;
|
||||
import com.stardust.util.TextUtils;
|
||||
import com.stardust.util.UiHandler;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -248,7 +249,7 @@ public class ScriptEngineService {
|
||||
writer.close();
|
||||
BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
String line;
|
||||
StringBuilder scriptTrace = new StringBuilder(e.getMessage());
|
||||
StringBuilder scriptTrace = new StringBuilder(TextUtils.toEmptyIfNull(e.getMessage()));
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
if (line.trim().startsWith("at script"))
|
||||
scriptTrace.append("\n").append(line);
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
package com.stardust.util;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/5/3.
|
||||
*/
|
||||
|
||||
public class TextUtils {
|
||||
|
||||
public static String join(CharSequence delimiter, Object... tokens){
|
||||
public static String join(CharSequence delimiter, Object... tokens) {
|
||||
return android.text.TextUtils.join(delimiter, tokens);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
public static String toEmptyIfNull(String message) {
|
||||
if (message == null)
|
||||
return "";
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user