summaryrefslogtreecommitdiffstats
path: root/picolanginstaller
diff options
context:
space:
mode:
authorCharles Chen <clchen@google.com>2009-07-17 15:05:33 -0700
committerCharles Chen <clchen@google.com>2009-07-17 15:07:33 -0700
commit8472dfa0c2641f91ca79986959652c8b2463be29 (patch)
tree44032ebe8ed6c62d4fab9655c49fc919cf88b244 /picolanginstaller
parentde0498d852dc3f1517989ffa06593aa67f8b5d80 (diff)
downloadexternal_svox-8472dfa0c2641f91ca79986959652c8b2463be29.zip
external_svox-8472dfa0c2641f91ca79986959652c8b2463be29.tar.gz
external_svox-8472dfa0c2641f91ca79986959652c8b2463be29.tar.bz2
Changing the PicoLangInstaller to use the data path provided
by the PicoTtsEngine rather than relying on a hardcoded path to /sdcard/
Diffstat (limited to 'picolanginstaller')
-rwxr-xr-xpicolanginstaller/res/raw/svoxlangpack.zipbin4348562 -> 4348442 bytes
-rwxr-xr-xpicolanginstaller/src/com/svox/langpack/installer/InstallerActivity.java22
2 files changed, 18 insertions, 4 deletions
diff --git a/picolanginstaller/res/raw/svoxlangpack.zip b/picolanginstaller/res/raw/svoxlangpack.zip
index 46f00e2..18b042f 100755
--- a/picolanginstaller/res/raw/svoxlangpack.zip
+++ b/picolanginstaller/res/raw/svoxlangpack.zip
Binary files differ
diff --git a/picolanginstaller/src/com/svox/langpack/installer/InstallerActivity.java b/picolanginstaller/src/com/svox/langpack/installer/InstallerActivity.java
index a2f0739..5c85afe 100755
--- a/picolanginstaller/src/com/svox/langpack/installer/InstallerActivity.java
+++ b/picolanginstaller/src/com/svox/langpack/installer/InstallerActivity.java
@@ -13,20 +13,34 @@ import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
+import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class InstallerActivity extends Activity {
+ private static final int DATA_ROOT_DIRECTORY_REQUEST_CODE = 42;
+ private String rootDirectory = "";
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Intent getRootDirectoryIntent = new Intent();
+ getRootDirectoryIntent.setClassName("com.svox.pico", "com.svox.pico.CheckVoiceData");
+ startActivityForResult(getRootDirectoryIntent, DATA_ROOT_DIRECTORY_REQUEST_CODE);
+ }
- runInstaller();
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data){
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == DATA_ROOT_DIRECTORY_REQUEST_CODE) {
+ rootDirectory = data.getStringExtra(TextToSpeech.Engine.VOICE_DATA_ROOT_DIRECTORY);
+ runInstaller();
+ }
}
-
+
private void runInstaller(){
try {
Resources res = getResources();
@@ -58,11 +72,11 @@ public class InstallerActivity extends Activity {
ZipEntry entry = zis.getNextEntry();
while (entry != null) {
if (entry.isDirectory()) {
- File newDir = new File("/sdcard/" + entry.getName());
+ File newDir = new File(rootDirectory + entry.getName());
newDir.mkdir();
} else {
String name = entry.getName();
- File outputFile = new File("/sdcard/" + name);
+ File outputFile = new File(rootDirectory + name);
String outputPath = outputFile.getCanonicalPath();
name = outputPath
.substring(outputPath.lastIndexOf("/") + 1);