mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-27 04:42:51 +08:00
Merge branch 'CordovaWebView' of https://git-wip-us.apache.org/repos/asf/incubator-cordova-android into CordovaWebView
This commit is contained in:
commit
24dfbfd84f
@ -39,6 +39,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||||
@ -76,40 +77,38 @@ public class CordovaWebView extends WebView {
|
|||||||
*/
|
*/
|
||||||
public CordovaWebView(Context context) {
|
public CordovaWebView(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
if(CordovaInterface.class.isInstance(context))
|
if (CordovaInterface.class.isInstance(context))
|
||||||
{
|
{
|
||||||
this.mCtx = (CordovaInterface) context;
|
this.mCtx = (CordovaInterface) context;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
||||||
}
|
}
|
||||||
this.loadConfiguration();
|
this.loadConfiguration();
|
||||||
this.setup();
|
this.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param context
|
* @param context
|
||||||
* @param attrs
|
* @param attrs
|
||||||
*/
|
*/
|
||||||
public CordovaWebView(Context context, AttributeSet attrs) {
|
public CordovaWebView(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
if(CordovaInterface.class.isInstance(context))
|
if (CordovaInterface.class.isInstance(context))
|
||||||
{
|
{
|
||||||
this.mCtx = (CordovaInterface) context;
|
this.mCtx = (CordovaInterface) context;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
||||||
}
|
}
|
||||||
this.setWebChromeClient(new CordovaChromeClient(this.mCtx, this));
|
this.setWebChromeClient(new CordovaChromeClient(this.mCtx, this));
|
||||||
this.setWebViewClient(new CordovaWebViewClient(this.mCtx, this));
|
this.setWebViewClient(new CordovaWebViewClient(this.mCtx, this));
|
||||||
this.loadConfiguration();
|
this.loadConfiguration();
|
||||||
this.setup();
|
this.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,15 +119,15 @@ public class CordovaWebView extends WebView {
|
|||||||
* @param defStyle
|
* @param defStyle
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public CordovaWebView(Context context, AttributeSet attrs, int defStyle) {
|
public CordovaWebView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
if(CordovaInterface.class.isInstance(context))
|
if (CordovaInterface.class.isInstance(context))
|
||||||
{
|
{
|
||||||
this.mCtx = (CordovaInterface) context;
|
this.mCtx = (CordovaInterface) context;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
||||||
}
|
}
|
||||||
this.setWebChromeClient(new CordovaChromeClient(this.mCtx, this));
|
this.setWebChromeClient(new CordovaChromeClient(this.mCtx, this));
|
||||||
this.setWebViewClient(new CordovaWebViewClient(this.mCtx, this));
|
this.setWebViewClient(new CordovaWebViewClient(this.mCtx, this));
|
||||||
@ -146,13 +145,13 @@ public class CordovaWebView extends WebView {
|
|||||||
*/
|
*/
|
||||||
public CordovaWebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {
|
public CordovaWebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) {
|
||||||
super(context, attrs, defStyle, privateBrowsing);
|
super(context, attrs, defStyle, privateBrowsing);
|
||||||
if(CordovaInterface.class.isInstance(context))
|
if (CordovaInterface.class.isInstance(context))
|
||||||
{
|
{
|
||||||
this.mCtx = (CordovaInterface) context;
|
this.mCtx = (CordovaInterface) context;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
Log.d(TAG, "Your activity must implement CordovaInterface to work");
|
||||||
}
|
}
|
||||||
this.setWebChromeClient(new CordovaChromeClient(this.mCtx));
|
this.setWebChromeClient(new CordovaChromeClient(this.mCtx));
|
||||||
this.setWebViewClient(new CordovaWebViewClient(this.mCtx));
|
this.setWebViewClient(new CordovaWebViewClient(this.mCtx));
|
||||||
@ -192,10 +191,10 @@ public class CordovaWebView extends WebView {
|
|||||||
|
|
||||||
//Start up the plugin manager
|
//Start up the plugin manager
|
||||||
try {
|
try {
|
||||||
this.pluginManager = new PluginManager(this, mCtx);
|
this.pluginManager = new PluginManager(this, this.mCtx);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,6 +636,11 @@ public class CordovaWebView extends WebView {
|
|||||||
else {
|
else {
|
||||||
this.useBrowserHistory = false;
|
this.useBrowserHistory = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ("true".equals(this.getProperty("fullscreen", "false"))) {
|
||||||
|
this.mCtx.getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||||
|
this.mCtx.getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -250,15 +250,8 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
|
||||||
// TODO @bc - What about fullscreen?
|
|
||||||
//if (preferences.prefMatches("fullscreen", "true")) {
|
|
||||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
||||||
// WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
||||||
//} else {
|
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||||
//}
|
|
||||||
|
|
||||||
// This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket!
|
// This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket!
|
||||||
Display display = getWindowManager().getDefaultDisplay();
|
Display display = getWindowManager().getDefaultDisplay();
|
||||||
@ -337,10 +330,8 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @bc - background color doesn't work
|
// Set backgroundColor
|
||||||
// If backgroundColor
|
|
||||||
this.backgroundColor = this.getIntegerProperty("backgroundColor", Color.BLACK);
|
this.backgroundColor = this.getIntegerProperty("backgroundColor", Color.BLACK);
|
||||||
LOG.e(TAG, "Setting background color=" + this.backgroundColor);
|
|
||||||
this.root.setBackgroundColor(this.backgroundColor);
|
this.root.setBackgroundColor(this.backgroundColor);
|
||||||
|
|
||||||
// If keepRunning
|
// If keepRunning
|
||||||
@ -464,7 +455,18 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
Boolean p = (Boolean) bundle.get(name);
|
Boolean p;
|
||||||
|
try {
|
||||||
|
p = (Boolean) bundle.get(name);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
String s = bundle.get(name).toString();
|
||||||
|
if ("true".equals(s)) {
|
||||||
|
p = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -483,7 +485,12 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
Integer p = (Integer) bundle.get(name);
|
Integer p;
|
||||||
|
try {
|
||||||
|
p = (Integer) bundle.get(name);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
p = Integer.parseInt(bundle.get(name).toString());
|
||||||
|
}
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
@ -521,7 +528,12 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
Double p = (Double) bundle.get(name);
|
Double p;
|
||||||
|
try {
|
||||||
|
p = (Double) bundle.get(name);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
p = Double.parseDouble(bundle.get(name).toString());
|
||||||
|
}
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
9
test/AndroidManifest.xml
Normal file → Executable file
9
test/AndroidManifest.xml
Normal file → Executable file
@ -144,5 +144,14 @@
|
|||||||
<activity android:name="xhr" android:label="@string/app_name"
|
<activity android:name="xhr" android:label="@string/app_name"
|
||||||
android:configChanges="orientation|keyboardHidden">
|
android:configChanges="orientation|keyboardHidden">
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name="basicauth" android:label="@string/app_name"
|
||||||
|
android:configChanges="orientation|keyboardHidden">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="fullscreen" android:label="@string/app_name"
|
||||||
|
android:configChanges="orientation|keyboardHidden">
|
||||||
|
</activity>
|
||||||
|
<activity android:name="backgroundcolor" android:label="@string/app_name"
|
||||||
|
android:configChanges="orientation|keyboardHidden">
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
41
test/assets/www/backgroundcolor/index.html
Executable file
41
test/assets/www/backgroundcolor/index.html
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||||
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>Cordova Tests</title>
|
||||||
|
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../main.js"></script>
|
||||||
|
</head>
|
||||||
|
<body onload="init();" id="stage" class="theme">
|
||||||
|
<h1>Background Color Test</h1>
|
||||||
|
<div id="info">
|
||||||
|
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||||
|
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||||
|
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||||
|
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||||
|
</div>
|
||||||
|
<div id="info">
|
||||||
|
Before this page was show, you should have seen the background flash green.</br>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
42
test/assets/www/basicauth/index.html
Executable file
42
test/assets/www/basicauth/index.html
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||||
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>Cordova Tests</title>
|
||||||
|
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../main.js"></script>
|
||||||
|
</head>
|
||||||
|
<body onload="init();" id="stage" class="theme">
|
||||||
|
<h1>Basic Auth</h1>
|
||||||
|
<div id="info">
|
||||||
|
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||||
|
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||||
|
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||||
|
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||||
|
</div>
|
||||||
|
<div id="info">
|
||||||
|
Loading link below should be successful and show page indicating username=test & password=test. <br>
|
||||||
|
</div>
|
||||||
|
<a href="http://browserspy.dk/password-ok.php" class="btn large">Test password</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
42
test/assets/www/fullscreen/index.html
Executable file
42
test/assets/www/fullscreen/index.html
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
<!--
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||||
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>Cordova Tests</title>
|
||||||
|
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
|
||||||
|
<script type="text/javascript" charset="utf-8" src="../main.js"></script>
|
||||||
|
</head>
|
||||||
|
<body onload="init();" id="stage" class="theme">
|
||||||
|
<h1>Full Screen Test</h1>
|
||||||
|
<div id="info">
|
||||||
|
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||||
|
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||||
|
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||||
|
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||||
|
</div>
|
||||||
|
<div id="info">
|
||||||
|
The app should take over the entire screen. <br>
|
||||||
|
The top Android status bar should not be shown.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,20 +1,20 @@
|
|||||||
<!--
|
<!--
|
||||||
Licensed to the Apache Software Foundation (ASF) under one$
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file$
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information$
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file$
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the$
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance$
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at$
|
with the License. You may obtain a copy of the License at
|
||||||
$
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0$
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
$
|
|
||||||
Unless required by applicable law or agreed to in writing,$
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an$
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY$
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the$
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations$
|
specific language governing permissions and limitations
|
||||||
under the License.$
|
under the License.
|
||||||
-->
|
-->
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html>
|
<html>
|
||||||
@ -49,7 +49,10 @@ $
|
|||||||
</div>
|
</div>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.jqmtabbackbutton');">Backbutton jQM tab</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.jqmtabbackbutton');">Backbutton jQM tab</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backbuttonmultipage');">Backbutton with multiple pages</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backbuttonmultipage');">Backbutton with multiple pages</button>
|
||||||
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backgroundcolor');">Background Color</button>
|
||||||
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.basicauth');">Basic Authentication</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.errorurl');">Error URL</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.errorurl');">Error URL</button>
|
||||||
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.fullscreen');">Full Screen</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.htmlnotfound');">HTML not found</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.htmlnotfound');">HTML not found</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.iframe');">IFrame</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.iframe');">IFrame</button>
|
||||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.lifecycle');">Lifecycle</button>
|
<button class="btn large" onclick="startActivity('org.apache.cordova.test.lifecycle');">Lifecycle</button>
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package org.apache.cordova.test;
|
package org.apache.cordova.test;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.webkit.WebView;
|
|
||||||
|
|
||||||
import org.apache.cordova.*;
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
|
40
test/src/org/apache/cordova/test/backgroundcolor.java
Executable file
40
test/src/org/apache/cordova/test/backgroundcolor.java
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
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.test;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
|
public class backgroundcolor extends DroidGap {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Properties must be set before init() is called, since some are processed during init().
|
||||||
|
|
||||||
|
// backgroundColor can also be set in cordova.xml, but you must use the number equivalent of the color. For example, Color.RED is
|
||||||
|
// <preference name="backgroundColor" value="-65536" />
|
||||||
|
super.setIntegerProperty("backgroundColor", Color.GREEN);
|
||||||
|
|
||||||
|
super.init();
|
||||||
|
super.loadUrl("file:///android_asset/www/backgroundcolor/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
test/src/org/apache/cordova/test/basicauth.java
Executable file
43
test/src/org/apache/cordova/test/basicauth.java
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
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.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
|
public class basicauth extends DroidGap {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
// LogCat: onReceivedHttpAuthRequest(browserspy.dk:80,BrowserSpy.dk - HTTP Password Test)
|
||||||
|
AuthenticationToken token = new AuthenticationToken();
|
||||||
|
token.setUserName("test");
|
||||||
|
token.setPassword("test");
|
||||||
|
super.setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test");
|
||||||
|
|
||||||
|
// Add web site to whitelist
|
||||||
|
super.appView.addWhiteListEntry("http://browserspy.dk*", true);
|
||||||
|
|
||||||
|
// Load test
|
||||||
|
super.loadUrl("file:///android_asset/www/basicauth/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
39
test/src/org/apache/cordova/test/fullscreen.java
Executable file
39
test/src/org/apache/cordova/test/fullscreen.java
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
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.test;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import org.apache.cordova.*;
|
||||||
|
|
||||||
|
public class fullscreen extends DroidGap {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Properties must be set before init() is called, since some are processed during init().
|
||||||
|
|
||||||
|
// fullscreen can also be set in cordova.xml. For example,
|
||||||
|
// <preference name="fullscreen" value="true" />
|
||||||
|
super.setBooleanProperty("fullscreen", true);
|
||||||
|
|
||||||
|
super.init();
|
||||||
|
super.loadUrl("file:///android_asset/www/fullscreen/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user