本文整理汇总了Java中org.apache.cordova.CordovaWebView类的典型用法代码示例。如果您正苦于以下问题:Java CordovaWebView类的具体用法?Java CordovaWebView怎么用?Java CordovaWebView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CordovaWebView类属于org.apache.cordova包,在下文中一共展示了CordovaWebView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
cordovaInterface = cordova;
super.initialize(cordova, webView);
appName = getApplicationName(this.cordova.getActivity().getApplicationContext());
handle = new PhoneAccountHandle(new ComponentName(this.cordova.getActivity().getApplicationContext(),MyConnectionService.class),appName);
tm = (TelecomManager)this.cordova.getActivity().getApplicationContext().getSystemService(this.cordova.getActivity().getApplicationContext().TELECOM_SERVICE);
phoneAccount = new PhoneAccount.Builder(handle, appName)
.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
.build();
callbackContextMap.put("answer",new ArrayList<CallbackContext>());
callbackContextMap.put("reject",new ArrayList<CallbackContext>());
callbackContextMap.put("hangup",new ArrayList<CallbackContext>());
callbackContextMap.put("sendCall",new ArrayList<CallbackContext>());
callbackContextMap.put("receiveCall",new ArrayList<CallbackContext>());
}
示例2: execute
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
/**
* Executes the request.
*
* @param action The action to execute.
* @param cordova The cordova interface.
* @param webView The cordova web view.
*/
static void execute(String action, CordovaInterface cordova,
CordovaWebView webView) {
BackgroundExt ext = new BackgroundExt(cordova, webView);
if (action.equalsIgnoreCase("optimizations")) {
ext.disableWebViewOptimizations();
}
if (action.equalsIgnoreCase("background")) {
ext.moveToBackground();
}
if (action.equalsIgnoreCase("foreground")) {
ext.moveToForeground();
}
if (action.equalsIgnoreCase("tasklist")) {
ext.excludeFromTaskList();
}
}
示例3: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
/**
* Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity.
*
* @param cordova The context of the main Activity.
* @param webView The CordovaWebView Cordova is running in.
*/
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
this.connectionCallbackContext = null;
// We need to listen to connectivity events to update navigator.connection
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
if (this.receiver == null) {
this.receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// (The null check is for the ARM Emulator, please use Intel Emulator for better results)
if(NetworkManager.this.webView != null)
updateConnectionInfo(sockMan.getActiveNetworkInfo());
}
};
webView.getContext().registerReceiver(this.receiver, intentFilter);
}
}
示例4: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
/**
* Sets the context of the Command. This can then be used to do things like
* get file paths associated with the Activity.
*
* @param cordova The context of the main Activity.
* @param webView The CordovaWebView Cordova is running in.
*/
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
LOG.v(TAG, "StatusBar: initialization");
super.initialize(cordova, webView);
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially
// by the Cordova.
Window window = cordova.getActivity().getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000"));
// Read 'StatusBarStyle' from config.xml, default is 'lightcontent'.
setStatusBarStyle(preferences.getString("StatusBarStyle", "lightcontent"));
}
});
}
示例5: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView webView) {
super.initialize(cordova, webView);
parseCordovaConfigXml();
loadPluginInternalPreferences();
Log.d("CHCP", "Currently running release version " + pluginInternalPrefs.getCurrentReleaseVersionName());
// clean up file system
cleanupFileSystemFromOldReleases();
handler = new Handler();
fileStructure = new PluginFilesStructure(cordova.getActivity(), pluginInternalPrefs.getCurrentReleaseVersionName());
appConfigStorage = new ApplicationConfigStorage();
defaultCallbackStoredResults = new ArrayList<PluginResult>();
}
示例6: privateInitialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
/**
* 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();
}
示例7: init
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, CordovaWebViewEngine.Client client,
CordovaResourceApi resourceApi, PluginManager pluginManager,
NativeToJsMessageQueue nativeToJsMessageQueue) {
if (this.cordova != null) {
throw new IllegalStateException();
}
// Needed when prefs are not passed by the constructor
if (preferences == null) {
preferences = parentWebView.getPreferences();
}
this.parentWebView = parentWebView;
this.cordova = cordova;
this.client = client;
this.resourceApi = resourceApi;
this.pluginManager = pluginManager;
this.nativeToJsMessageQueue = nativeToJsMessageQueue;
webView.init(this, cordova);
initWebViewSettings();
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
@Override
public void setNetworkAvailable(boolean value) {
webView.setNetworkAvailable(value);
}
@Override
public void runOnUiThread(Runnable r) {
SystemWebViewEngine.this.cordova.getActivity().runOnUiThread(r);
}
}));
if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
exposeJsInterface(webView, bridge);
}
示例8: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView webView) {
super.initialize(cordova, webView);
// parse config only if main plugin is installed
isChcpPluginInstalled = isHotCodePushPluginIsInstalled();
if (isChcpPluginInstalled) {
parseCordovaConfigXml();
}
}
示例9: emitWindowEvent
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
private void emitWindowEvent(final String event, final JSONObject data) {
final CordovaWebView view = this.webView;
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
view.loadUrl(String.format("javascript:cordova.fireWindowEvent('%s', %s);", event, data.toString()));
}
});
}
示例10: testViaLoadUrl
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Test
public void testViaLoadUrl() throws Throwable {
final CordovaWebView webInterface = mActivity.getWebInterface();
assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
mActivityRule.runOnUiThread(new Runnable() {
public void run() {
webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
}
});
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take());
mActivityRule.runOnUiThread(new Runnable() {
public void run() {
webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
}
});
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", mActivity.onPageFinishedUrl.take());
mActivityRule.runOnUiThread(new Runnable() {
public void run() {
assertTrue(webInterface.backHistory());
}
});
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", mActivity.onPageFinishedUrl.take());
mActivityRule.runOnUiThread(new Runnable() {
public void run() {
assertTrue(webInterface.backHistory());
}
});
assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
mActivityRule.runOnUiThread(new Runnable() {
public void run() {
assertFalse(webInterface.backHistory());
}
});
}
示例11: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
_cordova = cordova;
_cordovaActivity = cordova.getActivity();
_sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_cordovaActivity);
_permissionsController = new PermissionsController(_cordovaActivity, _cordova);
_permissionsController.handleOnInitialize();
removeActionPreferences();
Log.d(TAG, "Initialized");
}
示例12: checkBackgroundIntentCheck
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Test
public void checkBackgroundIntentCheck() {
StandardActivity activity = (StandardActivity) mActivityRule.getActivity();
final SystemWebView webView = (SystemWebView) activity.getWindow().getCurrentFocus();
CordovaWebView webInterface = webView.getCordovaWebView();
CordovaPreferences prefs = webInterface.getPreferences();
assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN);
}
示例13: initialize
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
activity = cordova.getActivity();
//如果是首次启动,并且点击的通知消息,则处理消息
if (openNotificationId != 0) {
notificationOpened(openNotificationId, openNotificationExtras);
}
}
示例14: init
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
@Override
public void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client,
CordovaResourceApi resourceApi, PluginManager pluginManager,
NativeToJsMessageQueue nativeToJsMessageQueue) {
if (this.cordova != null) {
throw new IllegalStateException();
}
// Needed when prefs are not passed by the constructor
if (preferences == null) {
preferences = parentWebView.getPreferences();
}
this.parentWebView = parentWebView;
this.cordova = cordova;
this.client = client;
this.resourceApi = resourceApi;
this.pluginManager = pluginManager;
this.nativeToJsMessageQueue = nativeToJsMessageQueue;
webView.init(this, cordova);
initWebViewSettings();
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() {
@Override
public void setNetworkAvailable(boolean value) {
webView.setNetworkAvailable(value);
}
@Override
public void runOnUiThread(Runnable r) {
X5WebViewEngine.this.cordova.getActivity().runOnUiThread(r);
}
}));
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)
nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.EvalBridgeMode(this, cordova));
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
exposeJsInterface(webView, bridge);
}
示例15: fireEvent
import org.apache.cordova.CordovaWebView; //导入依赖的package包/类
private void fireEvent(final String event) {
final CordovaWebView view = this.webView;
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
view.loadUrl("javascript:cordova.fireDocumentEvent('" + event + "');");
}
});
}