If the simulation doesn't have data, open the edit dialog instead of issuing a warning.
This commit is contained in:
parent
fed956e2b0
commit
dcb08b005b
@ -179,10 +179,7 @@ implements Simulations.OnSimulationSelectedListener, OpenRocketSaverFragment.OnO
|
||||
Simulation sim = CurrentRocketHolder.getCurrentRocket().getRocketDocument().getSimulation(simulationId);
|
||||
// Check if there is data for this simulation.
|
||||
if ( sim.getSimulatedData() == null || sim.getSimulatedData().getBranchCount() == 0 ) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage("The selected simulation does not have saved data.");
|
||||
builder.setCancelable(true);
|
||||
builder.show();
|
||||
// This shouldn't happen because the Simulations list does the check.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,11 @@ implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||
simulationList.setOnItemClickListener( new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView l, View v, int position, long id) {
|
||||
if (listener != null ) {
|
||||
Simulation sim = CurrentRocketHolder.getCurrentRocket().getRocketDocument().getSimulation(position);
|
||||
// Check if there is data for this simulation.
|
||||
if ( sim.getSimulatedData() == null || sim.getSimulatedData().getBranchCount() == 0 ) {
|
||||
openEditor(position);
|
||||
} else if (listener != null ) {
|
||||
listener.onSimulationSelected(position);
|
||||
}
|
||||
}
|
||||
@ -147,10 +151,7 @@ implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
final SimulationEditFragment f = SimulationEditFragment.newInstance(position);
|
||||
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
|
||||
ft.add(f, wizardFrag);
|
||||
ft.commit();
|
||||
openEditor(position);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -159,6 +160,13 @@ implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||
simulationList.setAdapter(sims);
|
||||
|
||||
}
|
||||
|
||||
private void openEditor( int position ) {
|
||||
final SimulationEditFragment f = SimulationEditFragment.newInstance(position);
|
||||
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
|
||||
ft.add(f, wizardFrag);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
private void addSimulation() {
|
||||
CurrentRocketHolder.getCurrentRocket().addNewSimulation();
|
||||
|
Loading…
x
Reference in New Issue
Block a user