This commit is contained in:
parent
3390179658
commit
bbec3f7dbd
@ -37,6 +37,8 @@ implements Simulations.OnSimulationSelectedListener
|
||||
private final static int TABSIZE = 4;
|
||||
|
||||
private OpenRocketViewerPagerAdapter viewPagerAdapter;
|
||||
|
||||
private MenuItem saveAction;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -78,6 +80,7 @@ implements Simulations.OnSimulationSelectedListener
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getSupportMenuInflater();
|
||||
inflater.inflate(R.menu.rocket_viewer_option_menu, menu);
|
||||
saveAction = menu.findItem(R.id.menu_save);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -93,6 +96,8 @@ implements Simulations.OnSimulationSelectedListener
|
||||
// FIXME - Probably want to open a dialog here.
|
||||
try {
|
||||
CurrentRocketHolder.getCurrentRocket().saveOpenRocketDocument();
|
||||
saveAction.setVisible(false);
|
||||
invalidateOptionsMenu();
|
||||
} catch ( IOException iex ) {
|
||||
AndroidLogWrapper.d(OpenRocketViewer.class, iex.getMessage());
|
||||
}
|
||||
@ -149,10 +154,13 @@ implements Simulations.OnSimulationSelectedListener
|
||||
}
|
||||
|
||||
private class RocketChangedEventHandler extends net.sf.openrocket.android.RocketChangedEventHandler {
|
||||
|
||||
|
||||
@Override
|
||||
protected void doSimsChanged() {
|
||||
if (saveAction != null ) {
|
||||
saveAction.setVisible(true);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
Simulations sims = (Simulations) viewPagerAdapter.getFragmentAtPos(SIMS_POS);
|
||||
if ( sims != null ) {
|
||||
sims.refreshSimulationList();
|
||||
@ -161,6 +169,10 @@ implements Simulations.OnSimulationSelectedListener
|
||||
|
||||
@Override
|
||||
protected void doMotorConfigsChanged() {
|
||||
if (saveAction != null ) {
|
||||
saveAction.setVisible(true);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
Configurations configs = (Configurations) viewPagerAdapter.getFragmentAtPos(CONFIGS_POS);
|
||||
if ( configs != null ) {
|
||||
configs.refreshConfigsList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user