Browse Source

Make things work!

master
Chris Smith 14 years ago
parent
commit
57166064c2

BIN
code/ContextHome/dist/ContextHome.apk View File


+ 17
- 11
code/ContextHome/src/uk/co/md87/android/contexthome/ContextHome.java View File

44
 
44
 
45
     private LinearLayout layout, fixedLayout;
45
     private LinearLayout layout, fixedLayout;
46
 
46
 
47
-    private final ContextType[] contexts = new ContextType[]{
48
-        new GlobalContext(), new HourContext(), new PeriodContext()
49
-    };
47
+    private ContextType[] contexts;
50
 
48
 
51
-    private final DataHelper helper = new DataHelper(this, Arrays.asList(contexts));
49
+    private DataHelper helper;
52
 
50
 
53
-    private final Module[] fixedModules = new Module[] {
54
-        new ContactsModule(helper), new AppsModule(helper)
55
-    };
56
-
57
-    private final Module[] modules = new Module[]{
58
-        new EmailModule(helper), new SmsModule(helper),
59
-    };
51
+    private Module[] modules, fixedModules;
60
 
52
 
61
     /** Called when the activity is first created. */
53
     /** Called when the activity is first created. */
62
     @Override
54
     @Override
63
     public void onCreate(Bundle icicle) {
55
     public void onCreate(Bundle icicle) {
64
         super.onCreate(icicle);
56
         super.onCreate(icicle);
65
 
57
 
58
+        contexts = new ContextType[]{
59
+            new GlobalContext(), new HourContext(), new PeriodContext()
60
+        };
61
+
62
+        helper = new DataHelper(this, Arrays.asList(contexts));
63
+
64
+        fixedModules = new Module[] {
65
+            new ContactsModule(helper), new AppsModule(helper)
66
+        };
67
+
68
+        modules = new Module[]{
69
+            new EmailModule(helper), new SmsModule(helper),
70
+        };
71
+
66
         setContentView(R.layout.container);
72
         setContentView(R.layout.container);
67
         
73
         
68
         layout = (LinearLayout) findViewById(R.id.content);
74
         layout = (LinearLayout) findViewById(R.id.content);

+ 2
- 1
code/ContextHome/src/uk/co/md87/android/contexthome/DataHelper.java View File

27
 import android.database.sqlite.SQLiteDatabase;
27
 import android.database.sqlite.SQLiteDatabase;
28
 import android.database.sqlite.SQLiteOpenHelper;
28
 import android.database.sqlite.SQLiteOpenHelper;
29
 import android.database.sqlite.SQLiteStatement;
29
 import android.database.sqlite.SQLiteStatement;
30
+import android.util.Log;
30
 
31
 
31
 import java.util.HashMap;
32
 import java.util.HashMap;
32
 import java.util.List;
33
 import java.util.List;
136
             db.execSQL("CREATE TABLE actions (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
137
             db.execSQL("CREATE TABLE actions (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
137
                     + "module TEXT, actiontype TEXT, actionvalue TEXT, contexttype TEXT, "
138
                     + "module TEXT, actiontype TEXT, actionvalue TEXT, contexttype TEXT, "
138
                     + "contextvalue TEXT, number INTEGER, UNIQUE (module, actiontype, "
139
                     + "contextvalue TEXT, number INTEGER, UNIQUE (module, actiontype, "
139
-                    + "actionvalue contexttype, contextvalue) "
140
+                    + "actionvalue, contexttype, contextvalue) "
140
                     + "ON CONFLICT IGNORE)");
141
                     + "ON CONFLICT IGNORE)");
141
         }
142
         }
142
 
143
 

Loading…
Cancel
Save