Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

CordovaWebView.java 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. package org.apache.cordova;
  18. import java.util.List;
  19. import java.util.Map;
  20. import android.content.Context;
  21. import android.content.Intent;
  22. import android.view.View;
  23. import android.webkit.WebChromeClient.CustomViewCallback;
  24. /**
  25. * Main interface for interacting with a Cordova webview - implemented by CordovaWebViewImpl.
  26. * This is an interface so that it can be easily mocked in tests.
  27. * Methods may be added to this interface without a major version bump, as plugins & embedders
  28. * are not expected to implement it.
  29. */
  30. public interface CordovaWebView {
  31. public static final String CORDOVA_VERSION = "8.1.0";
  32. void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
  33. boolean isInitialized();
  34. View getView();
  35. void loadUrlIntoView(String url, boolean recreatePlugins);
  36. void stopLoading();
  37. boolean canGoBack();
  38. void clearCache();
  39. /** Use parameter-less overload */
  40. @Deprecated
  41. void clearCache(boolean b);
  42. void clearHistory();
  43. boolean backHistory();
  44. void handlePause(boolean keepRunning);
  45. void onNewIntent(Intent intent);
  46. void handleResume(boolean keepRunning);
  47. void handleStart();
  48. void handleStop();
  49. void handleDestroy();
  50. /**
  51. * Send JavaScript statement back to JavaScript.
  52. *
  53. * Deprecated (https://issues.apache.org/jira/browse/CB-6851)
  54. * Instead of executing snippets of JS, you should use the exec bridge
  55. * to create a Java->JS communication channel.
  56. * To do this:
  57. * 1. Within plugin.xml (to have your JS run before deviceready):
  58. * <js-module><runs/></js-module>
  59. * 2. Within your .js (call exec on start-up):
  60. * require('cordova/channel').onCordovaReady.subscribe(function() {
  61. * require('cordova/exec')(win, null, 'Plugin', 'method', []);
  62. * function win(message) {
  63. * ... process message from java here ...
  64. * }
  65. * });
  66. * 3. Within your .java:
  67. * PluginResult dataResult = new PluginResult(PluginResult.Status.OK, CODE);
  68. * dataResult.setKeepCallback(true);
  69. * savedCallbackContext.sendPluginResult(dataResult);
  70. */
  71. @Deprecated
  72. void sendJavascript(String statememt);
  73. /**
  74. * Load the specified URL in the Cordova webview or a new browser instance.
  75. *
  76. * NOTE: If openExternal is false, only whitelisted URLs can be loaded.
  77. *
  78. * @param url The url to load.
  79. * @param openExternal Load url in browser instead of Cordova webview.
  80. * @param clearHistory Clear the history stack, so new page becomes top of history
  81. * @param params Parameters for new app
  82. */
  83. void showWebPage(String url, boolean openExternal, boolean clearHistory, Map<String, Object> params);
  84. /**
  85. * Deprecated in 4.0.0. Use your own View-toggling logic.
  86. */
  87. @Deprecated
  88. boolean isCustomViewShowing();
  89. /**
  90. * Deprecated in 4.0.0. Use your own View-toggling logic.
  91. */
  92. @Deprecated
  93. void showCustomView(View view, CustomViewCallback callback);
  94. /**
  95. * Deprecated in 4.0.0. Use your own View-toggling logic.
  96. */
  97. @Deprecated
  98. void hideCustomView();
  99. CordovaResourceApi getResourceApi();
  100. void setButtonPlumbedToJs(int keyCode, boolean override);
  101. boolean isButtonPlumbedToJs(int keyCode);
  102. void sendPluginResult(PluginResult cr, String callbackId);
  103. PluginManager getPluginManager();
  104. CordovaWebViewEngine getEngine();
  105. CordovaPreferences getPreferences();
  106. ICordovaCookieManager getCookieManager();
  107. String getUrl();
  108. // TODO: Work on deleting these by removing refs from plugins.
  109. Context getContext();
  110. void loadUrl(String url);
  111. Object postMessage(String id, Object data);
  112. }