-/**\r
- * Copyright (C) 2009, 2010 SC 4ViewSoft SRL\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
package net.sf.openrocket.android.simulation;\r
\r
-import net.sf.openrocket.android.Application;\r
+import net.sf.openrocket.R;\r
+import net.sf.openrocket.android.ActivityHelpers;\r
+import net.sf.openrocket.android.CurrentRocketHolder;\r
import net.sf.openrocket.document.OpenRocketDocument;\r
import net.sf.openrocket.document.Simulation;\r
import android.os.Bundle;\r
import android.support.v4.app.Fragment;\r
-import android.support.v4.app.FragmentActivity;\r
import android.support.v4.app.FragmentTransaction;\r
\r
+import com.actionbarsherlock.app.SherlockFragmentActivity;\r
+import com.actionbarsherlock.view.Menu;\r
+import com.actionbarsherlock.view.MenuItem;\r
+\r
/**\r
* An activity that encapsulates a graphical view of the chart.\r
*/\r
-public class SimulationViewActivity extends FragmentActivity {\r
+public class SimulationViewActivity extends SherlockFragmentActivity {\r
\r
@Override\r
protected void onCreate(Bundle savedInstanceState) {\r
//setContentView(R.layout.simulation_graph_activity);\r
int simulationNumber = getIntent().getIntExtra("Simulation", 0);\r
\r
- final OpenRocketDocument rocketDocument = ((Application)getApplication()).getRocketDocument();\r
+ final OpenRocketDocument rocketDocument = CurrentRocketHolder.getCurrentRocket().getRocketDocument();\r
\r
Simulation sim = rocketDocument.getSimulation(simulationNumber);\r
- \r
+\r
SimulationChart chart = new SimulationChart( simulationNumber);\r
chart.setSeries1(sim.getSimulatedData().getBranch(0).getTypes()[1]);\r
chart.setSeries2(sim.getSimulatedData().getBranch(0).getTypes()[2]);\r
\r
- Fragment graph = SimulationFragment.newInstance(chart);\r
+ Fragment graph = SimulationViewFragment.newInstance(chart);\r
\r
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();\r
- ft.add(android.R.id.content, graph);\r
+ ft.replace(android.R.id.content, graph);\r
ft.commit();\r
}\r
\r
+ @Override\r
+ public boolean onMenuItemSelected(int featureId, MenuItem item) {\r
+ switch (item.getItemId()) {\r
+ case R.id.preference_menu_option:\r
+ ActivityHelpers.startPreferences(this);\r
+ return true;\r
+ }\r
+ return super.onMenuItemSelected(featureId, item);\r
+ }\r
+\r
+ @Override\r
+ public boolean onCreateOptionsMenu(Menu menu) {\r
+ MenuItem prefItem = menu.add(Menu.NONE, R.id.preference_menu_option, Menu.CATEGORY_SYSTEM, R.string.Preferences);\r
+ prefItem.setIcon(R.drawable.ic_menu_preferences);\r
+ return true;\r
+ }\r
+\r
}
\ No newline at end of file