The only way I found to get the exp4j classes to be built and included in the apk...
[debian/openrocket] / android / src / net / sf / openrocket / android / simservice / SimulationService.java
index dad46292f683f2d5e2f703212f02717167aec792..9a1dd49116a3e08960e81a433537ef7cb5144bf9 100644 (file)
@@ -1,10 +1,15 @@
 package net.sf.openrocket.android.simservice;\r
 \r
+import java.util.List;\r
+\r
 import net.sf.openrocket.R;\r
 import net.sf.openrocket.android.CurrentRocketHolder;\r
 import net.sf.openrocket.android.util.AndroidLogWrapper;\r
 import net.sf.openrocket.document.Simulation;\r
+import net.sf.openrocket.simulation.customexpression.CustomExpression;\r
+import net.sf.openrocket.simulation.customexpression.CustomExpressionSimulationListener;\r
 import net.sf.openrocket.simulation.exception.SimulationException;\r
+import net.sf.openrocket.simulation.listeners.SimulationListener;\r
 import android.app.IntentService;\r
 import android.app.Notification;\r
 import android.app.PendingIntent;\r
@@ -23,6 +28,8 @@ public class SimulationService extends IntentService {
        public static void executeSimulationTask( Context c, SimulationTask t ) {\r
                AndroidLogWrapper.d(SimulationService.class, "Submitting simulation " + t.simulationId );\r
 \r
+               CurrentRocketHolder.getCurrentRocket().lockSimulation( c, t.simulationId );\r
+               \r
                Intent intent = new Intent( c, SimulationService.class );\r
                intent.putExtra("net.sf.openrocket.simulationtask", t);\r
                c.startService(intent);\r
@@ -37,9 +44,13 @@ public class SimulationService extends IntentService {
                SimulationTask t = (SimulationTask) intent.getSerializableExtra("net.sf.openrocket.simulationtask");\r
                try {\r
                        Simulation sim = CurrentRocketHolder.getCurrentRocket().getRocketDocument().getSimulation(t.simulationId);\r
+\r
+                       List<CustomExpression> exprs = CurrentRocketHolder.getCurrentRocket().getRocketDocument().getCustomExpressions();\r
+                       SimulationListener exprListener = new CustomExpressionSimulationListener(exprs);\r
+\r
                        AndroidLogWrapper.d(SimulationService.class, "simulating " + t.simulationId );\r
-                       sim.simulate();\r
-                       CurrentRocketHolder.getCurrentRocket().notifySimsChanged();\r
+                       sim.simulate(exprListener);\r
+                       CurrentRocketHolder.getCurrentRocket().unlockSimulation(this, t.simulationId);\r
                }\r
                catch (SimulationException simex) {\r
                        Toast.makeText(this, "Error in simulation:" + simex.getMessage(), Toast.LENGTH_LONG ).show();\r