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