1 package net.sf.openrocket.android;
\r
3 import java.util.Locale;
\r
5 import net.sf.openrocket.aerodynamics.WarningSet;
\r
6 import net.sf.openrocket.android.util.AndroidLogWrapper;
\r
7 import net.sf.openrocket.document.OpenRocketDocument;
\r
8 import net.sf.openrocket.l10n.DebugTranslator;
\r
9 import net.sf.openrocket.l10n.ResourceBundleTranslator;
\r
10 import net.sf.openrocket.l10n.Translator;
\r
11 import android.preference.PreferenceManager;
\r
13 public class Application extends android.app.Application {
\r
15 private OpenRocketDocument rocketDocument;
\r
16 private WarningSet warnings;
\r
18 // Big B boolean so I can synchronize on it.
\r
19 private static Boolean initialized = false;
\r
21 public void initialize() {
\r
22 synchronized (initialized) {
\r
23 if ( initialized == true ) {
\r
27 // Android does not have a default sax parser set. This needs to be defined first.
\r
28 System.setProperty("org.xml.sax.driver","org.xmlpull.v1.sax2.Driver");
\r
30 net.sf.openrocket.startup.Application.setLogger( new AndroidLogWrapper.LogHelper() );
\r
32 net.sf.openrocket.startup.Application.setPreferences( new PreferencesAdapter() );
\r
34 MotorDatabaseAdapter db = new MotorDatabaseAdapter(this);
\r
36 net.sf.openrocket.startup.Application.setMotorSetDatabase(db);
\r
39 t = new ResourceBundleTranslator("l10n.messages");
\r
40 if (Locale.getDefault().getLanguage().equals("xx")) {
\r
41 t = new DebugTranslator(t);
\r
44 net.sf.openrocket.startup.Application.setBaseTranslator(t);
\r
50 public Application() {
\r
54 * @see android.app.Application#onCreate()
\r
57 public void onCreate() {
\r
60 PreferencesActivity.initializePreferences(this, PreferenceManager.getDefaultSharedPreferences(this));
\r
64 * @return the rocketDocument
\r
66 public OpenRocketDocument getRocketDocument() {
\r
67 return rocketDocument;
\r
71 * @param rocketDocument the rocketDocument to set
\r
73 public void setRocketDocument(OpenRocketDocument rocketDocument) {
\r
74 this.rocketDocument = rocketDocument;
\r
77 public WarningSet getWarnings() {
\r
81 public void setWarnings(WarningSet warnings) {
\r
82 this.warnings = warnings;
\r