bug 930072 - Provide example app using GeckoView library in the tree r=mfinkle, nalexander
authorBrad Lassey <blassey@mozilla.com>
Wed, 23 Oct 2013 18:37:14 +0200
changeset 165786 371a2267b7a829f1e5922e8829a3fbccdbe6b661
parent 165785 59e1d423670589c1f3d0547618ddafb2aef0cc28
child 165787 464f36a51d3e7fe8721a12d39a6e90fbf597376d
push id4703
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 20:24:19 +0000
treeherdermozilla-aurora@20af7fbd96c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, nalexander
bugs930072
milestone28.0a1
bug 930072 - Provide example app using GeckoView library in the tree r=mfinkle, nalexander
embedding/android/geckoview_example/AndroidManifest.xml
embedding/android/geckoview_example/GeckoViewExample.java
embedding/android/geckoview_example/Makefile.in
embedding/android/geckoview_example/main.xml
embedding/android/geckoview_example/moz.build
embedding/moz.build
new file mode 100644
--- /dev/null
+++ b/embedding/android/geckoview_example/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="org.mozilla.geckoviewexample"
+          android:versionCode="1"
+          android:versionName="1.0">
+  <uses-sdk android:minSdkVersion="8"
+            android:targetSdkVersion="16"/>
+  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+  <uses-permission android:name="android.permission.INTERNET"/>
+  <uses-feature android:glEsVersion="0x00020000" android:required="true" />
+  <application android:label="@string/app_name"
+               android:icon="@drawable/ic_launcher"
+               android:hardwareAccelerated="true">
+    <activity android:name="GeckoViewExample"
+              android:label="@string/app_name">
+      <intent-filter>
+        <action android:name="android.intent.action.MAIN" />
+        <category android:name="android.intent.category.LAUNCHER" />
+      </intent-filter>
+    </activity>
+  </application>
+</manifest>
new file mode 100644
--- /dev/null
+++ b/embedding/android/geckoview_example/GeckoViewExample.java
@@ -0,0 +1,14 @@
+package org.mozilla.geckoviewexample;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.AttributeSet;
+
+public class GeckoViewExample extends Activity {
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+    }
+}
new file mode 100644
--- /dev/null
+++ b/embedding/android/geckoview_example/Makefile.in
@@ -0,0 +1,34 @@
+include $(topsrcdir)/config/rules.mk
+
+GARBAGE = \
+	AndroidManifest.xml \
+	proguard-project.txt \
+	project.properties \
+	ant.properties \
+	build.xml \
+	local.properties \
+	$(NULL)
+
+GARBAGE_DIRS = \
+	assets \
+	geckoview_library \
+	gen \
+	bin \
+	libs \
+	res \
+	src \
+	$(NULL)
+
+ANDROID=$(ANDROID_SDK)/../../tools/android
+
+build.xml:
+	$(ANDROID) create project --name GeckoViewExample --target android-18 --path $(CURDIR) --activity GeckoViewExample --package org.mozilla.geckoviewexample
+	$(ANDROID) update project --target android-18 --path $(CURDIR) --library $(DEPTH)/mobile/android/geckoview_library
+	$(UNZIP) -o $(DIST)/geckoview_library/geckoview_assets.zip
+	$(NSINSTALL) $(srcdir)/main.xml res/layout/
+	$(NSINSTALL) $(srcdir)/AndroidManifest.xml .
+	$(NSINSTALL) $(srcdir)/GeckoViewExample.java src/org/mozilla/geckoviewexample/
+	echo jar.libs.dir=libs >> project.properties
+
+package: build.xml
+	ant debug
new file mode 100644
--- /dev/null
+++ b/embedding/android/geckoview_example/main.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              xmlns:gecko="http://schemas.android.com/apk/res-auto"
+              android:orientation="vertical"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+              >
+  <org.mozilla.gecko.GeckoView android:id="@+id/gecko_view"
+                               android:layout_width="fill_parent"
+                               android:layout_height="fill_parent"
+                               gecko:url="about:mozilla"/>
+</LinearLayout>
new file mode 100644
--- a/embedding/moz.build
+++ b/embedding/moz.build
@@ -1,11 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['base', 'components', 'browser']
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
+    DIRS += ['android/geckoview_example']
+
 TEST_DIRS += ['test']
 
 if CONFIG['ENABLE_TESTS']:
     XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']