aboutsummaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-10 14:11:27 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-10 14:11:27 -0800
commitd23f92585705942c70e3e4308f800ffe5f416ca9 (patch)
tree88a31483e0c823a5f05c34aadfaa3b2271d4a620 /example
parent9342e50fcb0f6f44f6f7372a30278a39d63557d8 (diff)
Added example for Android
Diffstat (limited to 'example')
-rw-r--r--example/android/AndroidExample/.gitignore6
-rw-r--r--example/android/AndroidExample/AndroidExample.iml21
-rw-r--r--example/android/AndroidExample/app/.gitignore1
-rw-r--r--example/android/AndroidExample/app/app.iml91
-rw-r--r--example/android/AndroidExample/app/build.gradle35
-rw-r--r--example/android/AndroidExample/app/proguard-rules.pro17
-rw-r--r--example/android/AndroidExample/app/src/main/AndroidManifest.xml49
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java18
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java70
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java84
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java87
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java191
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java34
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 19388 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml23
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml7
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/values-v21/styles.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/dimens.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/strings.xml8
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml15
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/styles.xml8
-rw-r--r--example/android/AndroidExample/build.gradle19
-rw-r--r--example/android/AndroidExample/gradle.properties18
-rw-r--r--example/android/AndroidExample/gradle/wrapper/gradle-wrapper.jarbin0 -> 49896 bytes
-rw-r--r--example/android/AndroidExample/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xexample/android/AndroidExample/gradlew164
-rw-r--r--example/android/AndroidExample/gradlew.bat90
-rw-r--r--example/android/AndroidExample/settings.gradle1
33 files changed, 1083 insertions, 0 deletions
diff --git a/example/android/AndroidExample/.gitignore b/example/android/AndroidExample/.gitignore
new file mode 100644
index 00000000..afbdab33
--- /dev/null
+++ b/example/android/AndroidExample/.gitignore
@@ -0,0 +1,6 @@
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
diff --git a/example/android/AndroidExample/AndroidExample.iml b/example/android/AndroidExample/AndroidExample.iml
new file mode 100644
index 00000000..2a022014
--- /dev/null
+++ b/example/android/AndroidExample/AndroidExample.iml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="java-gradle" name="Java-Gradle">
+ <configuration>
+ <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/build/classes/main" />
+ <output-test url="file://$MODULE_DIR$/build/classes/test" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
+
diff --git a/example/android/AndroidExample/app/.gitignore b/example/android/AndroidExample/app/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/example/android/AndroidExample/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/example/android/AndroidExample/app/app.iml b/example/android/AndroidExample/app/app.iml
new file mode 100644
index 00000000..cdd2cdf5
--- /dev/null
+++ b/example/android/AndroidExample/app/app.iml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="android-gradle" name="Android-Gradle">
+ <configuration>
+ <option name="GRADLE_PROJECT_PATH" value=":app" />
+ </configuration>
+ </facet>
+ <facet type="android" name="Android">
+ <configuration>
+ <option name="SELECTED_BUILD_VARIANT" value="debug" />
+ <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+ <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
+ <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
+ <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
+ <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
+ <option name="ALLOW_USER_CONFIGURATION" value="false" />
+ <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
+ <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
+ <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
+ <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+ <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+ </content>
+ <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" exported="" name="support-annotations-21.0.2" level="project" />
+ <orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
+ <orderEntry type="library" exported="" name="support-v4-21.0.2" level="project" />
+ <orderEntry type="library" exported="" name="appcompat-v7-21.0.2" level="project" />
+ </component>
+</module>
+
diff --git a/example/android/AndroidExample/app/build.gradle b/example/android/AndroidExample/app/build.gradle
new file mode 100644
index 00000000..54a946ef
--- /dev/null
+++ b/example/android/AndroidExample/app/build.gradle
@@ -0,0 +1,35 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.1"
+
+ defaultConfig {
+ applicationId "com.libmailcore.androidexample"
+ minSdkVersion 21
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+repositories {
+ flatDir {
+ dirs 'libs'
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile(name: 'mailcore2-android-1', ext: 'aar')
+ compile 'com.android.support:support-v4:21.0.2'
+ compile 'com.google.android.gms:play-services:6.5.87'
+ compile 'com.android.support:appcompat-v7:21.0.2'
+}
diff --git a/example/android/AndroidExample/app/proguard-rules.pro b/example/android/AndroidExample/app/proguard-rules.pro
new file mode 100644
index 00000000..3c2c65b2
--- /dev/null
+++ b/example/android/AndroidExample/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/hoa/Android/android-sdk-macosx/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/example/android/AndroidExample/app/src/main/AndroidManifest.xml b/example/android/AndroidExample/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..58481ab8
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/AndroidManifest.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.libmailcore.androidexample" >
+
+ <!-- To access Google+ APIs: -->
+ <uses-permission android:name="android.permission.INTERNET" />
+ <!--
+ To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
+ option is required to comply with the Google+ Sign-In developer policies
+ -->
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <!-- To retrieve the account name (email) as part of sign-in: -->
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- To auto-complete the email text field in the login form with the user's emails -->
+ <uses-permission android:name="android.permission.READ_PROFILE" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MessageViewListActivity"
+ android:label="@string/title_messageview_list" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".MessageViewDetailActivity"
+ android:label="@string/title_messageview_detail"
+ android:parentActivityName=".MessageViewListActivity" >
+ <meta-data
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value="com.libmailcore.androidexample.MessageViewListActivity" />
+ </activity>
+ <activity
+ android:name=".LoginActivity"
+ android:label="@string/title_activity_login"
+ android:windowSoftInputMode="adjustResize|stateHidden" >
+ </activity>
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+ </application>
+
+</manifest>
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java
new file mode 100644
index 00000000..86781ce6
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java
@@ -0,0 +1,18 @@
+package com.libmailcore.androidexample;
+
+import com.libmailcore.IMAPMessage;
+
+/**
+ * Created by hoa on 1/9/15.
+ */
+public class MessageAdapter {
+ IMAPMessage message;
+
+ public MessageAdapter(IMAPMessage msg) {
+ message = msg;
+ }
+
+ public String toString() {
+ return message.header().from().displayName() + " " + message.header().extractedSubject();
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java
new file mode 100644
index 00000000..e12f71b1
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java
@@ -0,0 +1,70 @@
+package com.libmailcore.androidexample;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.app.Activity;
+
+import android.view.MenuItem;
+
+
+/**
+ * An activity representing a single MessageView detail screen. This
+ * activity is only used on handset devices. On tablet-size devices,
+ * item details are presented side-by-side with a list of items
+ * in a {@link MessageViewListActivity}.
+ * <p/>
+ * This activity is mostly just a 'shell' activity containing nothing
+ * more than a {@link MessageViewDetailFragment}.
+ */
+public class MessageViewDetailActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_messageview_detail);
+
+ // Show the Up button in the action bar.
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+
+ // savedInstanceState is non-null when there is fragment state
+ // saved from previous configurations of this activity
+ // (e.g. when rotating the screen from portrait to landscape).
+ // In this case, the fragment will automatically be re-added
+ // to its container so we don't need to manually add it.
+ // For more information, see the Fragments API guide at:
+ //
+ // http://developer.android.com/guide/components/fragments.html
+ //
+ if (savedInstanceState == null) {
+ // Create the detail fragment and add it to the activity
+ // using a fragment transaction.
+ /*
+ Bundle arguments = new Bundle();
+ arguments.putString(MessageViewDetailFragment.ARG_ITEM_ID,
+ getIntent().getStringExtra(MessageViewDetailFragment.ARG_ITEM_ID));
+ */
+
+ MessageViewDetailFragment fragment = new MessageViewDetailFragment();
+ //fragment.setArguments(arguments);
+ getFragmentManager().beginTransaction()
+ .add(R.id.messageview_detail_container, fragment)
+ .commit();
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+ if (id == android.R.id.home) {
+ // This ID represents the Home or Up button. In the case of this
+ // activity, the Up button is shown. For
+ // more details, see the Navigation pattern on Android Design:
+ //
+ // http://developer.android.com/design/patterns/navigation.html#up-vs-back
+ //
+ navigateUpTo(new Intent(this, MessageViewListActivity.class));
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java
new file mode 100644
index 00000000..4fd80282
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java
@@ -0,0 +1,84 @@
+package com.libmailcore.androidexample;
+
+import android.os.Bundle;
+import android.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebView;
+import android.util.Log;
+
+
+import com.libmailcore.MailException;
+import com.libmailcore.OperationCallback;
+import com.libmailcore.IMAPMessage;
+import com.libmailcore.IMAPMessageRenderingOperation;
+
+/**
+ * A fragment representing a single MessageView detail screen.
+ * This fragment is either contained in a {@link MessageViewListActivity}
+ * in two-pane mode (on tablets) or a {@link MessageViewDetailActivity}
+ * on handsets.
+ */
+public class MessageViewDetailFragment extends Fragment implements OperationCallback {
+ /**
+ * The fragment argument representing the item ID that this fragment
+ * represents.
+ */
+ public static final String ARG_ITEM_ID = "item_id";
+
+ /**
+ * The dummy content this fragment is presenting.
+ */
+ //private DummyContent.DummyItem mItem;
+ private IMAPMessage message;
+
+ /**
+ * Mandatory empty constructor for the fragment manager to instantiate the
+ * fragment (e.g. upon screen orientation changes).
+ */
+ public MessageViewDetailFragment() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ /*
+ if (getArguments().containsKey(ARG_ITEM_ID)) {
+ // Load the dummy content specified by the fragment
+ // arguments. In a real-world scenario, use a Loader
+ // to load content from a content provider.
+ mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
+ }
+ */
+ message = MessagesSyncManager.singleton().currentMessage;
+ }
+
+ private IMAPMessageRenderingOperation renderingOp;
+ private WebView webView;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_messageview_detail, container, false);
+ webView = (WebView) rootView.findViewById(R.id.messageview_detail);
+
+ if (message != null) {
+ Log.d("detail", "message: " + message);
+ renderingOp = MessagesSyncManager.singleton().session.htmlRenderingOperation(message, "INBOX");
+ renderingOp.start(this);
+ }
+
+ return rootView;
+ }
+
+ public void succeeded() {
+ String html = renderingOp.result();
+ webView.loadData(html, "text/html", "utf-8");
+ }
+
+ public void failed(MailException exception) {
+
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java
new file mode 100644
index 00000000..e0115a69
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java
@@ -0,0 +1,87 @@
+package com.libmailcore.androidexample;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.app.Activity;
+import com.libmailcore.IMAPSession;
+import com.libmailcore.MailException;
+import com.libmailcore.OperationCallback;
+import com.libmailcore.IMAPMessage;
+
+/**
+ * An activity representing a list of MessagesViews. This activity
+ * has different presentations for handset and tablet-size devices. On
+ * handsets, the activity presents a list of items, which when touched,
+ * lead to a {@link MessageViewDetailActivity} representing
+ * item details. On tablets, the activity presents the list of items and
+ * item details side-by-side using two vertical panes.
+ * <p/>
+ * The activity makes heavy use of fragments. The list of items is a
+ * {@link MessageViewListFragment} and the item details
+ * (if present) is a {@link MessageViewDetailFragment}.
+ * <p/>
+ * This activity also implements the required
+ * {@link MessageViewListFragment.Callbacks} interface
+ * to listen for item selections.
+ */
+public class MessageViewListActivity extends Activity
+ implements MessageViewListFragment.Callbacks {
+
+ /**
+ * Whether or not the activity is in two-pane mode, i.e. running on a tablet
+ * device.
+ */
+ private boolean mTwoPane;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_messageview_list);
+
+ if (findViewById(R.id.messageview_detail_container) != null) {
+ // The detail container view will be present only in the
+ // large-screen layouts (res/values-large and
+ // res/values-sw600dp). If this view is present, then the
+ // activity should be in two-pane mode.
+ mTwoPane = true;
+
+ // In two-pane mode, list items should be given the
+ // 'activated' state when touched.
+ ((MessageViewListFragment) getFragmentManager()
+ .findFragmentById(R.id.messageview_list))
+ .setActivateOnItemClick(true);
+ }
+
+ // TODO: If exposing deep links into your app, handle intents here.
+ }
+
+ /**
+ * Callback method from {@link MessageViewListFragment.Callbacks}
+ * indicating that the item with the given ID was selected.
+ */
+ @Override
+ public void onItemSelected(IMAPMessage msg) {
+ if (mTwoPane) {
+ // In two-pane mode, show the detail view in this activity by
+ // adding or replacing the detail fragment using a
+ // fragment transaction.
+ MessagesSyncManager.singleton().currentMessage = msg;
+
+ //Bundle arguments = new Bundle();
+ //arguments.putString(MessageViewDetailFragment.ARG_ITEM_ID, msg);
+ MessageViewDetailFragment fragment = new MessageViewDetailFragment();
+ //fragment.setArguments(arguments);
+ getFragmentManager().beginTransaction()
+ .replace(R.id.messageview_detail_container, fragment)
+ .commit();
+
+ } else {
+ // In single-pane mode, simply start the detail activity
+ // for the selected item ID.
+ MessagesSyncManager.singleton().currentMessage = msg;
+ Intent detailIntent = new Intent(this, MessageViewDetailActivity.class);
+ //detailIntent.putExtra(MessageViewDetailFragment.ARG_ITEM_ID, id);
+ startActivity(detailIntent);
+ }
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java
new file mode 100644
index 00000000..b39c51ac
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java
@@ -0,0 +1,191 @@
+package com.libmailcore.androidexample;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.app.ListFragment;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.util.Log;
+
+import java.util.ArrayList;
+
+import com.libmailcore.IMAPFetchMessagesOperation;
+import com.libmailcore.IMAPMessage;
+import com.libmailcore.MailException;
+import com.libmailcore.OperationCallback;
+//import com.libmailcore.androidexample.dummy.DummyContent;
+import com.libmailcore.IndexSet;
+import com.libmailcore.IMAPMessagesRequestKind;
+import com.libmailcore.Range;
+
+/**
+ * A list fragment representing a list of MessagesViews. This fragment
+ * also supports tablet devices by allowing list items to be given an
+ * 'activated' state upon selection. This helps indicate which item is
+ * currently being viewed in a {@link MessageViewDetailFragment}.
+ * <p/>
+ * Activities containing this fragment MUST implement the {@link Callbacks}
+ * interface.
+ */
+public class MessageViewListFragment extends ListFragment implements OperationCallback {
+
+ /**
+ * The serialization (saved instance state) Bundle key representing the
+ * activated item position. Only used on tablets.
+ */
+ private static final String STATE_ACTIVATED_POSITION = "activated_position";
+
+ /**
+ * The fragment's current callback object, which is notified of list item
+ * clicks.
+ */
+ private Callbacks mCallbacks = sDummyCallbacks;
+
+ /**
+ * The current activated item position. Only used on tablets.
+ */
+ private int mActivatedPosition = ListView.INVALID_POSITION;
+
+ /**
+ * A callback interface that all activities containing this fragment must
+ * implement. This mechanism allows activities to be notified of item
+ * selections.
+ */
+ public interface Callbacks {
+ /**
+ * Callback for when an item has been selected.
+ */
+ public void onItemSelected(IMAPMessage msg);
+ }
+
+ /**
+ * A dummy implementation of the {@link Callbacks} interface that does
+ * nothing. Used only when this fragment is not attached to an activity.
+ */
+ private static Callbacks sDummyCallbacks = new Callbacks() {
+ @Override
+ public void onItemSelected(IMAPMessage msg) {
+ }
+ };
+
+ /**
+ * Mandatory empty constructor for the fragment manager to instantiate the
+ * fragment (e.g. upon screen orientation changes).
+ */
+ public MessageViewListFragment() {
+ }
+
+ private IMAPFetchMessagesOperation fetchMessagesOp;
+ private ArrayAdapter<MessageAdapter> adapter;
+ private java.util.List<IMAPMessage> messages;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ fetchMessagesOp = MessagesSyncManager.singleton().session.fetchMessagesByNumberOperation("INBOX", IMAPMessagesRequestKind.IMAPMessagesRequestKindHeaders | IMAPMessagesRequestKind.IMAPMessagesRequestKindStructure, IndexSet.indexSetWithRange(new Range(1, Range.RangeMax)));
+ fetchMessagesOp.start(this);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Restore the previously serialized activated item position.
+ if (savedInstanceState != null
+ && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
+ setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+
+ // Activities containing this fragment must implement its callbacks.
+ if (!(activity instanceof Callbacks)) {
+ throw new IllegalStateException("Activity must implement fragment's callbacks.");
+ }
+
+ mCallbacks = (Callbacks) activity;
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+
+ // Reset the active callbacks interface to the dummy implementation.
+ mCallbacks = sDummyCallbacks;
+ }
+
+ @Override
+ public void onListItemClick(ListView listView, View view, int position, long id) {
+ super.onListItemClick(listView, view, position, id);
+
+ // Notify the active callbacks interface (the activity, if the
+ // fragment is attached to one) that an item has been selected.
+// mCallbacks.onItemSelected(DummyContent.ITEMS.get(position).id);
+ Log.d("msglist", "row clicked: " + id);
+ mCallbacks.onItemSelected(messages.get((int) id));
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (mActivatedPosition != ListView.INVALID_POSITION) {
+ // Serialize and persist the activated item position.
+ outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
+ }
+ }
+
+ /**
+ * Turns on activate-on-click mode. When this mode is on, list items will be
+ * given the 'activated' state when touched.
+ */
+ public void setActivateOnItemClick(boolean activateOnItemClick) {
+ // When setting CHOICE_MODE_SINGLE, ListView will automatically
+ // give items the 'activated' state when touched.
+ getListView().setChoiceMode(activateOnItemClick
+ ? ListView.CHOICE_MODE_SINGLE
+ : ListView.CHOICE_MODE_NONE);
+ }
+
+ private void setActivatedPosition(int position) {
+ if (position == ListView.INVALID_POSITION) {
+ getListView().setItemChecked(mActivatedPosition, false);
+ } else {
+ getListView().setItemChecked(position, true);
+ }
+
+ mActivatedPosition = position;
+ }
+
+ public void succeeded() {
+ messages = fetchMessagesOp.messages();
+ updateResult();
+ }
+
+ public void failed(MailException exception) {
+
+ }
+
+ private void updateResult() {
+
+ Log.d("msglist", "update result");
+ ArrayList<MessageAdapter> array = new ArrayList();
+ for(IMAPMessage msg : messages) {
+ MessageAdapter msgAdapter = new MessageAdapter(msg);
+ array.add(msgAdapter);
+ }
+ adapter = new ArrayAdapter<MessageAdapter>(
+ getActivity(),
+ android.R.layout.simple_list_item_activated_1,
+ android.R.id.text1,
+ array);
+
+ // TODO: replace with a real list adapter.
+ setListAdapter(adapter);
+
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java
new file mode 100644
index 00000000..3c25e2bf
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java
@@ -0,0 +1,34 @@
+package com.libmailcore.androidexample;
+
+import com.libmailcore.ConnectionType;
+import com.libmailcore.IMAPFetchMessagesOperation;
+import com.libmailcore.IMAPSession;
+import com.libmailcore.IMAPMessage;
+
+/**
+ * Created by hoa on 1/8/15.
+ */
+public class MessagesSyncManager {
+ public IMAPSession session;
+ public IMAPMessage currentMessage;
+
+ static private MessagesSyncManager theSingleton;
+
+ public static MessagesSyncManager singleton() {
+ if (theSingleton == null) {
+ theSingleton = new MessagesSyncManager();
+ }
+ return theSingleton;
+ }
+
+ private MessagesSyncManager() {
+ session = new IMAPSession();
+ session.setUsername("login@gmail.com");
+ session.setPassword("password");
+ session.setHostname("imap.gmail.com");
+ session.setPort(993);
+ session.setConnectionType(ConnectionType.ConnectionTypeTLS);
+ }
+
+
+}
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 00000000..96a442e5
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 00000000..359047df
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..71c6d760
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..4df18946
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml b/example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml
new file mode 100644
index 00000000..9b211bda
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml
@@ -0,0 +1,23 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
+ android:layout_height="match_parent" android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp" android:baselineAligned="false"
+ android:divider="?android:attr/dividerHorizontal" android:orientation="horizontal"
+ android:showDividers="middle"
+ tools:context="com.libmailcore.androidexample.MessageViewListActivity">
+
+ <!--
+ This layout is a two-pane layout for the MessagesViews
+ master/detail flow.
+
+ -->
+
+ <fragment android:id="@+id/messageview_list"
+ android:name="com.libmailcore.androidexample.MessageViewListFragment"
+ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"
+ tools:layout="@android:layout/list_content" />
+
+ <FrameLayout android:id="@+id/messageview_detail_container" android:layout_width="0dp"
+ android:layout_height="match_parent" android:layout_weight="3" />
+
+</LinearLayout>
diff --git a/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml
new file mode 100644
index 00000000..fa100d0b
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml
@@ -0,0 +1,5 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/messageview_detail_container"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ tools:context="com.libmailcore.androidexample.MessageViewDetailActivity"
+ tools:ignore="MergeRootFrame" />
diff --git a/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml
new file mode 100644
index 00000000..039f69b1
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml
@@ -0,0 +1,7 @@
+<fragment xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/messageview_list"
+ android:name="com.libmailcore.androidexample.MessageViewListFragment"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
+ tools:context="com.libmailcore.androidexample.MessageViewListActivity"
+ tools:layout="@android:layout/list_content" />
diff --git a/example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml b/example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml
new file mode 100644
index 00000000..d1ecbf75
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml
@@ -0,0 +1,5 @@
+<WebView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/messageview_detail"
+ style="?android:attr/textAppearanceLarge" android:layout_width="match_parent"
+ android:layout_height="match_parent" android:padding="16dp" android:textIsSelectable="true"
+ tools:context="com.libmailcore.androidexample.MessageViewDetailFragment" />
diff --git a/example/android/AndroidExample/app/src/main/res/values-v21/styles.xml b/example/android/AndroidExample/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 00000000..dba3c417
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="AppTheme" parent="android:Theme.Material.Light">
+ </style>
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/dimens.xml b/example/android/AndroidExample/app/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..47c82246
--- /dev/null
+++ b/example/android/AndroidExample/app/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/android/AndroidExample/app/src/main/res/values/strings.xml b/example/android/AndroidExample/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..986a9ee4
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/strings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">AndroidExample</string>
+ <string name="title_messageview_list">MessagesViews</string>
+ <string name="title_messageview_detail">MessageView Detail</string>
+
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml b/example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml
new file mode 100644
index 00000000..9f1a810f
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml
@@ -0,0 +1,15 @@
+<resources>
+ <string name="title_activity_login">Sign in</string>
+
+ <!-- Strings related to login -->
+ <string name="prompt_email">Email</string>
+ <string name="prompt_password">Password (optional)</string>
+ <string name="action_sign_in">Sign in or register</string>
+ <string name="action_sign_in_short">Sign in</string>
+ <string name="plus_sign_out">Switch Google+ account</string>
+ <string name="plus_disconnect">Disconnect from Google+</string>
+ <string name="error_invalid_email">This email address is invalid</string>
+ <string name="error_invalid_password">This password is too short</string>
+ <string name="error_incorrect_password">This password is incorrect</string>
+ <string name="error_field_required">This field is required</string>
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/styles.xml b/example/android/AndroidExample/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..ff6c9d2c
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>
diff --git a/example/android/AndroidExample/build.gradle b/example/android/AndroidExample/build.gradle
new file mode 100644
index 00000000..6356aabd
--- /dev/null
+++ b/example/android/AndroidExample/build.gradle
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.0.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/example/android/AndroidExample/gradle.properties b/example/android/AndroidExample/gradle.properties
new file mode 100644
index 00000000..1d3591c8
--- /dev/null
+++ b/example/android/AndroidExample/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true \ No newline at end of file
diff --git a/example/android/AndroidExample/gradle/wrapper/gradle-wrapper.jar b/example/android/AndroidExample/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000..8c0fb64a
--- /dev/null
+++ b/example/android/AndroidExample/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/example/android/AndroidExample/gradle/wrapper/gradle-wrapper.properties b/example/android/AndroidExample/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..0c71e760
--- /dev/null
+++ b/example/android/AndroidExample/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/example/android/AndroidExample/gradlew b/example/android/AndroidExample/gradlew
new file mode 100755
index 00000000..91a7e269
--- /dev/null
+++ b/example/android/AndroidExample/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/example/android/AndroidExample/gradlew.bat b/example/android/AndroidExample/gradlew.bat
new file mode 100644
index 00000000..aec99730
--- /dev/null
+++ b/example/android/AndroidExample/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/example/android/AndroidExample/settings.gradle b/example/android/AndroidExample/settings.gradle
new file mode 100644
index 00000000..e7b4def4
--- /dev/null
+++ b/example/android/AndroidExample/settings.gradle
@@ -0,0 +1 @@
+include ':app'