From 568b7aeb5d17a6a0d8bcc29654fd3bb4c2882ccd Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Tue, 10 Jul 2012 03:08:03 +0000 Subject: [PATCH] Fix behavior when cancelling a failure to open an Ork file. This had finished the activity when it was its own activity. Now it just cancels the dialog. --- android/res/values/strings.xml | 1 + .../android/rocket/OpenRocketLoaderActivity.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml index 81c048b66..386c17d6d 100644 --- a/android/res/values/strings.xml +++ b/android/res/values/strings.xml @@ -20,6 +20,7 @@ No Yes Automatically saving rocket + Error Loading File Case diff --git a/android/src/net/sf/openrocket/android/rocket/OpenRocketLoaderActivity.java b/android/src/net/sf/openrocket/android/rocket/OpenRocketLoaderActivity.java index 6724744c5..46398da33 100644 --- a/android/src/net/sf/openrocket/android/rocket/OpenRocketLoaderActivity.java +++ b/android/src/net/sf/openrocket/android/rocket/OpenRocketLoaderActivity.java @@ -13,8 +13,8 @@ import net.sf.openrocket.android.util.AndroidLogWrapper; import net.sf.openrocket.motor.ThrustCurveMotorPlaceholder; import net.sf.openrocket.rocketcomponent.Rocket; import android.app.AlertDialog; +import android.app.Dialog; import android.content.ActivityNotFoundException; -import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; @@ -168,15 +168,12 @@ implements TCQueryAction.OnTCQueryCompleteListener, OpenRocketLoaderFragment.OnO if ( result.loadingError != null ) { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); - dialogBuilder.setTitle("Error Loading File" ); + dialogBuilder.setTitle( R.string.loadingErrorMessage ); dialogBuilder.setMessage( result.loadingError.getLocalizedMessage()); - dialogBuilder.setOnCancelListener( new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - OpenRocketLoaderActivity.this.finish(); - } - }); - dialogBuilder.create().show(); + dialogBuilder.setCancelable(true); + Dialog d = dialogBuilder.create(); + d.setCanceledOnTouchOutside(true); + d.show(); } else { CurrentRocketHolder.getCurrentRocket().setRocketDocument( result.rocket );