Преглед на файлове

Add skeleton apps module

master
Chris Smith преди 14 години
родител
ревизия
00bd9a3dd3

Двоични данни
code/ContextHome/dist/ContextHome.apk Целия файл


+ 11
- 0
code/ContextHome/res/layout/scroller.xml Целия файл

@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3
+        android:layout_width="fill_parent"
4
+        android:layout_height="wrap_content"
5
+        android:scrollbars="none">
6
+    <LinearLayout
7
+        android:id="@+id/content"
8
+        android:layout_width="fill_parent"
9
+        android:layout_height="fill_parent"
10
+        android:orientation="horizontal"/>
11
+</HorizontalScrollView>

+ 2
- 1
code/ContextHome/src/uk/co/md87/android/contexthome/ContextHome.java Целия файл

@@ -26,6 +26,7 @@ import android.app.Activity;
26 26
 import android.os.Bundle;
27 27
 import android.widget.LinearLayout.LayoutParams;
28 28
 import android.widget.LinearLayout;
29
+import uk.co.md87.android.contexthome.modules.AppsModule;
29 30
 import uk.co.md87.android.contexthome.modules.EmailModule;
30 31
 import uk.co.md87.android.contexthome.modules.SmsModule;
31 32
 
@@ -42,7 +43,7 @@ public class ContextHome extends Activity {
42 43
 
43 44
     private LinearLayout layout;
44 45
     private final Module[] modules = new Module[]{
45
-        new SmsModule(), new EmailModule(), new SmsModule(), new SmsModule(),
46
+        new AppsModule(), new SmsModule(), new EmailModule(), new SmsModule(),
46 47
     };
47 48
 
48 49
     /** Called when the activity is first created. */

+ 6
- 4
code/ContextHome/src/uk/co/md87/android/contexthome/R.java Целия файл

@@ -15,12 +15,14 @@ public final class R {
15 15
         public static final int icon=0x7f020001;
16 16
     }
17 17
     public static final class id {
18
-        public static final int body=0x7f050002;
19
-        public static final int image=0x7f050000;
20
-        public static final int title=0x7f050001;
18
+        public static final int body=0x7f050003;
19
+        public static final int content=0x7f050000;
20
+        public static final int image=0x7f050001;
21
+        public static final int title=0x7f050002;
21 22
     }
22 23
     public static final class layout {
23
-        public static final int titledimage=0x7f030000;
24
+        public static final int scroller=0x7f030000;
25
+        public static final int titledimage=0x7f030001;
24 26
     }
25 27
     public static final class string {
26 28
         public static final int app_name=0x7f040000;

+ 54
- 0
code/ContextHome/src/uk/co/md87/android/contexthome/modules/AppsModule.java Целия файл

@@ -0,0 +1,54 @@
1
+/*
2
+ * Copyright (c) 2009-2010 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package uk.co.md87.android.contexthome.modules;
24
+
25
+import android.content.Context;
26
+import android.view.View;
27
+import android.widget.ImageView;
28
+import android.widget.LinearLayout;
29
+import uk.co.md87.android.contexthome.Module;
30
+import uk.co.md87.android.contexthome.R;
31
+
32
+/**
33
+ * A module which displays application shortcuts.
34
+ *
35
+ * @author chris
36
+ */
37
+public class AppsModule implements Module {
38
+
39
+    /** {@inheritDoc} */
40
+    @Override
41
+    public View getView(final Context context, final int weight) {
42
+        final View view = View.inflate(context, R.layout.scroller, null);
43
+        final LinearLayout layout = (LinearLayout) view.findViewById(R.id.content);
44
+
45
+        for (int i = 0; i < 20; i++) {
46
+            final ImageView image = new ImageView(context);
47
+            image.setImageResource(R.drawable.blank);
48
+            layout.addView(image, 48, 48);
49
+        }
50
+
51
+        return view;
52
+    }
53
+
54
+}

Loading…
Отказ
Запис