fix code completion bug
This commit is contained in:
@@ -89,15 +89,15 @@ loop();
|
||||
返回触摸事件的最小时间间隔。
|
||||
|
||||
### events.onTouch(listener)
|
||||
* listener \<Function\> 参数为(x, y)的函数
|
||||
* listener \<Function\> 参数为Point的函数
|
||||
|
||||
注册一个触摸监听函数。
|
||||
|
||||
例如:
|
||||
```
|
||||
events.observeTouch();
|
||||
events.onTouch(function(x, y){
|
||||
log(x + ", " + y);
|
||||
events.onTouch(function(p){
|
||||
log(p.x + ", " + p.y);
|
||||
});
|
||||
events.loop();
|
||||
```
|
||||
@@ -106,21 +106,6 @@ events.loop();
|
||||
|
||||
删除所有事件监听函数。
|
||||
|
||||
### events.setTimeout(callback, delay)
|
||||
* callback \<Function\> 回调函数
|
||||
* delay \<Number\> 延迟
|
||||
|
||||
延迟大约delay毫秒后执行callback。该函数只有在events.loop()被使用时才有效。
|
||||
|
||||
返回一个整数表示这个设置的timeout, 可由clearTimeout取消。
|
||||
|
||||
|
||||
### events.clearTimeout(id)
|
||||
|
||||
* id \<Number\> 由 setTimeout() 返回的 ID 值。该值标识要取消的延迟执行回调。
|
||||
|
||||
取消由 setTimeout() 方法设置的 timeout。
|
||||
|
||||
### key事件
|
||||
|
||||
当有按键被按下或弹起时会触发该事件。
|
||||
|
||||
@@ -95,7 +95,6 @@ public class CodeCompletion implements TextWatcher {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
int position = mEditText.getSelectionStart();
|
||||
|
||||
String[] str = parseWordBefore(s, position);
|
||||
if (str != null) {
|
||||
if (str[1] != null) {
|
||||
@@ -163,8 +162,13 @@ public class CodeCompletion implements TextWatcher {
|
||||
private boolean searchCodeCompletionForVariable(String variable, String str) {
|
||||
List<String> properties = getPropertiesForVariable(variable);
|
||||
Collection<CodeCompletionItem> c = searchCodeCompletion(str, properties);
|
||||
mOnCodeCompletionChangeListener.OnCodeCompletionChange(c, Collections.<CodeCompletionItem>emptyList());
|
||||
return !c.isEmpty();
|
||||
if (c.isEmpty()) {
|
||||
mOnCodeCompletionChangeListener.OnCodeCompletionChange(DEFAULT_CODE_COMPLETION_LIST, Collections.<CodeCompletionItem>emptyList());
|
||||
return false;
|
||||
} else {
|
||||
mOnCodeCompletionChangeListener.OnCodeCompletionChange(c, Collections.<CodeCompletionItem>emptyList());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getPropertiesForVariable(String str) {
|
||||
|
||||
@@ -109,7 +109,11 @@ public class InputMethodEnhanceBar extends RecyclerView implements CodeCompletio
|
||||
mCodeCompletion.setVariableProperties(variables);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
mCodeCompletion.setGlobal(global);
|
||||
mCodeCompletion.setVariableProperties(variables);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setEditTextBridge(EditTextBridge editTextBridge) {
|
||||
|
||||
Reference in New Issue
Block a user