Skip to content

Commit dd82ba8

Browse files
author
Andreas Göransson
committed
Initial commit.
Added code, gitignore, and README.
0 parents  commit dd82ba8

23 files changed

+478
-0
lines changed

.gitignore

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#################
2+
## Eclipse
3+
#################
4+
5+
*.pydevproject
6+
.project
7+
.metadata
8+
bin/
9+
tmp/
10+
*.tmp
11+
*.bak
12+
*.swp
13+
*~.nib
14+
local.properties
15+
.classpath
16+
.settings/
17+
.loadpath
18+
19+
# External tool builders
20+
.externalToolBuilders/
21+
22+
# Locally stored "Eclipse launch configurations"
23+
*.launch
24+
25+
# CDT-specific
26+
.cproject
27+
28+
# PDT-specific
29+
.buildpath
30+
31+
32+
#################
33+
## Android
34+
#################
35+
36+
# built application files
37+
*.apk
38+
*.ap_
39+
40+
# files for the dex VM
41+
*.dex
42+
43+
# Java class files
44+
*.class
45+
46+
# generated files
47+
bin/
48+
gen/
49+
50+
# Local configuration file (sdk path, etc)
51+
local.properties
52+
53+
# Eclipse project files
54+
.classpath
55+
.project
56+
57+
# Proguard folder generated by Eclipse
58+
proguard/
59+
60+
# Intellij project files
61+
*.iml
62+
*.ipr
63+
*.iws
64+
.idea/
65+

AndroidManifest.xml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.wiley.aoa.basic.robot"
3+
android:versionCode="1"
4+
android:versionName="1.0" >
5+
6+
<uses-sdk
7+
android:minSdkVersion="8"
8+
android:targetSdkVersion="15" />
9+
10+
<uses-feature android:name="android.hardware.usb.accessory" />
11+
12+
<application
13+
android:icon="@drawable/ic_launcher"
14+
android:label="@string/app_name"
15+
android:theme="@style/AppTheme" >
16+
<activity
17+
android:name=".MainActivity"
18+
android:label="@string/title_activity_main" >
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
22+
<category android:name="android.intent.category.LAUNCHER" />
23+
24+
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
25+
</intent-filter>
26+
27+
<meta-data
28+
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
29+
android:resource="@xml/accessory_filter" />
30+
</activity>
31+
</application>
32+
33+
</manifest>

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Basic Robot
2+
3+
This Android project connects to, and controls, a very basic robot built with Arduino.
4+
5+
### Author/s
6+
7+
This project was written by Andreas Göransson and David Cuartielles for a book called Android Open Accessory Programming with Arduino.
8+
9+
## Getting the project...
10+
11+
1. **Clone** this repository to your development machine
12+
2. From the Eclipse menu, select **New** -> **Project**
13+
3. In the dialog, expand **Android** and select **Android Project From Existing code**
14+
4. **Browse** to the cloned repository root folder on your machine
15+
5. Click **Finish**
16+
17+
### If there are compilation errors
18+
19+
6. **Right-click** the **WroxAccessories** project in your Package Explorer and select **Properties**
20+
7. Set the **Build Target** to be **Google APIs** version **12**
21+
8. Click **OK**

ic_launcher-web.png

36.2 KB
Loading

libs/android-support-v4.jar

341 KB
Binary file not shown.

proguard-project.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}

project.properties

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=Google Inc.:Google APIs:16
15+
android.library.reference.1=../WroxAccessories
3.05 KB
Loading

res/drawable-hdpi/ic_launcher.png

3.84 KB
Loading

res/drawable-ldpi/ic_launcher.png

1.84 KB
Loading
2.96 KB
Loading

res/drawable-mdpi/ic_launcher.png

2.45 KB
Loading
3.12 KB
Loading

res/drawable-xhdpi/ic_launcher.png

5.22 KB
Loading

res/drawable/mybutton.xml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
3+
<item android:state_pressed="true">
4+
<shape android:shape="rectangle">
5+
<corners android:radius="5dp" />
6+
<solid android:color="#006363"/>
7+
<stroke android:width="2dp" android:color="#5CCCCC"/>
8+
<padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" />
9+
</shape>
10+
</item>
11+
12+
<item android:state_focused="true">
13+
<shape android:shape="rectangle">
14+
<corners android:radius="5dp" />
15+
<solid android:color="#006363"/>
16+
<stroke android:width="2dp" android:color="#5CCCCC"/>
17+
<padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" />
18+
</shape>
19+
</item>
20+
21+
<item>
22+
<shape android:shape="rectangle">
23+
<corners android:radius="5dp" />
24+
<solid android:color="#009999"/>
25+
<stroke android:width="2dp" android:color="#5CCCCC"/>
26+
<padding android:left="5dp" android:top="5dp" android:right="5dp" android:bottom="5dp" />
27+
</shape>
28+
</item>
29+
</selector>

