index: update all.json

This commit is contained in:
hyb1996
2018-02-04 11:23:03 +08:00
parent 399cb29dd5
commit 3b398ec732
5 changed files with 108 additions and 10 deletions

View File

@@ -1,4 +1,83 @@
[
{
"name": "globals",
"url": "globals.html",
"summary": "全局函数",
"properties": [
{
"key": "sleep",
"url": "globals.html#globals_sleep_n",
"summary": "暂停运行",
"global": true
},
{
"key": "currentPackage",
"url": "globals.html#globals_currentpackage",
"summary": "当前包名",
"global": true
},
{
"key": "currentActivity",
"url": "globals.html#globals_currentactivity",
"summary": "当前活动",
"global": true
},
{
"key": "setClip",
"url": "globals.html#globals_setclip_text",
"summary": "设置剪贴板",
"global": true
},
{
"key": "getClip",
"url": "globals.html#globals_getclip",
"summary": "获取剪贴板",
"global": true
},
{
"key": "toast",
"url": "globals.html#globals_toast_message",
"summary": "气泡提示",
"global": true
},
{
"key": "toastLog",
"url": "globals.html#globals_toastlog_messagep",
"summary": "提示&打印",
"global": true
},
{
"key": "waitForActivity",
"url": "globals.html#globals_waitforactivity_activity_period_200",
"summary": "等待活动",
"global": true
},
{
"key": "waitForPackage",
"url": "globals.html#globals_waitforpackage_package_period_200",
"summary": "等待包名",
"global": true
},{
"key": "exit",
"url": "globals.html#globals_exit",
"summary": "退出",
"global": true
},
{
"key": "random",
"url": "globals.html#globals_random_min_max",
"summary": "随机数",
"global": true
},
{
"key": "context",
"url": "globals.html#globals_context",
"summary": "",
"global": true,
"variable": true
}
]
},
{
"name": "app",
"url": "app.html",
@@ -190,7 +269,8 @@
{
"key": "log",
"url": "console.html#console_console_log_data_args",
"summary": "打印日志"
"summary": "打印日志",
"global": true
},
{
"key": "warn",

View File

@@ -51,7 +51,8 @@ public class AutoCompletion {
private void buildDictionaryTree(List<Module> modules) {
for (Module module : modules) {
mGlobalPropertyTree.putWord(module.getName(), module.asGlobalProperty());
if (!module.getName().equals("globals"))
mGlobalPropertyTree.putWord(module.getName(), module.asGlobalProperty());
for (Property property : module.getProperties()) {
if (property.isGlobal())
mGlobalPropertyTree.putWord(property.getKey(), property);

View File

@@ -20,6 +20,9 @@ public class Property {
@SerializedName("global")
private boolean mGlobal;
@SerializedName("variable")
private boolean mVariable = false;
public Property() {
}
@@ -61,4 +64,12 @@ public class Property {
public void setGlobal(boolean global) {
mGlobal = global;
}
public boolean isVariable() {
return mVariable;
}
public void setVariable(boolean variable) {
mVariable = variable;
}
}

View File

@@ -428,12 +428,18 @@ public class EditorView extends FrameLayout implements CodeCompletionBar.OnHintC
@Override
public void onPropertyClick(Module m, Property property) {
if (property.isGlobal()) {
mEditor.insert(property.getKey() + "()");
} else {
mEditor.insert(m.getName() + "." + property.getKey() + "()");
String p = property.getKey();
if (!property.isVariable()) {
p = p + "()";
}
if (property.isGlobal()) {
mEditor.insert(p);
} else {
mEditor.insert(m.getName() + "." + p);
}
if (!property.isVariable()) {
mEditor.moveCursor(0, -1);
}
mEditor.moveCursor(0, -1);
mFunctionsKeyboardHelper.hideFunctionsLayout(true);
}