Populate the warning dialog with the messages. Fix the onCLick and onCancel to not finish the activity but instead make the workflow move on to the viewer.

This commit is contained in:
Kevin Ruland 2012-02-16 19:21:55 +00:00
parent f3602b1484
commit f5d3884ce9

View File

@ -1,5 +1,8 @@
package net.sf.openrocket.android.rocket;
import net.sf.openrocket.aerodynamics.Warning;
import net.sf.openrocket.aerodynamics.WarningSet;
import net.sf.openrocket.android.Application;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
@ -21,14 +24,20 @@ public class WarningDialogFragment extends DialogFragment {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// .setIcon(android.R.drawable.alert_dialog_icon)
builder.setTitle("Warnings");
WarningSet warnings = ((Application)(getActivity().getApplication())).getWarnings();
StringBuilder message = new StringBuilder();
for ( Warning w : warnings ) {
message.append(w.toString()).append("\n");
}
builder.setMessage(message.toString());
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
getActivity().finish();
((OpenRocketLoaderActivity)getActivity()).moveOnToViewer();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
getActivity().finish();
((OpenRocketLoaderActivity)getActivity()).moveOnToViewer();
}
});
return builder.create();