summaryrefslogtreecommitdiffstats
path: root/mobile/android/geckoview_example
diff options
context:
space:
mode:
Diffstat (limited to 'mobile/android/geckoview_example')
-rw-r--r--mobile/android/geckoview_example/build.gradle63
-rw-r--r--mobile/android/geckoview_example/proguard-rules.pro17
-rw-r--r--mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/ApplicationTest.java13
-rw-r--r--mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/GeckoViewActivityTest.java32
-rw-r--r--mobile/android/geckoview_example/src/main/AndroidManifest.xml21
-rw-r--r--mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java148
-rw-r--r--mobile/android/geckoview_example/src/main/res/layout/geckoview_activity.xml13
-rw-r--r--mobile/android/geckoview_example/src/main/res/values/colors.xml6
-rw-r--r--mobile/android/geckoview_example/src/main/res/values/strings.xml3
-rw-r--r--mobile/android/geckoview_example/src/test/java/org/mozilla/geckoview_example/ExampleUnitTest.java15
10 files changed, 0 insertions, 331 deletions
diff --git a/mobile/android/geckoview_example/build.gradle b/mobile/android/geckoview_example/build.gradle
deleted file mode 100644
index 33f8d8583..000000000
--- a/mobile/android/geckoview_example/build.gradle
+++ /dev/null
@@ -1,63 +0,0 @@
-buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example"
-
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 23
- buildToolsVersion mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION
-
- defaultConfig {
- applicationId "org.mozilla.geckoview_example"
- minSdkVersion 15
- targetSdkVersion 23
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
-
- // This is extremely frustrating, but the only way to do it automation for
- // now. Without this, we only get a "debugAndroidTest" configuration; we
- // have no "withoutGeckoBinariesAndroidTest" configuration.
- testBuildType "withoutGeckoBinaries"
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- withGeckoBinaries { // For consistency with :geckoview project in Task Cluster invocations.
- initWith debug
- }
- withoutGeckoBinaries { // Logical negation of withGeckoBinaries.
- initWith debug
- }
- }
-}
-
-dependencies {
- testCompile 'junit:junit:4.12'
-
- compile 'com.android.support:support-annotations:23.4.0'
-
- androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
- androidTestCompile 'com.android.support.test:runner:0.5'
- // Not defining this library again results in test-app assuming 23.1.1, and the following errors:
- // "Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.4.0) and test app (23.1.1) differ."
- androidTestCompile 'com.android.support:support-annotations:23.4.0'
-
- compile project(':geckoview')
-}
-
-apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
-
-android.applicationVariants.all { variant ->
- // Like 'debug', 'release', or 'withoutGeckoBinaries'.
- def buildType = variant.buildType.name
-
- // It would be most natural for :geckoview to always include the Gecko
- // binaries, but that's difficult; see the notes in
- // mobile/android/gradle/with_gecko_binaries.gradle. Instead we handle our
- // own Gecko binary inclusion.
- if (!buildType.equals('withoutGeckoBinaries')) {
- configureVariantWithGeckoBinaries(variant)
- }
-}
diff --git a/mobile/android/geckoview_example/proguard-rules.pro b/mobile/android/geckoview_example/proguard-rules.pro
deleted file mode 100644
index 46fbee549..000000000
--- a/mobile/android/geckoview_example/proguard-rules.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in /Users/nalexander/.mozbuild/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/mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/ApplicationTest.java b/mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/ApplicationTest.java
deleted file mode 100644
index 88630b197..000000000
--- a/mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.mozilla.geckoview_example;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
- */
-public class ApplicationTest extends ApplicationTestCase<Application> {
- public ApplicationTest() {
- super(Application.class);
- }
-} \ No newline at end of file
diff --git a/mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/GeckoViewActivityTest.java b/mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/GeckoViewActivityTest.java
deleted file mode 100644
index aca127351..000000000
--- a/mobile/android/geckoview_example/src/androidTest/java/org/mozilla/geckoview_example/GeckoViewActivityTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * 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/. */
-
-package org.mozilla.geckoview_example;
-
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-
-@RunWith(AndroidJUnit4.class)
-public class GeckoViewActivityTest {
-
- @Rule
- public ActivityTestRule<GeckoViewActivity> mActivityRule = new ActivityTestRule(GeckoViewActivity.class);
-
- @Test
- public void testA() throws InterruptedException {
- onView(withId(R.id.gecko_view))
- .check(matches(isDisplayed()));
- }
-}
diff --git a/mobile/android/geckoview_example/src/main/AndroidManifest.xml b/mobile/android/geckoview_example/src/main/AndroidManifest.xml
deleted file mode 100644
index 551a4a7db..000000000
--- a/mobile/android/geckoview_example/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.mozilla.geckoview_example">
-
- <application android:allowBackup="true"
- android:label="@string/app_name"
- android:supportsRtl="true">
-
- <uses-library android:name="android.test.runner" />
-
- <activity android:name="org.mozilla.geckoview_example.GeckoViewActivity"
- android:label="GeckoViewActivity">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
-
- </application>
-
-</manifest>
diff --git a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java
deleted file mode 100644
index 071f7ed25..000000000
--- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * 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/. */
-
-package org.mozilla.geckoview_example;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.Toast;
-
-import org.mozilla.gecko.BaseGeckoInterface;
-import org.mozilla.gecko.GeckoProfile;
-import org.mozilla.gecko.GeckoThread;
-import org.mozilla.gecko.GeckoView;
-import org.mozilla.gecko.PrefsHelper;
-
-import static org.mozilla.gecko.GeckoView.setGeckoInterface;
-
-public class GeckoViewActivity extends Activity {
- private static final String LOGTAG = "GeckoViewActivity";
-
- GeckoView mGeckoView;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setGeckoInterface(new BaseGeckoInterface(getApplicationContext()));
-
- setContentView(R.layout.geckoview_activity);
-
- mGeckoView = (GeckoView) findViewById(R.id.gecko_view);
- mGeckoView.setChromeDelegate(new MyGeckoViewChrome());
- mGeckoView.setContentDelegate(new MyGeckoViewContent());
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- final GeckoProfile profile = GeckoProfile.get(getApplicationContext());
-
- GeckoThread.init(profile, /* args */ null, /* action */ null, /* debugging */ false);
- GeckoThread.launch();
- }
-
- private class MyGeckoViewChrome implements GeckoView.ChromeDelegate {
- @Override
- public void onReady(GeckoView view) {
- Log.i(LOGTAG, "Gecko is ready");
- // // Inject a script that adds some code to the content window
- // mGeckoView.importScript("resource://android/assets/script.js");
-
- // Set up remote debugging to a port number
- PrefsHelper.setPref("layers.dump", true);
- PrefsHelper.setPref("devtools.debugger.remote-port", 6000);
- PrefsHelper.setPref("devtools.debugger.unix-domain-socket", "");
- PrefsHelper.setPref("devtools.debugger.remote-enabled", true);
-
- // The Gecko libraries have finished loading and we can use the rendering engine.
- // Let's add a browser (required) and load a page into it.
- // mGeckoView.addBrowser(getResources().getString(R.string.default_url));
- }
-
- @Override
- public void onAlert(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result) {
- Log.i(LOGTAG, "Alert!");
- result.confirm();
- Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
- }
-
- @Override
- public void onConfirm(GeckoView view, GeckoView.Browser browser, String message, final GeckoView.PromptResult result) {
- Log.i(LOGTAG, "Confirm!");
- new AlertDialog.Builder(GeckoViewActivity.this)
- .setTitle("javaScript dialog")
- .setMessage(message)
- .setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- result.confirm();
- }
- })
- .setNegativeButton(android.R.string.cancel,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- result.cancel();
- }
- })
- .create()
- .show();
- }
-
- @Override
- public void onPrompt(GeckoView view, GeckoView.Browser browser, String message, String defaultValue, GeckoView.PromptResult result) {
- result.cancel();
- }
-
- @Override
- public void onDebugRequest(GeckoView view, GeckoView.PromptResult result) {
- Log.i(LOGTAG, "Remote Debug!");
- result.confirm();
- }
-
- @Override
- public void onScriptMessage(GeckoView view, Bundle data, GeckoView.MessageResult result) {
- Log.i(LOGTAG, "Got Script Message: " + data.toString());
- String type = data.getString("type");
- if ("fetch".equals(type)) {
- Bundle ret = new Bundle();
- ret.putString("name", "Mozilla");
- ret.putString("url", "https://mozilla.org");
- result.success(ret);
- }
- }
- }
-
- private class MyGeckoViewContent implements GeckoView.ContentDelegate {
- @Override
- public void onPageStart(GeckoView view, GeckoView.Browser browser, String url) {
-
- }
-
- @Override
- public void onPageStop(GeckoView view, GeckoView.Browser browser, boolean success) {
-
- }
-
- @Override
- public void onPageShow(GeckoView view, GeckoView.Browser browser) {
-
- }
-
- @Override
- public void onReceivedTitle(GeckoView view, GeckoView.Browser browser, String title) {
- Log.i(LOGTAG, "Received a title: " + title);
- }
-
- @Override
- public void onReceivedFavicon(GeckoView view, GeckoView.Browser browser, String url, int size) {
- Log.i(LOGTAG, "Received a favicon URL: " + url);
- }
- }
-}
diff --git a/mobile/android/geckoview_example/src/main/res/layout/geckoview_activity.xml b/mobile/android/geckoview_example/src/main/res/layout/geckoview_activity.xml
deleted file mode 100644
index eb4281fc6..000000000
--- a/mobile/android/geckoview_example/src/main/res/layout/geckoview_activity.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical">
-
- <org.mozilla.gecko.GeckoView
- android:id="@+id/gecko_view"
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:scrollbars="none"
- />
-
-</LinearLayout>
diff --git a/mobile/android/geckoview_example/src/main/res/values/colors.xml b/mobile/android/geckoview_example/src/main/res/values/colors.xml
deleted file mode 100644
index 3ab3e9cbc..000000000
--- a/mobile/android/geckoview_example/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?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/mobile/android/geckoview_example/src/main/res/values/strings.xml b/mobile/android/geckoview_example/src/main/res/values/strings.xml
deleted file mode 100644
index 1f5f447b2..000000000
--- a/mobile/android/geckoview_example/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<resources>
- <string name="app_name">geckoview_example</string>
-</resources>
diff --git a/mobile/android/geckoview_example/src/test/java/org/mozilla/geckoview_example/ExampleUnitTest.java b/mobile/android/geckoview_example/src/test/java/org/mozilla/geckoview_example/ExampleUnitTest.java
deleted file mode 100644
index 14f82340b..000000000
--- a/mobile/android/geckoview_example/src/test/java/org/mozilla/geckoview_example/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.mozilla.geckoview_example;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-} \ No newline at end of file