You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2015/02/19 16:34:52 UTC
[3/5] android commit: Delete some dead code. Add a license header.
Delete some dead code. Add a license header.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/fb0987b8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/fb0987b8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/fb0987b8
Branch: refs/heads/master
Commit: fb0987b824bcac9481a5daf4a32162b903f78de1
Parents: 88f50a6
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Feb 19 10:31:44 2015 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Feb 19 10:31:44 2015 -0500
----------------------------------------------------------------------
.../src/org/apache/cordova/AndroidWebView.java | 9 ++++----
.../src/org/apache/cordova/CordovaActivity.java | 2 --
.../src/org/apache/cordova/CordovaBridge.java | 6 +-----
.../src/org/apache/cordova/CordovaWebView.java | 22 +++++++++++++++-----
4 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fb0987b8/framework/src/org/apache/cordova/AndroidWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/AndroidWebView.java b/framework/src/org/apache/cordova/AndroidWebView.java
index de171f2..a5f568b 100755
--- a/framework/src/org/apache/cordova/AndroidWebView.java
+++ b/framework/src/org/apache/cordova/AndroidWebView.java
@@ -80,6 +80,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
private long lastMenuEventTime = 0;
+ private NativeToJsMessageQueue nativeToJsMessageQueue;
CordovaBridge bridge;
/** custom view created by the browser (a video player for example) */
@@ -123,7 +124,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
pluginManager = new PluginManager(this, this.cordova, pluginEntries);
cookieManager = new AndroidCookieManager(this);
resourceApi = new CordovaResourceApi(this.getContext(), pluginManager);
- NativeToJsMessageQueue nativeToJsMessageQueue = new NativeToJsMessageQueue();
+ nativeToJsMessageQueue = new NativeToJsMessageQueue();
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(this, cordova));
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
@@ -137,7 +138,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
cordova.getActivity().runOnUiThread(r);
}
}));
- bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue, this.cordova.getActivity().getPackageName());
+ bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
initWebViewSettings();
pluginManager.addService(CoreAndroid.PLUGIN_NAME, CoreAndroid.class.getCanonicalName());
pluginManager.init();
@@ -403,14 +404,14 @@ public class AndroidWebView extends WebView implements CordovaWebView {
* (This is a convenience method)
*/
public void sendJavascript(String statement) {
- bridge.getMessageQueue().addJavaScript(statement);
+ nativeToJsMessageQueue.addJavaScript(statement);
}
/**
* Send a plugin result back to JavaScript.
*/
public void sendPluginResult(PluginResult result, String callbackId) {
- bridge.getMessageQueue().addPluginResult(result, callbackId);
+ nativeToJsMessageQueue.addPluginResult(result, callbackId);
}
/**
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fb0987b8/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index bc262a6..08876ab 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -19,7 +19,6 @@
package org.apache.cordova;
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Locale;
@@ -350,7 +349,6 @@ public class CordovaActivity extends Activity {
// If errorUrl specified, then load it
final String errorUrl = preferences.getString("errorUrl", null);
- CordovaUriHelper helper = new CordovaUriHelper(this.cordovaInterface, appView);
if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
// Load URL on UI thread
me.runOnUiThread(new Runnable() {
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fb0987b8/framework/src/org/apache/cordova/CordovaBridge.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaBridge.java b/framework/src/org/apache/cordova/CordovaBridge.java
index bf95588..50eb901 100644
--- a/framework/src/org/apache/cordova/CordovaBridge.java
+++ b/framework/src/org/apache/cordova/CordovaBridge.java
@@ -36,7 +36,7 @@ public class CordovaBridge {
private NativeToJsMessageQueue jsMessageQueue;
private volatile int expectedBridgeSecret = -1; // written by UI thread, read by JS thread.
- public CordovaBridge(PluginManager pluginManager, NativeToJsMessageQueue jsMessageQueue, String packageName) {
+ public CordovaBridge(PluginManager pluginManager, NativeToJsMessageQueue jsMessageQueue) {
this.pluginManager = pluginManager;
this.jsMessageQueue = jsMessageQueue;
}
@@ -177,8 +177,4 @@ public class CordovaBridge {
}
return null;
}
-
- public NativeToJsMessageQueue getMessageQueue() {
- return jsMessageQueue;
- }
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fb0987b8/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 3b209d5..de04c6a 100644
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -1,3 +1,19 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 org.apache.cordova;
import java.util.Map;
@@ -5,15 +21,13 @@ import java.util.List;
import android.content.Context;
import android.content.Intent;
-import android.net.Uri;
import android.view.View;
import android.webkit.WebChromeClient.CustomViewCallback;
public interface CordovaWebView {
public static final String CORDOVA_VERSION = "4.0.0-dev";
- void init(CordovaInterface cordova, List<PluginEntry> pluginEntries,
- CordovaPreferences preferences);
+ void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
View getView();
@@ -39,9 +53,7 @@ public interface CordovaWebView {
/**
* Send JavaScript statement back to JavaScript.
- * (This is a convenience method)
*
- * @param statement
* Deprecated (https://issues.apache.org/jira/browse/CB-6851)
* Instead of executing snippets of JS, you should use the exec bridge
* to create a Java->JS communication channel.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org