From 8668ca8b2a8fd0e7da0236b3813c789889b2b134 Mon Sep 17 00:00:00 2001 From: TrianguloY Date: Wed, 13 Mar 2019 13:45:24 +0100 Subject: [PATCH] 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. --- .../activities/ScriptEditor.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/llx/app/src/main/java/net/pierrox/lightning_launcher/activities/ScriptEditor.java b/app/llx/app/src/main/java/net/pierrox/lightning_launcher/activities/ScriptEditor.java index df827fc..d285137 100644 --- a/app/llx/app/src/main/java/net/pierrox/lightning_launcher/activities/ScriptEditor.java +++ b/app/llx/app/src/main/java/net/pierrox/lightning_launcher/activities/ScriptEditor.java @@ -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.ImageSvg; 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.PageIndicator; import net.pierrox.lightning_launcher.script.api.Panel; @@ -240,7 +239,9 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic } } private static ArrayList 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 mLeftPaneAnimOut; @@ -967,7 +968,7 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic ImageScript.class, ImageSvg.class, Item.class, - LL.class, + //LL.class, Lightning.class, Panel.class, StopPoint.class, @@ -1205,7 +1206,10 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic mCompletionsViewGroup.removeAllViews(); final LayoutInflater inflater = getLayoutInflater(); - addSugestion(inflater, sLLToken); + if(completions.isEmpty()) { + // add main Tokens if no others are available + addSugestions(inflater, sMainTokens); + } for (ArrayList tokens : completions) { addSugestion(inflater, tokens); } @@ -1226,10 +1230,12 @@ public class ScriptEditor extends ResourceWrapperActivity implements View.OnClic completions.add(l); } - private void addSugestion(LayoutInflater inflater, Token token) { - ArrayList l = new ArrayList<>(1); - l.add(token); - addSugestion(inflater, l); + private void addSugestions(LayoutInflater inflater, Token[] tokens) { + for (Token token : tokens) { + ArrayList l = new ArrayList<>(1); + l.add(token); + addSugestion(inflater, l); + } } private void addSugestion(LayoutInflater inflater, ArrayList tokens) {