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.

This commit is contained in:
Kevin Ruland 2012-07-10 03:08:03 +00:00
parent d7d647d47d
commit 568b7aeb5d
2 changed files with 7 additions and 9 deletions

View File

@ -20,6 +20,7 @@
<string name="no">No</string>
<string name="yes">Yes</string>
<string name="autoSaveMessage">Automatically saving rocket</string>
<string name="loadingErrorMessage">Error Loading File</string>
<string-array name="PreferenceMotorBrowserGroupingEntries">
<item>Case</item>

View File

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