Second checkpoint commit of OpenRocketLoader to make it orientation change safe. Changed Main.java to register onclick listeners in java instead of the layout. Store the WarningSet in Application so it doesn't need to be serialized if the OpenRocketLoaderActivity is recreated during an orientation change. Fix the MissingMotorDialogFragment to only have the string and not the whole WarningSet. Finally completely rewrote the OpenRocketLoaderTask into a Fragment managing its own dialog.

This commit is contained in:
Kevin Ruland 2012-02-08 02:32:27 +00:00
parent 4780fb36b0
commit 21fb67f8d2

View File

@ -0,0 +1,35 @@
package net.sf.openrocket.android.util;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
public class ProgressDialogFragment extends DialogFragment {
public static ProgressDialogFragment newInstance(String title, String message) {
ProgressDialogFragment fragment = new ProgressDialogFragment();
Bundle args = new Bundle();
args.putString("title", title);
args.putString("message", message);
fragment.setArguments(args);
return fragment;
}
@Override
public ProgressDialog onCreateDialog(Bundle savedInstanceState) {
String title = getArguments().getString("title");
String message = getArguments().getString("message");
ProgressDialog progressDialog = new ProgressDialog(getActivity());
progressDialog.setTitle(title);
progressDialog.setMessage(message);
progressDialog.setCancelable(false);
progressDialog.show();
return progressDialog;
}
}