Skip to content
Snippets Groups Projects
Commit c6e6638d authored by Francesco Andreuzzi's avatar Francesco Andreuzzi
Browse files

6.2a

parent 118d26a6
Branches
Tags
No related merge requests found
......@@ -128,7 +128,7 @@ public class MainManager {
MusicManager2 music = new MusicManager2(mContext);
AppsManager appsMgr = new AppsManager(c, sugg);
AliasManager aliasManager = new AliasManager();
AliasManager aliasManager = new AliasManager(mContext);
ShellHolder shellHolder = new ShellHolder(out);
interactive = shellHolder.build();
......
package ohi.andre.consolelauncher.managers;
import android.content.Context;
import android.content.Intent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
......@@ -15,6 +18,8 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ohi.andre.consolelauncher.R;
import ohi.andre.consolelauncher.tuils.InputOutputReceiver;
import ohi.andre.consolelauncher.tuils.Tuils;
import ohi.andre.consolelauncher.tuils.interfaces.Reloadable;
......@@ -23,10 +28,13 @@ public class AliasManager implements Reloadable {
public static final String PATH = "alias.txt";
private Map<String, String> aliases;
private String paramMarker, paramSeparator, aliasLabelFormat;
public AliasManager() {
private Context context;
public AliasManager(Context c) {
this.context = c;
reload();
paramMarker = Pattern.quote(XMLPrefsManager.get(String.class, XMLPrefsManager.Behavior.alias_param_marker));
......@@ -139,8 +147,21 @@ public class AliasManager implements Reloadable {
if(c != splatted.length - 1) value += "=";
}
name = name.trim();
value = value.trim();
if(name.equalsIgnoreCase(value)) {
Intent intent = new Intent(InputOutputReceiver.ACTION_OUTPUT);
intent.putExtra(InputOutputReceiver.TEXT, context.getString(R.string.output_notaddingalias1) + Tuils.SPACE + name + Tuils.SPACE + context.getString(R.string.output_notaddingalias2));
context.sendBroadcast(intent);
} else if(value.startsWith(name + Tuils.SPACE)) {
Intent intent = new Intent(InputOutputReceiver.ACTION_OUTPUT);
intent.putExtra(InputOutputReceiver.TEXT, context.getString(R.string.output_notaddingalias1) + Tuils.SPACE + name + Tuils.SPACE + context.getString(R.string.output_notaddingalias3));
context.sendBroadcast(intent);
} else {
aliases.put(name, value);
}
}
} catch (Exception e) {}
}
......
......@@ -52,6 +52,9 @@
<!-- alias -->
<string name="output_aliasnotfound">Alias not found:</string>
<string name="output_problemaddingalias">There was a problem with your alias</string>
<string name="output_notaddingalias1">The name of your alias:</string>
<string name="output_notaddingalias2">is equal to its value. This may lead to bad behaviors, so it has been excluded. You should edit the name to use it</string>
<string name="output_notaddingalias3">is equal to the part of its value before the first space (i.e. aliasName=play ; aliasValue = play store). This may lead to crashes and freezes, so it has been excluded. You should edit the name to use it</string>
<!-- tuixt -->
<string name="help_tuixt_help">Print the list of commands, or info about a command
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment