Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 260D3200C7D for ; Tue, 2 May 2017 02:08:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 24CB4160BC1; Tue, 2 May 2017 00:08:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4E790160BE4 for ; Tue, 2 May 2017 02:08:27 +0200 (CEST) Received: (qmail 72590 invoked by uid 500); 2 May 2017 00:08:24 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 71437 invoked by uid 99); 2 May 2017 00:08:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2017 00:08:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 33BF3E0896; Tue, 2 May 2017 00:08:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Tue, 02 May 2017 00:09:14 -0000 Message-Id: <01523c1af2fa45cc88fcb45fd285fb56@git.apache.org> In-Reply-To: <671239e2e946407eb626bdf212058d53@git.apache.org> References: <671239e2e946407eb626bdf212058d53@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [54/68] [abbrv] cordova-lib git commit: CB-11242: removed support for platforms that don't have a package.json archived-at: Tue, 02 May 2017 00:08:31 -0000 http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e0c3fee6/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaDialogsHelper.java ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaDialogsHelper.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaDialogsHelper.java deleted file mode 100644 index a219c99..0000000 --- a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaDialogsHelper.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - 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 android.app.AlertDialog; -import android.content.Context; -import android.content.DialogInterface; -import android.view.KeyEvent; -import android.widget.EditText; - -/** - * Helper class for WebViews to implement prompt(), alert(), confirm() dialogs. - */ -public class CordovaDialogsHelper { - private final Context context; - private AlertDialog lastHandledDialog; - - public CordovaDialogsHelper(Context context) { - this.context = context; - } - - public void showAlert(String message, final Result result) { - AlertDialog.Builder dlg = new AlertDialog.Builder(context); - dlg.setMessage(message); - dlg.setTitle("Alert"); - //Don't let alerts break the back button - dlg.setCancelable(true); - dlg.setPositiveButton(android.R.string.ok, - new AlertDialog.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - result.gotResult(true, null); - } - }); - dlg.setOnCancelListener( - new DialogInterface.OnCancelListener() { - public void onCancel(DialogInterface dialog) { - result.gotResult(false, null); - } - }); - dlg.setOnKeyListener(new DialogInterface.OnKeyListener() { - //DO NOTHING - public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK) - { - result.gotResult(true, null); - return false; - } - else - return true; - } - }); - lastHandledDialog = dlg.show(); - } - - public void showConfirm(String message, final Result result) { - AlertDialog.Builder dlg = new AlertDialog.Builder(context); - dlg.setMessage(message); - dlg.setTitle("Confirm"); - dlg.setCancelable(true); - dlg.setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - result.gotResult(true, null); - } - }); - dlg.setNegativeButton(android.R.string.cancel, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - result.gotResult(false, null); - } - }); - dlg.setOnCancelListener( - new DialogInterface.OnCancelListener() { - public void onCancel(DialogInterface dialog) { - result.gotResult(false, null); - } - }); - dlg.setOnKeyListener(new DialogInterface.OnKeyListener() { - //DO NOTHING - public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK) - { - result.gotResult(false, null); - return false; - } - else - return true; - } - }); - lastHandledDialog = dlg.show(); - } - - /** - * Tell the client to display a prompt dialog to the user. - * If the client returns true, WebView will assume that the client will - * handle the prompt dialog and call the appropriate JsPromptResult method. - * - * Since we are hacking prompts for our own purposes, we should not be using them for - * this purpose, perhaps we should hack console.log to do this instead! - */ - public void showPrompt(String message, String defaultValue, final Result result) { - // Returning false would also show a dialog, but the default one shows the origin (ugly). - AlertDialog.Builder dlg = new AlertDialog.Builder(context); - dlg.setMessage(message); - final EditText input = new EditText(context); - if (defaultValue != null) { - input.setText(defaultValue); - } - dlg.setView(input); - dlg.setCancelable(false); - dlg.setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - String userText = input.getText().toString(); - result.gotResult(true, userText); - } - }); - dlg.setNegativeButton(android.R.string.cancel, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - result.gotResult(false, null); - } - }); - lastHandledDialog = dlg.show(); - } - - public void destroyLastDialog(){ - if (lastHandledDialog != null){ - lastHandledDialog.cancel(); - } - } - - public interface Result { - public void gotResult(boolean success, String value); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e0c3fee6/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java deleted file mode 100644 index 724381e..0000000 --- a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - 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 android.webkit.HttpAuthHandler; - -/** - * Specifies interface for HTTP auth handler object which is used to handle auth requests and - * specifying user credentials. - */ -public class CordovaHttpAuthHandler implements ICordovaHttpAuthHandler { - - private final HttpAuthHandler handler; - - public CordovaHttpAuthHandler(HttpAuthHandler handler) { - this.handler = handler; - } - - /** - * Instructs the WebView to cancel the authentication request. - */ - public void cancel () { - this.handler.cancel(); - } - - /** - * Instructs the WebView to proceed with the authentication with the given credentials. - * - * @param username - * @param password - */ - public void proceed (String username, String password) { - this.handler.proceed(username, password); - } -} http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e0c3fee6/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterface.java ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterface.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterface.java deleted file mode 100755 index 3b8468f..0000000 --- a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterface.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - 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 android.app.Activity; -import android.content.Intent; - -import org.apache.cordova.CordovaPlugin; - -import java.util.concurrent.ExecutorService; - -/** - * The Activity interface that is implemented by CordovaActivity. - * It is used to isolate plugin development, and remove dependency on entire Cordova library. - */ -public interface CordovaInterface { - - /** - * Launch an activity for which you would like a result when it finished. When this activity exits, - * your onActivityResult() method will be called. - * - * @param command The command object - * @param intent The intent to start - * @param requestCode The request code that is passed to callback to identify the activity - */ - abstract public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode); - - /** - * Set the plugin to be called when a sub-activity exits. - * - * @param plugin The plugin on which onActivityResult is to be called - */ - abstract public void setActivityResultCallback(CordovaPlugin plugin); - - /** - * Get the Android activity. - * - * @return the Activity - */ - public abstract Activity getActivity(); - - - /** - * Called when a message is sent to plugin. - * - * @param id The message id - * @param data The message data - * @return Object or null - */ - public Object onMessage(String id, Object data); - - /** - * Returns a shared thread pool that can be used for background tasks. - */ - public ExecutorService getThreadPool(); - - /** - * Sends a permission request to the activity for one permission. - */ - public void requestPermission(CordovaPlugin plugin, int requestCode, String permission); - - /** - * Sends a permission request to the activity for a group of permissions - */ - public void requestPermissions(CordovaPlugin plugin, int requestCode, String [] permissions); - - /** - * Check for a permission. Returns true if the permission is granted, false otherwise. - */ - public boolean hasPermission(String permission); - -} http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e0c3fee6/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterfaceImpl.java ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterfaceImpl.java deleted file mode 100644 index 71dcb78..0000000 --- a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaInterfaceImpl.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - 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 android.app.Activity; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.os.Build; -import android.os.Bundle; -import android.util.Pair; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * Default implementation of CordovaInterface. - */ -public class CordovaInterfaceImpl implements CordovaInterface { - private static final String TAG = "CordovaInterfaceImpl"; - protected Activity activity; - protected ExecutorService threadPool; - protected PluginManager pluginManager; - - protected ActivityResultHolder savedResult; - protected CallbackMap permissionResultCallbacks; - protected CordovaPlugin activityResultCallback; - protected String initCallbackService; - protected int activityResultRequestCode; - protected boolean activityWasDestroyed = false; - protected Bundle savedPluginState; - - public CordovaInterfaceImpl(Activity activity) { - this(activity, Executors.newCachedThreadPool()); - } - - public CordovaInterfaceImpl(Activity activity, ExecutorService threadPool) { - this.activity = activity; - this.threadPool = threadPool; - this.permissionResultCallbacks = new CallbackMap(); - } - - @Override - public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) { - setActivityResultCallback(command); - try { - activity.startActivityForResult(intent, requestCode); - } catch (RuntimeException e) { // E.g.: ActivityNotFoundException - activityResultCallback = null; - throw e; - } - } - - @Override - public void setActivityResultCallback(CordovaPlugin plugin) { - // Cancel any previously pending activity. - if (activityResultCallback != null) { - activityResultCallback.onActivityResult(activityResultRequestCode, Activity.RESULT_CANCELED, null); - } - activityResultCallback = plugin; - } - - @Override - public Activity getActivity() { - return activity; - } - - @Override - public Object onMessage(String id, Object data) { - if ("exit".equals(id)) { - activity.finish(); - } - return null; - } - - @Override - public ExecutorService getThreadPool() { - return threadPool; - } - - /** - * Dispatches any pending onActivityResult callbacks and sends the resume event if the - * Activity was destroyed by the OS. - */ - public void onCordovaInit(PluginManager pluginManager) { - this.pluginManager = pluginManager; - if (savedResult != null) { - onActivityResult(savedResult.requestCode, savedResult.resultCode, savedResult.intent); - } else if(activityWasDestroyed) { - // If there was no Activity result, we still need to send out the resume event if the - // Activity was destroyed by the OS - activityWasDestroyed = false; - if(pluginManager != null) - { - CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); - if(appPlugin != null) { - JSONObject obj = new JSONObject(); - try { - obj.put("action", "resume"); - } catch (JSONException e) { - LOG.e(TAG, "Failed to create event message", e); - } - appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, obj)); - } - } - - } - } - - /** - * Routes the result to the awaiting plugin. Returns false if no plugin was waiting. - */ - public boolean onActivityResult(int requestCode, int resultCode, Intent intent) { - CordovaPlugin callback = activityResultCallback; - if(callback == null && initCallbackService != null) { - // The application was restarted, but had defined an initial callback - // before being shut down. - savedResult = new ActivityResultHolder(requestCode, resultCode, intent); - if (pluginManager != null) { - callback = pluginManager.getPlugin(initCallbackService); - if(callback != null) { - callback.onRestoreStateForActivityResult(savedPluginState.getBundle(callback.getServiceName()), - new ResumeCallback(callback.getServiceName(), pluginManager)); - } - } - } - activityResultCallback = null; - - if (callback != null) { - LOG.d(TAG, "Sending activity result to plugin"); - initCallbackService = null; - savedResult = null; - callback.onActivityResult(requestCode, resultCode, intent); - return true; - } - LOG.w(TAG, "Got an activity result, but no plugin was registered to receive it" + (savedResult != null ? " yet!" : ".")); - return false; - } - - /** - * Call this from your startActivityForResult() overload. This is required to catch the case - * where plugins use Activity.startActivityForResult() + CordovaInterface.setActivityResultCallback() - * rather than CordovaInterface.startActivityForResult(). - */ - public void setActivityResultRequestCode(int requestCode) { - activityResultRequestCode = requestCode; - } - - /** - * Saves parameters for startActivityForResult(). - */ - public void onSaveInstanceState(Bundle outState) { - if (activityResultCallback != null) { - String serviceName = activityResultCallback.getServiceName(); - outState.putString("callbackService", serviceName); - } - if(pluginManager != null){ - outState.putBundle("plugin", pluginManager.onSaveInstanceState()); - } - - } - - /** - * Call this from onCreate() so that any saved startActivityForResult parameters will be restored. - */ - public void restoreInstanceState(Bundle savedInstanceState) { - initCallbackService = savedInstanceState.getString("callbackService"); - savedPluginState = savedInstanceState.getBundle("plugin"); - activityWasDestroyed = true; - } - - private static class ActivityResultHolder { - private int requestCode; - private int resultCode; - private Intent intent; - - public ActivityResultHolder(int requestCode, int resultCode, Intent intent) { - this.requestCode = requestCode; - this.resultCode = resultCode; - this.intent = intent; - } - } - - /** - * Called by the system when the user grants permissions - * - * @param requestCode - * @param permissions - * @param grantResults - */ - public void onRequestPermissionResult(int requestCode, String[] permissions, - int[] grantResults) throws JSONException { - Pair callback = permissionResultCallbacks.getAndRemoveCallback(requestCode); - if(callback != null) { - callback.first.onRequestPermissionResult(callback.second, permissions, grantResults); - } - } - - public void requestPermission(CordovaPlugin plugin, int requestCode, String permission) { - String[] permissions = new String [1]; - permissions[0] = permission; - requestPermissions(plugin, requestCode, permissions); - } - - public void requestPermissions(CordovaPlugin plugin, int requestCode, String [] permissions) { - int mappedRequestCode = permissionResultCallbacks.registerCallback(plugin, requestCode); - getActivity().requestPermissions(permissions, mappedRequestCode); - } - - public boolean hasPermission(String permission) - { - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) - { - int result = activity.checkSelfPermission(permission); - return PackageManager.PERMISSION_GRANTED == result; - } - else - { - return true; - } - } -} http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e0c3fee6/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaPlugin.java ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaPlugin.java b/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaPlugin.java deleted file mode 100644 index 41af1db..0000000 --- a/cordova-lib/spec-cordova/fixtures/platforms/atari/framework/src/org/apache/cordova/CordovaPlugin.java +++ /dev/null @@ -1,422 +0,0 @@ -/* - 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 org.apache.cordova.CordovaArgs; -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.CordovaInterface; -import org.apache.cordova.CallbackContext; -import org.json.JSONArray; -import org.json.JSONException; - -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; - -import java.io.FileNotFoundException; -import java.io.IOException; - -/** - * Plugins must extend this class and override one of the execute methods. - */ -public class CordovaPlugin { - public CordovaWebView webView; - public CordovaInterface cordova; - protected CordovaPreferences preferences; - private String serviceName; - - /** - * Call this after constructing to initialize the plugin. - * Final because we want to be able to change args without breaking plugins. - */ - public final void privateInitialize(String serviceName, CordovaInterface cordova, CordovaWebView webView, CordovaPreferences preferences) { - assert this.cordova == null; - this.serviceName = serviceName; - this.cordova = cordova; - this.webView = webView; - this.preferences = preferences; - initialize(cordova, webView); - pluginInitialize(); - } - - /** - * Called after plugin construction and fields have been initialized. - * Prefer to use pluginInitialize instead since there is no value in - * having parameters on the initialize() function. - */ - public void initialize(CordovaInterface cordova, CordovaWebView webView) { - } - - /** - * Called after plugin construction and fields have been initialized. - */ - protected void pluginInitialize() { - } - - /** - * Returns the plugin's service name (what you'd use when calling pluginManger.getPlugin()) - */ - public String getServiceName() { - return serviceName; - } - - /** - * Executes the request. - * - * This method is called from the WebView thread. To do a non-trivial amount of work, use: - * cordova.getThreadPool().execute(runnable); - * - * To run on the UI thread, use: - * cordova.getActivity().runOnUiThread(runnable); - * - * @param action The action to execute. - * @param rawArgs The exec() arguments in JSON form. - * @param callbackContext The callback context used when calling back into JavaScript. - * @return Whether the action was valid. - */ - public boolean execute(String action, String rawArgs, CallbackContext callbackContext) throws JSONException { - JSONArray args = new JSONArray(rawArgs); - return execute(action, args, callbackContext); - } - - /** - * Executes the request. - * - * This method is called from the WebView thread. To do a non-trivial amount of work, use: - * cordova.getThreadPool().execute(runnable); - * - * To run on the UI thread, use: - * cordova.getActivity().runOnUiThread(runnable); - * - * @param action The action to execute. - * @param args The exec() arguments. - * @param callbackContext The callback context used when calling back into JavaScript. - * @return Whether the action was valid. - */ - public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - CordovaArgs cordovaArgs = new CordovaArgs(args); - return execute(action, cordovaArgs, callbackContext); - } - - /** - * Executes the request. - * - * This method is called from the WebView thread. To do a non-trivial amount of work, use: - * cordova.getThreadPool().execute(runnable); - * - * To run on the UI thread, use: - * cordova.getActivity().runOnUiThread(runnable); - * - * @param action The action to execute. - * @param args The exec() arguments, wrapped with some Cordova helpers. - * @param callbackContext The callback context used when calling back into JavaScript. - * @return Whether the action was valid. - */ - public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException { - return false; - } - - /** - * Called when the system is about to start resuming a previous activity. - * - * @param multitasking Flag indicating if multitasking is turned on for app - */ - public void onPause(boolean multitasking) { - } - - /** - * Called when the activity will start interacting with the user. - * - * @param multitasking Flag indicating if multitasking is turned on for app - */ - public void onResume(boolean multitasking) { - } - - /** - * Called when the activity is becoming visible to the user. - */ - public void onStart() { - } - - /** - * Called when the activity is no longer visible to the user. - */ - public void onStop() { - } - - /** - * Called when the activity receives a new intent. - */ - public void onNewIntent(Intent intent) { - } - - /** - * The final call you receive before your activity is destroyed. - */ - public void onDestroy() { - } - - /** - * Called when the Activity is being destroyed (e.g. if a plugin calls out to an external - * Activity and the OS kills the CordovaActivity in the background). The plugin should save its - * state in this method only if it is awaiting the result of an external Activity and needs - * to preserve some information so as to handle that result; onRestoreStateForActivityResult() - * will only be called if the plugin is the recipient of an Activity result - * - * @return Bundle containing the state of the plugin or null if state does not need to be saved - */ - public Bundle onSaveInstanceState() { - return null; - } - - /** - * Called when a plugin is the recipient of an Activity result after the CordovaActivity has - * been destroyed. The Bundle will be the same as the one the plugin returned in - * onSaveInstanceState() - * - * @param state Bundle containing the state of the plugin - * @param callbackContext Replacement Context to return the plugin result to - */ - public void onRestoreStateForActivityResult(Bundle state, CallbackContext callbackContext) {} - - /** - * Called when a message is sent to plugin. - * - * @param id The message id - * @param data The message data - * @return Object to stop propagation or null - */ - public Object onMessage(String id, Object data) { - return null; - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param intent An Intent, which can return result data to the caller (various data can be - * attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - - /** - * Hook for blocking the loading of external resources. - * - * This will be called when the WebView's shouldInterceptRequest wants to - * know whether to open a connection to an external resource. Return false - * to block the request: if any plugin returns false, Cordova will block - * the request. If all plugins return null, the default policy will be - * enforced. If at least one plugin returns true, and no plugins return - * false, then the request will proceed. - * - * Note that this only affects resource requests which are routed through - * WebViewClient.shouldInterceptRequest, such as XMLHttpRequest requests and - * img tag loads. WebSockets and media requests (such as