Add an example app which shows how to use the library.
diff --git a/example/build.gradle b/example/build.gradle
new file mode 100644
index 0000000..50d797e
--- /dev/null
+++ b/example/build.gradle
@@ -0,0 +1,19 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion "24.0.3"
+
+ defaultConfig {
+ applicationId "com.google.android.mobly.snippet.example"
+ minSdkVersion 11
+ targetSdkVersion 24
+ versionCode 1
+ versionName "0.0.1"
+ }
+}
+
+dependencies {
+ compile project(':third_party:sl4a')
+ compile 'com.android.support:appcompat-v7:24.2.1'
+}
diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..9f44186
--- /dev/null
+++ b/example/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.google.android.mobly.snippet.example">
+
+ <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme">
+
+ <meta-data
+ android:name="mobly-snippets"
+ android:value="com.google.android.mobly.snippet.example.ExampleSnippet,
+ com.google.android.mobly.snippet.example.ExampleSnippet2" />
+
+ <activity android:name=".MainActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/example/src/main/java/com/google/android/mobly/snippet/example/ExampleSnippet.java b/example/src/main/java/com/google/android/mobly/snippet/example/ExampleSnippet.java
new file mode 100644
index 0000000..56689a9
--- /dev/null
+++ b/example/src/main/java/com/google/android/mobly/snippet/example/ExampleSnippet.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.android.mobly.snippet.example;
+
+import android.content.Context;
+
+import com.google.android.mobly.snippet.rpc.Rpc;
+import com.google.android.mobly.snippet.rpc.Snippet;
+
+public class ExampleSnippet implements Snippet {
+ public ExampleSnippet(Context context) {}
+
+ @Rpc(description = "Returns the given integer with the prefix \"foo\"")
+ public String getFoo(Integer input) {
+ return "foo " + input;
+ }
+
+ @Override
+ public void shutdown() {}
+}
diff --git a/example/src/main/java/com/google/android/mobly/snippet/example/ExampleSnippet2.java b/example/src/main/java/com/google/android/mobly/snippet/example/ExampleSnippet2.java
new file mode 100644
index 0000000..38e779c
--- /dev/null
+++ b/example/src/main/java/com/google/android/mobly/snippet/example/ExampleSnippet2.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.android.mobly.snippet.example;
+
+import android.content.Context;
+
+import com.google.android.mobly.snippet.rpc.Rpc;
+import com.google.android.mobly.snippet.rpc.Snippet;
+
+public class ExampleSnippet2 implements Snippet {
+ public ExampleSnippet2(Context context) {}
+
+ @Rpc(description = "Returns the given string with the prefix \"bar\"")
+ public String getBar(String input) {
+ return "bar " + input;
+ }
+
+ @Override
+ public void shutdown() {}
+}
diff --git a/example/src/main/java/com/google/android/mobly/snippet/example/MainActivity.java b/example/src/main/java/com/google/android/mobly/snippet/example/MainActivity.java
new file mode 100644
index 0000000..48e9d26
--- /dev/null
+++ b/example/src/main/java/com/google/android/mobly/snippet/example/MainActivity.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.android.mobly.snippet.example;
+
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+
+public class MainActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ }
+}
diff --git a/example/src/main/res/layout/activity_main.xml b/example/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..986a64b
--- /dev/null
+++ b/example/src/main/res/layout/activity_main.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="com.google.android.mobly.snippet.example.MainActivity">
+
+ <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="Hello World!" />
+</RelativeLayout>
diff --git a/example/src/main/res/mipmap-hdpi/ic_launcher.png b/example/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
--- /dev/null
+++ b/example/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/example/src/main/res/mipmap-mdpi/ic_launcher.png b/example/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
--- /dev/null
+++ b/example/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/example/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
--- /dev/null
+++ b/example/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/example/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
--- /dev/null
+++ b/example/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
--- /dev/null
+++ b/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/example/src/main/res/values-w820dp/dimens.xml b/example/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/example/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
diff --git a/example/src/main/res/values/colors.xml b/example/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/example/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#3F51B5</color>
+ <color name="colorPrimaryDark">#303F9F</color>
+ <color name="colorAccent">#FF4081</color>
+</resources>
diff --git a/example/src/main/res/values/dimens.xml b/example/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/example/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/example/src/main/res/values/strings.xml b/example/src/main/res/values/strings.xml
new file mode 100644
index 0000000..1a686f2
--- /dev/null
+++ b/example/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="app_name">Mobly Snippet Example</string>
+</resources>
diff --git a/example/src/main/res/values/styles.xml b/example/src/main/res/values/styles.xml
new file mode 100644
index 0000000..daa2a5c
--- /dev/null
+++ b/example/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+
+</resources>
diff --git a/settings.gradle b/settings.gradle
index d74d0b5..260fefa 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':third_party:sl4a'
+include ':third_party:sl4a', ':example'