At least it works in some way...
This commit is contained in:
parent
73409d57a6
commit
819c4ace58
|
@ -273,7 +273,6 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
|
||||
/* Maybe there is some other way to implement this */
|
||||
private void openApp(String[] input) {
|
||||
final PackageManager pm = getPackageManager();
|
||||
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
|
||||
|
@ -293,8 +292,8 @@ public class MainActivity extends AppCompatActivity {
|
|||
speak(voiceLines.get(45));
|
||||
app.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
ctx.startActivity(app);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -506,6 +505,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
ArrayList data = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
|
||||
|
||||
input += data.get(0);
|
||||
/* TODO: Japanese doesn't split the words. Sigh. */
|
||||
String[] splitInput = input.split(" ");
|
||||
|
||||
if (splitInput.length > 1 && splitInput[0].equalsIgnoreCase(getString(R.string.christina))) {
|
||||
|
@ -513,10 +513,14 @@ public class MainActivity extends AppCompatActivity {
|
|||
String[] args = new String[splitInput.length - 2];
|
||||
System.arraycopy(splitInput, 2, args, 0, splitInput.length - 2);
|
||||
|
||||
/* TODO: Must be reimplemented for multilanguage support */
|
||||
switch (cmd) {
|
||||
case "open":
|
||||
openApp(args);
|
||||
break;
|
||||
case "открой":
|
||||
openApp(args);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
answerSpeech(input);
|
||||
|
|
Loading…
Reference in New Issue