Skip to content

Instantly share code, notes, and snippets.

@pre
Created January 19, 2015 13:23
Show Gist options
  • Save pre/b591aa341fd621e33eab to your computer and use it in GitHub Desktop.
Save pre/b591aa341fd621e33eab to your computer and use it in GitHub Desktop.
CordovaWebViewInterface
package org.apache.cordova;
import com.appgyver.ui.webview.AGWebViewInterface;
import android.view.View;
import android.view.ViewParent;
import android.webkit.WebChromeClient;
import java.util.HashMap;
/**
* Defines interface for implementing a WebView that provides compatibility for Cordova plugins.
*/
public interface CordovaWebViewInterface extends AGWebViewInterface {
/**
* Send a plugin result back to JavaScript. (This is a convenience method)
*/
public void sendPluginResult(PluginResult result, String callbackId);
public void loadUrl(String url);
public void setNetworkAvailable(boolean networkAvailable);
/**
* Send a message to all Cordova plugins. (Naming comes from Cordova)
*
* @param id The message id
* @param data The message data
*/
public void postMessage(String id, Object data);
public void clearCache(boolean includeDiskFiles);
public void bindButton(boolean override);
public void bindButton(String button, boolean override);
public void clearHistory();
/**
* Go to previous page in history.
*
* @return true if we went back, false if we are already at top
*/
public boolean backHistory();
/**
* Load the specified URL in the Cordova webview or a new browser instance.
*
* NOTE: If openExternal is false, only URLs listed in whitelist can be loaded.
*
* @param url The url to load.
* @param openExternal Load url in browser instead of Cordova webview.
* @param clearHistory Clear the history stack, so new page becomes top of history
* @param params Parameters for new app
*/
public void showWebPage(String url, boolean openExternal, boolean clearHistory,
HashMap<String, Object> params);
public boolean isBackButtonBound();
/**
* Gets the parent of this view. Note that the parent is a ViewParent and not necessarily a
* View.
*
* @return Parent of this view.
*/
public ViewParent getParent();
public CordovaResourceApi getResourceApi();
/**
* Send JavaScript statement back to JavaScript. (This is a convenience method)
*/
public void sendJavascript(String statement);
void handleActivityPause(boolean keepRunning);
void handleActivityResume(boolean keepRunning, boolean activityResultKeepRunning);
void handleActivityDestroy();
PluginManager getPluginManager();
void showCustomView(View view, WebChromeClient.CustomViewCallback callback);
void hideCustomView();
void setVisibility(int visibility);
NativeToJsMessageQueue getNativeToJsMessageQueue();
int getVisibility();
public void reload();
String getCookie(String url);
void setCookie(String url, String value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment