eSpeakActivity: do not initiate an install of the voice data when the voice data is not installed

This commit is contained in:
Reece H. Dunn
2013-05-08 15:11:19 +01:00
parent 8bdb644285
commit 72bfb4205f
@@ -18,10 +18,7 @@
package com.reecedunn.espeak;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -61,7 +58,6 @@ public class eSpeakActivity extends Activity {
}
private State mState;
private boolean mDownloadedVoiceData;
private ArrayList<String> mVoices;
private TextToSpeech mTts;
private List<Pair<String,String>> mInformation;
@@ -167,17 +163,6 @@ public class eSpeakActivity extends Activity {
startActivityForResult(checkIntent, REQUEST_CHECK);
}
/**
* Launches the voice data installer.
*/
private void downloadVoiceData() {
final IntentFilter filter = new IntentFilter(DownloadVoiceData.BROADCAST_LANGUAGES_UPDATED);
registerReceiver(mDownloadReceiver, filter);
final Intent checkIntent = new Intent(this, DownloadVoiceData.class);
startActivity(checkIntent);
}
/**
* Initializes the TTS engine.
*/
@@ -240,18 +225,12 @@ public class eSpeakActivity extends Activity {
*/
private void onDataChecked(int resultCode, Intent data) {
if (resultCode != TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
if (mDownloadedVoiceData) {
Log.e(TAG, "Voice data check failed (error code: " + resultCode + ").");
setState(State.ERROR);
populateInformationView();
} else {
downloadVoiceData();
}
return;
Log.e(TAG, "Voice data check failed (error code: " + resultCode + ").");
setState(State.ERROR);
} else {
mVoices = data.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
}
mVoices = data.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
initializeEngine();
populateInformationView();
}
@@ -329,12 +308,4 @@ public class eSpeakActivity extends Activity {
}
startActivityForResult(intent, REQUEST_DEFAULT);
}
private final BroadcastReceiver mDownloadReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
mDownloadedVoiceData = true;
checkVoiceData();
}
};
}