Removed 'LL' main autocompletion from the script editor.

Replaced with 'getEvent' due to their importance, but can be discussed to be replaced with one (or more!) different methods/classes.
This commit is contained in:
TrianguloY 2019-03-13 13:45:24 +01:00
parent 6f3fb13e83
commit 8668ca8b2a

View file

@ -64,7 +64,6 @@ import net.pierrox.lightning_launcher.script.api.ImageNinePatch;
import net.pierrox.lightning_launcher.script.api.ImageScript; import net.pierrox.lightning_launcher.script.api.ImageScript;
import net.pierrox.lightning_launcher.script.api.ImageSvg; import net.pierrox.lightning_launcher.script.api.ImageSvg;
import net.pierrox.lightning_launcher.script.api.Item; import net.pierrox.lightning_launcher.script.api.Item;
import net.pierrox.lightning_launcher.script.api.LL;
import net.pierrox.lightning_launcher.script.api.Lightning; import net.pierrox.lightning_launcher.script.api.Lightning;
import net.pierrox.lightning_launcher.script.api.PageIndicator; import net.pierrox.lightning_launcher.script.api.PageIndicator;
import net.pierrox.lightning_launcher.script.api.Panel; import net.pierrox.lightning_launcher.script.api.Panel;
@ -240,7 +239,9 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic
} }
} }
private static ArrayList<TokenMethod> sAutoCompleteTokens; private static ArrayList<TokenMethod> sAutoCompleteTokens;
private static TokenClass sLLToken = new TokenClass(LL.class); private static Token[] sMainTokens = new Token[]{
new TokenMethod(Lightning.class, "getEvent", "void", new Class[0])
};
private Animation mLeftPaneAnimIn; private Animation mLeftPaneAnimIn;
private Animation mLeftPaneAnimOut; private Animation mLeftPaneAnimOut;
@ -967,7 +968,7 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic
ImageScript.class, ImageScript.class,
ImageSvg.class, ImageSvg.class,
Item.class, Item.class,
LL.class, //LL.class,
Lightning.class, Lightning.class,
Panel.class, Panel.class,
StopPoint.class, StopPoint.class,
@ -1205,7 +1206,10 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic
mCompletionsViewGroup.removeAllViews(); mCompletionsViewGroup.removeAllViews();
final LayoutInflater inflater = getLayoutInflater(); final LayoutInflater inflater = getLayoutInflater();
addSugestion(inflater, sLLToken); if(completions.isEmpty()) {
// add main Tokens if no others are available
addSugestions(inflater, sMainTokens);
}
for (ArrayList<Token> tokens : completions) { for (ArrayList<Token> tokens : completions) {
addSugestion(inflater, tokens); addSugestion(inflater, tokens);
} }
@ -1226,10 +1230,12 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic
completions.add(l); completions.add(l);
} }
private void addSugestion(LayoutInflater inflater, Token token) { private void addSugestions(LayoutInflater inflater, Token[] tokens) {
ArrayList<Token> l = new ArrayList<>(1); for (Token token : tokens) {
l.add(token); ArrayList<Token> l = new ArrayList<>(1);
addSugestion(inflater, l); l.add(token);
addSugestion(inflater, l);
}
} }
private void addSugestion(LayoutInflater inflater, ArrayList<Token> tokens) { private void addSugestion(LayoutInflater inflater, ArrayList<Token> tokens) {