If there is no branch data in a simulation, display a dialog and don't try to show anything.
This commit is contained in:
parent
216ba1dd00
commit
58d89c7c27
@ -10,6 +10,7 @@ import net.sf.openrocket.android.simulation.SimulationFragment;
|
|||||||
import net.sf.openrocket.android.simulation.SimulationViewActivity;
|
import net.sf.openrocket.android.simulation.SimulationViewActivity;
|
||||||
import net.sf.openrocket.android.util.AndroidLogWrapper;
|
import net.sf.openrocket.android.util.AndroidLogWrapper;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
@ -69,9 +70,19 @@ implements Simulations.OnSimulationSelectedListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSimulationSelected(int simulationId) {
|
public void onSimulationSelected(int simulationId) {
|
||||||
|
|
||||||
|
Simulation sim = app.getRocketDocument().getSimulation(simulationId);
|
||||||
|
// Check if there is data for this simulation.
|
||||||
|
if ( 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();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
View sidepane = findViewById(R.id.sidepane);
|
View sidepane = findViewById(R.id.sidepane);
|
||||||
if ( /* if multi pane */ sidepane != null ) {
|
if ( /* if multi pane */ sidepane != null ) {
|
||||||
Simulation sim = app.getRocketDocument().getSimulation(simulationId);
|
|
||||||
SimulationChart chart = new SimulationChart(simulationId);
|
SimulationChart chart = new SimulationChart(simulationId);
|
||||||
|
|
||||||
Fragment graph = SimulationFragment.newInstance(chart);
|
Fragment graph = SimulationFragment.newInstance(chart);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user