| 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; |