Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / android / src / net / sf / openrocket / android / Application.java
index 6a13a7bf5f5acd70d482b0a3f62a0b3319677d90..9661f400dd3e84f0b534f5d608397d48252fd4ad 100644 (file)
@@ -3,19 +3,18 @@ package net.sf.openrocket.android;
 import java.util.Locale;\r
 \r
 import net.sf.openrocket.android.util.AndroidLogWrapper;\r
-import net.sf.openrocket.document.OpenRocketDocument;\r
+import net.sf.openrocket.database.ComponentPresetDatabase;\r
 import net.sf.openrocket.l10n.DebugTranslator;\r
 import net.sf.openrocket.l10n.ResourceBundleTranslator;\r
 import net.sf.openrocket.l10n.Translator;\r
+import android.content.pm.ApplicationInfo;\r
 import android.preference.PreferenceManager;\r
 \r
 public class Application extends android.app.Application {\r
 \r
-       private OpenRocketDocument rocketDocument;\r
-       \r
        // Big B boolean so I can synchronize on it.\r
        private static Boolean initialized = false;\r
-       \r
+\r
        public void initialize() {\r
                synchronized (initialized) {\r
                        if ( initialized == true ) {\r
@@ -26,19 +25,26 @@ public class Application extends android.app.Application {
                        System.setProperty("org.xml.sax.driver","org.xmlpull.v1.sax2.Driver");\r
 \r
                        net.sf.openrocket.startup.Application.setLogger( new AndroidLogWrapper.LogHelper() );\r
-                       \r
+\r
                        net.sf.openrocket.startup.Application.setPreferences( new PreferencesAdapter() );\r
-                       \r
+\r
+                       net.sf.openrocket.startup.Application.setComponentPresetDao( new ComponentPresetDatabase(){\r
+                               @Override\r
+                               protected void load() {\r
+                                       // We don't need components\r
+                               } \r
+                       } );\r
+\r
                        MotorDatabaseAdapter db = new MotorDatabaseAdapter(this);\r
 \r
                        net.sf.openrocket.startup.Application.setMotorSetDatabase(db);\r
-                       \r
+\r
                        Translator t;\r
                        t = new ResourceBundleTranslator("l10n.messages");\r
                        if (Locale.getDefault().getLanguage().equals("xx")) {\r
                                t = new DebugTranslator(t);\r
                        }\r
-                       \r
+\r
                        net.sf.openrocket.startup.Application.setBaseTranslator(t);\r
 \r
                        initialized = true;\r
@@ -55,23 +61,9 @@ public class Application extends android.app.Application {
        public void onCreate() {\r
                super.onCreate();\r
                initialize();\r
+               boolean isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));\r
+               AndroidLogWrapper.setLogEnabled(isDebuggable);\r
                PreferencesActivity.initializePreferences(this, PreferenceManager.getDefaultSharedPreferences(this));\r
        }\r
 \r
-       /**\r
-        * @return the rocketDocument\r
-        */\r
-       public OpenRocketDocument getRocketDocument() {\r
-               return rocketDocument;\r
-       }\r
-\r
-       /**\r
-        * @param rocketDocument the rocketDocument to set\r
-        */\r
-       public void setRocketDocument(OpenRocketDocument rocketDocument) {\r
-               this.rocketDocument = rocketDocument;\r
-       }\r
-       \r
-       \r
-       \r
 }\r