remove multi-line string support for my stupid coding
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
"ui";
|
"ui";
|
||||||
|
|
||||||
ui.statusBarColor("#000000")
|
|
||||||
showLoginUI();
|
showLoginUI();
|
||||||
|
ui.statusBarColor("#000000")
|
||||||
|
|
||||||
//显示登录界面
|
//显示登录界面
|
||||||
function showLoginUI(){
|
function showLoginUI(){
|
||||||
ui.layout(`
|
ui.layout(
|
||||||
<frame>
|
<frame>
|
||||||
<vertical h="auto" align="center" margin="0 50">
|
<vertical h="auto" align="center" margin="0 50">
|
||||||
<linear>
|
<linear>
|
||||||
@@ -22,7 +22,7 @@ function showLoginUI(){
|
|||||||
</linear>
|
</linear>
|
||||||
</vertical>
|
</vertical>
|
||||||
</frame>
|
</frame>
|
||||||
`);
|
);
|
||||||
|
|
||||||
ui.login.click(() => {
|
ui.login.click(() => {
|
||||||
toast("您输入的用户名为" + ui.name.text() + " 密码为" + ui.password.text());
|
toast("您输入的用户名为" + ui.name.text() + " 密码为" + ui.password.text());
|
||||||
@@ -32,7 +32,7 @@ function showLoginUI(){
|
|||||||
|
|
||||||
//显示注册界面
|
//显示注册界面
|
||||||
function showRegisterUI(){
|
function showRegisterUI(){
|
||||||
ui.layout(`
|
ui.layout(
|
||||||
<frame>
|
<frame>
|
||||||
<vertical h="auto" align="center" margin="0 50">
|
<vertical h="auto" align="center" margin="0 50">
|
||||||
<linear>
|
<linear>
|
||||||
@@ -53,6 +53,6 @@ function showRegisterUI(){
|
|||||||
</linear>
|
</linear>
|
||||||
</vertical>
|
</vertical>
|
||||||
</frame>
|
</frame>
|
||||||
`);
|
);
|
||||||
ui.cancel.click(() => showLoginUI());
|
ui.cancel.click(() => showLoginUI());
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.stardust.scriptdroid.service;
|
package com.stardust.scriptdroid.service;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
|
||||||
import com.stardust.scriptdroid.App;
|
|
||||||
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||||
import com.stardust.view.accessibility.AccessibilityDelegate;
|
import com.stardust.view.accessibility.AccessibilityDelegate;
|
||||||
import com.stardust.view.accessibility.AccessibilityService;
|
import com.stardust.view.accessibility.AccessibilityService;
|
||||||
@@ -39,8 +39,8 @@ public class AccessibilityWatchDogService extends AccessibilityService {
|
|||||||
eventTypes.addAll(set);
|
eventTypes.addAll(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnable() {
|
public static boolean isEnable(Context context) {
|
||||||
return AccessibilityServiceUtils.isAccessibilityServiceEnabled(App.getApp(), AccessibilityWatchDogService.class);
|
return AccessibilityServiceUtils.isAccessibilityServiceEnabled(context, AccessibilityWatchDogService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AccessibilityWatchDogService getInstance() {
|
public static AccessibilityWatchDogService getInstance() {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class SideMenuFragment extends Fragment {
|
|||||||
mExecutor.execute(new Runnable() {
|
mExecutor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final boolean checked = AccessibilityWatchDogService.isEnable();
|
final boolean checked = AccessibilityWatchDogService.isEnable(getActivity());
|
||||||
mAccessibilityServiceSwitch.post(new Runnable() {
|
mAccessibilityServiceSwitch.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -126,9 +126,10 @@ public class SideMenuFragment extends Fragment {
|
|||||||
|
|
||||||
@ViewBinding.Check(R.id.sw_auto_operate_service)
|
@ViewBinding.Check(R.id.sw_auto_operate_service)
|
||||||
private void setAutoOperateServiceEnable(boolean enable) {
|
private void setAutoOperateServiceEnable(boolean enable) {
|
||||||
if (enable && !AccessibilityWatchDogService.isEnable()) {
|
boolean isWatchDogServiceEnabled = AccessibilityWatchDogService.isEnable(getActivity());
|
||||||
|
if (enable && !isWatchDogServiceEnabled) {
|
||||||
AccessibilityServiceTool.enableAccessibilityService();
|
AccessibilityServiceTool.enableAccessibilityService();
|
||||||
} else if (!enable && AccessibilityWatchDogService.isEnable()) {
|
} else if (!enable && isWatchDogServiceEnabled) {
|
||||||
AccessibilityWatchDogService.disable();
|
AccessibilityWatchDogService.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module.exports = function(__runtime__, scope){
|
|||||||
ui.__id_cache__ = {};
|
ui.__id_cache__ = {};
|
||||||
|
|
||||||
ui.layout = function(xml){
|
ui.layout = function(xml){
|
||||||
view = ui.inflate(activity, xml);
|
view = ui.inflate(activity, xml.toString());
|
||||||
ui.setContentView(view);
|
ui.setContentView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,6 +14,8 @@ module.exports = function(__runtime__, scope){
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui.id = function(id){
|
ui.id = function(id){
|
||||||
|
if(!ui.view)
|
||||||
|
return null;
|
||||||
var v = ui.view.getChildAt(0).id(id);
|
var v = ui.view.getChildAt(0).id(id);
|
||||||
if(v){
|
if(v){
|
||||||
v = decorate(v);
|
v = decorate(v);
|
||||||
@@ -67,7 +69,7 @@ module.exports = function(__runtime__, scope){
|
|||||||
ui[name] = value;
|
ui[name] = value;
|
||||||
},
|
},
|
||||||
get: function(name, start) {
|
get: function(name, start) {
|
||||||
if(!ui[name]){
|
if(!ui[name] && ui.view){
|
||||||
var cacheView = ui.__id_cache__[name];
|
var cacheView = ui.__id_cache__[name];
|
||||||
if(cacheView){
|
if(cacheView){
|
||||||
return cacheView;
|
return cacheView;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.stardust.autojs.engine;
|
|||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.stardust.autojs.engine.preprocess.MultiLinePreprocessor;
|
||||||
import com.stardust.autojs.engine.preprocess.Preprocessor;
|
import com.stardust.autojs.engine.preprocess.Preprocessor;
|
||||||
import com.stardust.autojs.rhino_android.AndroidContextFactory;
|
import com.stardust.autojs.rhino_android.AndroidContextFactory;
|
||||||
import com.stardust.autojs.rhino_android.RhinoAndroidHelper;
|
import com.stardust.autojs.rhino_android.RhinoAndroidHelper;
|
||||||
@@ -17,11 +18,9 @@ import org.mozilla.javascript.ScriptableObject;
|
|||||||
import org.mozilla.javascript.commonjs.module.RequireBuilder;
|
import org.mozilla.javascript.commonjs.module.RequireBuilder;
|
||||||
import org.mozilla.javascript.commonjs.module.provider.SoftCachingModuleScriptProvider;
|
import org.mozilla.javascript.commonjs.module.provider.SoftCachingModuleScriptProvider;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,7 +34,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public class RhinoJavaScriptEngine implements ScriptEngine {
|
public class RhinoJavaScriptEngine implements ScriptEngine {
|
||||||
|
|
||||||
private static final String LOG_TAG = "RhinoJavaScriptEngine";
|
private static final String LOG_TAG = "RhinoJavaScriptEngine";
|
||||||
private static final Preprocessor PREPROCESSOR = new MultiLinePreprocessor();
|
|
||||||
|
|
||||||
private static int contextCount = 0;
|
private static int contextCount = 0;
|
||||||
private String[] mRequirePath = new String[0];
|
private String[] mRequirePath = new String[0];
|
||||||
@@ -69,8 +67,8 @@ public class RhinoJavaScriptEngine implements ScriptEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Reader preprocess(Reader script) throws IOException {
|
protected Reader preprocess(Reader script) throws IOException {
|
||||||
return PREPROCESSOR.preprocess(script);
|
return script;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.stardust.autojs.engine;
|
package com.stardust.autojs.engine.preprocess;
|
||||||
|
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
|
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.stardust.autojs.engine;
|
package com.stardust.autojs.engine;
|
||||||
|
|
||||||
|
import com.stardust.autojs.engine.preprocess.MultiLinePreprocessor;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import static com.stardust.autojs.engine.MultiLinePreprocessor.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on 2017/5/15.
|
* Created by Stardust on 2017/5/15.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user