Browse Source

DownloadVoiceData.java: Inline onLanguagesInstalled to the onPostExecute callback.

master
Reece H. Dunn 12 years ago
parent
commit
e516356123
1 changed files with 12 additions and 16 deletions
  1. 12
    16
      android/src/com/reecedunn/espeak/DownloadVoiceData.java

+ 12
- 16
android/src/com/reecedunn/espeak/DownloadVoiceData.java View File

mAsyncExtract = new AsyncExtract(this, R.raw.espeakdata, dataPath) { mAsyncExtract = new AsyncExtract(this, R.raw.espeakdata, dataPath) {
@Override @Override
protected void onPostExecute(Integer result) { protected void onPostExecute(Integer result) {
onLanguagesInstalled(result); switch (result) {
case RESULT_OK:
final Intent intent = new Intent(BROADCAST_LANGUAGES_UPDATED);
sendBroadcast(intent);
break;
case RESULT_CANCELED:
// Do nothing?
break;
}

setResult(result);
finish();
} }
}; };


mAsyncExtract.cancel(true); mAsyncExtract.cancel(true);
} }


private void onLanguagesInstalled(int resultCode) {
switch (resultCode) {
case RESULT_OK:
final Intent intent = new Intent(BROADCAST_LANGUAGES_UPDATED);
sendBroadcast(intent);
break;
case RESULT_CANCELED:
// Do nothing?
break;
}

setResult(resultCode);
finish();
}

private static void clearContents(File directory) { private static void clearContents(File directory) {
if (!directory.exists() || !directory.isDirectory()) { if (!directory.exists() || !directory.isDirectory()) {
return; return;

Loading…
Cancel
Save