• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Navigation voice changer app for Android


Commit MetaInfo

Revision52ceead60e2e6cb12f470812c5057f4b2b9862d8 (tree)
Time2013-07-31 03:36:06
AuthorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Move method to show install result to VoiceData.

Change Summary

Incremental Difference

--- a/src/jp/nekoteki/android/navivoicechanger/InstallListActivity.java
+++ b/src/jp/nekoteki/android/navivoicechanger/InstallListActivity.java
@@ -189,12 +189,7 @@ public class InstallListActivity extends Activity {
189189 vd.playPreview();
190190 break;
191191 case C_MENU_INSTALL:
192- try {
193- vd.install();
194- this.showInstallResult(null);
195- } catch (Exception e) {
196- this.showInstallResult(e);
197- }
192+ vd.installAndShowResults(this);
198193 break;
199194 case C_MENU_DELETE:
200195 vd.delete();
@@ -209,30 +204,6 @@ public class InstallListActivity extends Activity {
209204 return true;
210205 }
211206
212- public void showInstallResult(Exception e) {
213- AlertDialog.Builder dialog = new AlertDialog.Builder(this);
214- dialog.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
215- @Override
216- public void onClick(DialogInterface arg0, int arg1) { }
217- });
218- dialog.setTitle(R.string.install_error);
219- if (e == null) {
220- dialog.setTitle(R.string.install_success);
221- dialog.setMessage(R.string.install_success_message);
222- } else if (e instanceof BrokenArchive || e instanceof ZipException) {
223- dialog.setMessage(R.string.err_broken_archive);
224- } else if (e instanceof DataDirNotFound) {
225- dialog.setMessage(R.string.err_no_target);
226- } else if (e instanceof IOException) {
227- dialog.setMessage(R.string.err_fileio);
228- } else {
229- dialog.setMessage(R.string.err_unknown);
230- Log.e("Inatall Activity", "Unknown Erorr!! ");
231- e.printStackTrace();
232- }
233- dialog.show();
234- }
235-
236207 public void goDownloadActivityFromMenu(MenuItem item) {
237208 startActivity(new Intent(InstallListActivity.this, DownloadActivity.class));
238209 }
--- a/src/jp/nekoteki/android/navivoicechanger/VoiceData.java
+++ b/src/jp/nekoteki/android/navivoicechanger/VoiceData.java
@@ -22,6 +22,7 @@ import android.net.Uri;
2222 import android.util.Log;
2323 import android.app.AlertDialog;
2424 import android.content.Context;
25+import android.content.DialogInterface;
2526 import android.content.res.AssetManager;
2627
2728 class VoiceDataInstallError extends Exception {};
@@ -436,6 +437,40 @@ public class VoiceData {
436437 Log.i("VoiceData", "Install finished!");
437438 }
438439
440+ public void installAndShowResults(Context context) {
441+ try {
442+ this.install();
443+ } catch (Exception e){
444+ this.showInstallResult(e, context);
445+ return;
446+ }
447+ this.showInstallResult(null, context);
448+ }
449+
450+ public void showInstallResult(Exception e, Context context) {
451+ AlertDialog.Builder dialog = new AlertDialog.Builder(context);
452+ dialog.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
453+ @Override
454+ public void onClick(DialogInterface arg0, int arg1) { }
455+ });
456+ dialog.setTitle(R.string.install_error);
457+ if (e == null) {
458+ dialog.setTitle(R.string.install_success);
459+ dialog.setMessage(R.string.install_success_message);
460+ } else if (e instanceof BrokenArchive || e instanceof ZipException) {
461+ dialog.setMessage(R.string.err_broken_archive);
462+ } else if (e instanceof DataDirNotFound) {
463+ dialog.setMessage(R.string.err_no_target);
464+ } else if (e instanceof IOException) {
465+ dialog.setMessage(R.string.err_fileio);
466+ } else {
467+ dialog.setMessage(R.string.err_unknown);
468+ Log.e("VoiceData", "Unknown Erorr on install!! ");
469+ e.printStackTrace();
470+ }
471+ dialog.show();
472+ }
473+
439474 public void delete() {
440475 File dir = new File(this.getPath());
441476 File[] files = dir.listFiles();