ソースを参照

Make things work!

master
Chris Smith 14年前
コミット
57166064c2

バイナリ
code/ContextHome/dist/ContextHome.apk ファイルの表示


+ 17
- 11
code/ContextHome/src/uk/co/md87/android/contexthome/ContextHome.java ファイルの表示

@@ -44,25 +44,31 @@ public class ContextHome extends Activity {
44 44
 
45 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 53
     /** Called when the activity is first created. */
62 54
     @Override
63 55
     public void onCreate(Bundle icicle) {
64 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 72
         setContentView(R.layout.container);
67 73
         
68 74
         layout = (LinearLayout) findViewById(R.id.content);

+ 2
- 1
code/ContextHome/src/uk/co/md87/android/contexthome/DataHelper.java ファイルの表示

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

読み込み中…
キャンセル
保存