Wire in save for OpenRocketDocument.
This commit is contained in:
parent
00519d820a
commit
00696ce7a3
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_save"
|
||||
android:title="@string/save"/>
|
||||
<item
|
||||
android:id="@+id/motor_list_menu_option"
|
||||
android:icon="@drawable/ic_motorbrowser"
|
||||
|
2
android/src/build.properties
Normal file
2
android/src/build.properties
Normal file
@ -0,0 +1,2 @@
|
||||
build.version=12.03-droid-DEV
|
||||
build.source=source
|
@ -1,19 +1,25 @@
|
||||
package net.sf.openrocket.android;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.android.util.AndroidLogWrapper;
|
||||
import net.sf.openrocket.database.ComponentPresetDatabase;
|
||||
import net.sf.openrocket.document.OpenRocketDocument;
|
||||
import net.sf.openrocket.file.openrocket.OpenRocketSaver;
|
||||
import net.sf.openrocket.l10n.DebugTranslator;
|
||||
import net.sf.openrocket.l10n.ResourceBundleTranslator;
|
||||
import net.sf.openrocket.l10n.Translator;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class Application extends android.app.Application {
|
||||
|
||||
private OpenRocketDocument rocketDocument;
|
||||
private Uri fileUri;
|
||||
|
||||
private WarningSet warnings;
|
||||
|
||||
// Big B boolean so I can synchronize on it.
|
||||
@ -85,6 +91,17 @@ public class Application extends android.app.Application {
|
||||
this.warnings = warnings;
|
||||
}
|
||||
|
||||
public Uri getFileUri() {
|
||||
return fileUri;
|
||||
}
|
||||
|
||||
public void setFileUri(Uri fileUri) {
|
||||
this.fileUri = fileUri;
|
||||
}
|
||||
|
||||
public void saveOpenRocketDocument() throws IOException {
|
||||
OpenRocketSaver saver = new OpenRocketSaver();
|
||||
saver.save(new File(fileUri.getPath()),rocketDocument);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ implements TCQueryAction.OnTCQueryCompleteListener, OpenRocketLoaderFragment.OnO
|
||||
}
|
||||
|
||||
private void loadOrkFile( Uri file ) {
|
||||
((Application)getApplication()).setFileUri( file );
|
||||
AndroidLogWrapper.d(OpenRocketLoaderActivity.class,"Use ork file: " + file);
|
||||
String path = file.getPath();
|
||||
File orkFile = new File(path);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package net.sf.openrocket.android.rocket;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sf.openrocket.R;
|
||||
import net.sf.openrocket.android.ActivityHelpers;
|
||||
import net.sf.openrocket.android.Application;
|
||||
@ -55,6 +57,14 @@ implements Simulations.OnSimulationSelectedListener
|
||||
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||
AndroidLogWrapper.d(OpenRocketViewer.class,"onMenuItemSelected" + item.getItemId());
|
||||
switch(item.getItemId()) {
|
||||
case R.id.menu_save:
|
||||
// FIXME - Probably want to open a dialog here.
|
||||
try {
|
||||
((Application)getApplication()).saveOpenRocketDocument();
|
||||
} catch ( IOException iex ) {
|
||||
AndroidLogWrapper.d(OpenRocketViewer.class, iex.getMessage());
|
||||
}
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
ActivityHelpers.goHome(this);
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user