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