mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
Delete some dead code. Add a license header.
This commit is contained in:
parent
88f50a66ff
commit
fb0987b824
@ -80,6 +80,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
|
|||||||
|
|
||||||
private long lastMenuEventTime = 0;
|
private long lastMenuEventTime = 0;
|
||||||
|
|
||||||
|
private NativeToJsMessageQueue nativeToJsMessageQueue;
|
||||||
CordovaBridge bridge;
|
CordovaBridge bridge;
|
||||||
|
|
||||||
/** custom view created by the browser (a video player for example) */
|
/** 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);
|
pluginManager = new PluginManager(this, this.cordova, pluginEntries);
|
||||||
cookieManager = new AndroidCookieManager(this);
|
cookieManager = new AndroidCookieManager(this);
|
||||||
resourceApi = new CordovaResourceApi(this.getContext(), pluginManager);
|
resourceApi = new CordovaResourceApi(this.getContext(), pluginManager);
|
||||||
NativeToJsMessageQueue nativeToJsMessageQueue = new NativeToJsMessageQueue();
|
nativeToJsMessageQueue = new NativeToJsMessageQueue();
|
||||||
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
|
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode());
|
||||||
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(this, cordova));
|
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(this, cordova));
|
||||||
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
|
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
|
||||||
@ -137,7 +138,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
|
|||||||
cordova.getActivity().runOnUiThread(r);
|
cordova.getActivity().runOnUiThread(r);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue, this.cordova.getActivity().getPackageName());
|
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
|
||||||
initWebViewSettings();
|
initWebViewSettings();
|
||||||
pluginManager.addService(CoreAndroid.PLUGIN_NAME, CoreAndroid.class.getCanonicalName());
|
pluginManager.addService(CoreAndroid.PLUGIN_NAME, CoreAndroid.class.getCanonicalName());
|
||||||
pluginManager.init();
|
pluginManager.init();
|
||||||
@ -403,14 +404,14 @@ public class AndroidWebView extends WebView implements CordovaWebView {
|
|||||||
* (This is a convenience method)
|
* (This is a convenience method)
|
||||||
*/
|
*/
|
||||||
public void sendJavascript(String statement) {
|
public void sendJavascript(String statement) {
|
||||||
bridge.getMessageQueue().addJavaScript(statement);
|
nativeToJsMessageQueue.addJavaScript(statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a plugin result back to JavaScript.
|
* Send a plugin result back to JavaScript.
|
||||||
*/
|
*/
|
||||||
public void sendPluginResult(PluginResult result, String callbackId) {
|
public void sendPluginResult(PluginResult result, String callbackId) {
|
||||||
bridge.getMessageQueue().addPluginResult(result, callbackId);
|
nativeToJsMessageQueue.addPluginResult(result, callbackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package org.apache.cordova;
|
package org.apache.cordova;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -350,7 +349,6 @@ public class CordovaActivity extends Activity {
|
|||||||
|
|
||||||
// If errorUrl specified, then load it
|
// If errorUrl specified, then load it
|
||||||
final String errorUrl = preferences.getString("errorUrl", null);
|
final String errorUrl = preferences.getString("errorUrl", null);
|
||||||
CordovaUriHelper helper = new CordovaUriHelper(this.cordovaInterface, appView);
|
|
||||||
if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
|
if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
|
||||||
// Load URL on UI thread
|
// Load URL on UI thread
|
||||||
me.runOnUiThread(new Runnable() {
|
me.runOnUiThread(new Runnable() {
|
||||||
|
@ -36,7 +36,7 @@ public class CordovaBridge {
|
|||||||
private NativeToJsMessageQueue jsMessageQueue;
|
private NativeToJsMessageQueue jsMessageQueue;
|
||||||
private volatile int expectedBridgeSecret = -1; // written by UI thread, read by JS thread.
|
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.pluginManager = pluginManager;
|
||||||
this.jsMessageQueue = jsMessageQueue;
|
this.jsMessageQueue = jsMessageQueue;
|
||||||
}
|
}
|
||||||
@ -177,8 +177,4 @@ public class CordovaBridge {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NativeToJsMessageQueue getMessageQueue() {
|
|
||||||
return jsMessageQueue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
package org.apache.cordova;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -5,15 +21,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.WebChromeClient.CustomViewCallback;
|
import android.webkit.WebChromeClient.CustomViewCallback;
|
||||||
|
|
||||||
public interface CordovaWebView {
|
public interface CordovaWebView {
|
||||||
public static final String CORDOVA_VERSION = "4.0.0-dev";
|
public static final String CORDOVA_VERSION = "4.0.0-dev";
|
||||||
|
|
||||||
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries,
|
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
|
||||||
CordovaPreferences preferences);
|
|
||||||
|
|
||||||
View getView();
|
View getView();
|
||||||
|
|
||||||
@ -39,9 +53,7 @@ public interface CordovaWebView {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send JavaScript statement back to JavaScript.
|
* Send JavaScript statement back to JavaScript.
|
||||||
* (This is a convenience method)
|
|
||||||
*
|
*
|
||||||
* @param statement
|
|
||||||
* Deprecated (https://issues.apache.org/jira/browse/CB-6851)
|
* Deprecated (https://issues.apache.org/jira/browse/CB-6851)
|
||||||
* Instead of executing snippets of JS, you should use the exec bridge
|
* Instead of executing snippets of JS, you should use the exec bridge
|
||||||
* to create a Java->JS communication channel.
|
* to create a Java->JS communication channel.
|
||||||
|
Loading…
Reference in New Issue
Block a user