Browse Source

DownloadVoiceData.java: Inline onLanguagesInstalled to the onPostExecute callback.

master
Reece H. Dunn 11 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

@@ -49,7 +49,18 @@ public class DownloadVoiceData extends Activity {
mAsyncExtract = new AsyncExtract(this, R.raw.espeakdata, dataPath) {
@Override
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();
}
};

@@ -67,21 +78,6 @@ public class DownloadVoiceData extends Activity {
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) {
if (!directory.exists() || !directory.isDirectory()) {
return;

Loading…
Cancel
Save