res/layout/activity_main.xml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:layout_alignParentLeft="true"
6+
android:layout_alignParentTop="true"
7+
android:orientation="vertical" >
8+
9+
<LinearLayout
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"
12+
android:layout_weight="1" >
13+
14+
<View
15+
android:id="@+id/view1"
16+
android:layout_width="match_parent"
17+
android:layout_height="match_parent"
18+
android:layout_weight="1" />
19+
20+
<Button
21+
android:id="@+id/button_north"
22+
android:layout_width="match_parent"
23+
android:layout_height="match_parent"
24+
android:layout_margin="2dp"
25+
android:layout_weight="1"
26+
android:background="@drawable/mybutton"
27+
android:text="@string/north"
28+
android:onClick="forward" />
29+
30+
<View
31+
android:id="@+id/view2"
32+
android:layout_width="match_parent"
33+
android:layout_height="match_parent"
34+
android:layout_weight="1" />
35+
</LinearLayout>
36+
37+
<LinearLayout
38+
android:layout_width="match_parent"
39+
android:layout_height="match_parent"
40+
android:layout_weight="1" >
41+
42+
<Button
43+
android:id="@+id/button_west"
44+
android:layout_width="match_parent"
45+
android:layout_height="match_parent"
46+
android:layout_margin="2dp"
47+
android:layout_weight="1"
48+
android:background="@drawable/mybutton"
49+
android:text="@string/west"
50+
android:onClick="left" />
51+
52+
<Button
53+
android:id="@+id/button_stop"
54+
android:layout_width="match_parent"
55+
android:layout_height="match_parent"
56+
android:layout_margin="2dp"
57+
android:layout_weight="1"
58+
android:background="@drawable/mybutton"
59+
android:text="@string/stop"
60+
android:onClick="stop" />
61+
62+
<Button
63+
android:id="@+id/button_east"
64+
android:layout_width="match_parent"
65+
android:layout_height="match_parent"
66+
android:layout_margin="2dp"
67+
android:layout_weight="1"
68+
android:background="@drawable/mybutton"
69+
android:text="@string/east"
70+
android:onClick="right" />
71+
</LinearLayout>
72+
73+
<LinearLayout
74+
android:layout_width="match_parent"
75+
android:layout_height="match_parent"
76+
android:layout_weight="1" >
77+
78+
<View
79+
android:id="@+id/view3"
80+
android:layout_width="match_parent"
81+
android:layout_height="match_parent"
82+
android:layout_weight="1" />
83+
84+
<Button
85+
android:id="@+id/button_south"
86+
android:layout_width="match_parent"
87+
android:layout_height="match_parent"
88+
android:layout_margin="2dp"
89+
android:layout_weight="1"
90+
android:background="@drawable/mybutton"
91+
android:text="@string/south"
92+
android:onClick="backward" />
93+
94+
<View
95+
android:id="@+id/view4"
96+
android:layout_width="match_parent"
97+
android:layout_height="match_parent"
98+
android:layout_weight="1" />
99+
</LinearLayout>
100+
101+
</LinearLayout>

res/menu/activity_main.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android">
2+
<item android:id="@+id/menu_settings"
3+
android:title="@string/menu_settings"
4+
android:orderInCategory="100"
5+
android:showAsAction="never" />
6+
</menu>

res/values-v11/styles.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Holo.Light" />
4+
5+
</resources>

res/values-v14/styles.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
4+
5+
<string name="app_name">Basic Robot</string>
6+
<string name="hello_world">Hello world!</string>
7+
<string name="menu_settings">Settings</string>
8+
<string name="title_activity_main">Basic Robot</string>
9+
<string name="forward">forward</string>
10+
<string name="stop">stop</string>
11+
<string name="the_basic_robot">The Basic Robot</string>
12+
13+
<string name="north">forward</string>
14+
<string name="east">right</string>
15+
<string name="stop">stop</string>
16+
<string name="west">left</string>
17+
<string name="south">back</string>
18+
19+
20+
</resources>

res/values/strings.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<resources>
2+
3+
<string name="app_name">Basic Robot</string>
4+
<string name="hello_world">Hello world!</string>
5+
<string name="menu_settings">Settings</string>
6+
<string name="title_activity_main">Basic Robot</string>
7+
<string name="forward">forward</string>
8+
<string name="stop">stop</string>
9+
<string name="the_basic_robot">The Basic Robot</string>
10+
11+
<string name="north">forward</string>
12+
<string name="east">right</string>
13+
<string name="stop">stop</string>
14+
<string name="west">left</string>
15+
<string name="south">back</string>
16+
17+
</resources>

res/values/styles.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<resources>
2+
3+
<style name="AppTheme" parent="android:Theme.Light" />
4+
5+
</resources>

res/xml/accessory_filter.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<usb-accessory manufacturer="Wiley" model="Basic Robot" version="1.0" />
4+
</resources>

0 commit comments

Comments
 (0)