- Toast.makeText(context, getString(R.string.unzippingDictionary, dest),
- Toast.LENGTH_LONG).show();
-
-
- final Uri zipUri = Uri.parse(dest);
- File localZipFile = null;
- InputStream zipFileStream = null;
- ZipInputStream zipFile = null;
- FileOutputStream zipOut = null;
- try {
- if (zipUri.getScheme().equals("content")) {
- zipFileStream = context.getContentResolver().openInputStream(zipUri);
- localZipFile = null;
- } else {
- localZipFile = new File(zipUri.getPath());
- zipFileStream = new FileInputStream(localZipFile);
- }
- zipFile = new ZipInputStream(new BufferedInputStream(zipFileStream));
- final ZipEntry zipEntry = zipFile.getNextEntry();
- Log.d(LOG, "Unzipping entry: " + zipEntry.getName());
- File targetFile = new File(application.getDictDir(), zipEntry.getName());
- if (targetFile.exists()) {
- targetFile.renameTo(new File(targetFile.getAbsolutePath().replace(".quickdic", ".bak.quickdic")));
- targetFile = new File(application.getDictDir(), zipEntry.getName());
- }
- zipOut = new FileOutputStream(targetFile);
- copyStream(zipFile, zipOut);
- application.backgroundUpdateDictionaries(dictionaryUpdater);
- Toast.makeText(context, getString(R.string.installationFinished, dest),