mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-18 22:52:54 +08:00
Tests to verify Android native features.
This commit is contained in:
parent
dfc86b1af1
commit
c18c0b415e
9
test/.classpath
Executable file
9
test/.classpath
Executable file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="lib" path="libs/cordova-1.6.0rc1.jar"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
33
test/.project
Executable file
33
test/.project
Executable file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>CordovaTest</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
87
test/AndroidManifest.xml
Executable file
87
test/AndroidManifest.xml
Executable file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
|
||||
package="org.apache.cordova.test" android:versionName="1.1" android:versionCode="5">
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:xlargeScreens="true"
|
||||
android:resizeable="true"
|
||||
android:anyDensity="true"
|
||||
/>
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:debuggable="true">
|
||||
<activity android:name="tests" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="splashscreen" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="timeout" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="htmlnotfound" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="errorurl" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="userwebview" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="menus" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="loading" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="lifecycle" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="jqmtabbackbutton" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="backbuttonmultipage" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="whitelist" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="background" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="iframe" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
<activity android:name="xhr" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="5" />
|
||||
</manifest>
|
23
test/assets/www/backbuttonmultipage/index.html
Executable file
23
test/assets/www/backbuttonmultipage/index.html
Executable file
@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Backbutton</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>
|
||||
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</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">
|
||||
<h4>Page 1</h4>
|
||||
Go to next page.<br>
|
||||
If returning from previous page, press "backbutton". You should exit this app.
|
||||
</div>
|
||||
<a href="sample2.html" class="btn large">Next page</a>
|
||||
</body>
|
||||
</html>
|
23
test/assets/www/backbuttonmultipage/sample2.html
Executable file
23
test/assets/www/backbuttonmultipage/sample2.html
Executable file
@ -0,0 +1,23 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Backbutton</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>
|
||||
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</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">
|
||||
<h4>Page 2</h4>
|
||||
Go to next page.<br>
|
||||
If returning from previous page, press "backbutton". You should go to Page 1.
|
||||
</div>
|
||||
<a href="sample3.html" class="btn large">Next page</a>
|
||||
</body>
|
||||
</html>
|
25
test/assets/www/backbuttonmultipage/sample3.html
Executable file
25
test/assets/www/backbuttonmultipage/sample3.html
Executable file
@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Backbutton</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>
|
||||
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</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">
|
||||
<h4>Page 3</h4>
|
||||
Press the 3 buttons below. You should stay on same page. (NOTE: IS THIS CORRECT? - DOESN'T SEEM TO WORK.)<br>
|
||||
Press "backbutton". You should go to Page 2.
|
||||
</div>
|
||||
<a href="sample3.html#test1" class="btn large">page3#test1</a>
|
||||
<a href="sample3.html#test2" class="btn large">page3#test2</a>
|
||||
<a href="sample3.html#test3" class="btn large">page3#test3</a>
|
||||
</body>
|
||||
</html>
|
99
test/assets/www/background/index.html
Executable file
99
test/assets/www/background/index.html
Executable file
@ -0,0 +1,99 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Background Page 1</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">
|
||||
|
||||
function onLoad() {
|
||||
console.log("Page1: onload");
|
||||
log("Page1: onload @ " + new Date().toLocaleTimeString());
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
function onUnLoaded() {
|
||||
console.log("Page1: onunload");
|
||||
log("Page1: onunload @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
|
||||
window.setInterval(function() {
|
||||
log("Page1: Running");
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function onPause() {
|
||||
console.log("Page1: onpause");
|
||||
log("Page1: onpause @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onResume() {
|
||||
console.log("Page1: onresume");
|
||||
log("Page1: onresume @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function log(s) {
|
||||
var el = document.getElementById('status');
|
||||
var status = el.innerHTML + s + "<br>";
|
||||
el.innerHTML = status;
|
||||
localStorage.backgroundstatus = status;
|
||||
}
|
||||
|
||||
function clearStatus() {
|
||||
console.log("clear()");
|
||||
localStorage.backgroundstatus = "";
|
||||
document.getElementById('status').innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</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">
|
||||
<h4>Press "Home" button, then return to this app to see pause/resume.<br>
|
||||
There shouldn't be any "Running" entries between pause and resume.</h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Info for event testing:</h4>
|
||||
<div id="status"></div>
|
||||
</div>
|
||||
|
||||
<a href="index2.html" class="btn large" >Load new page</a>
|
||||
<a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
|
||||
|
||||
<script>
|
||||
document.getElementById('status').innerHTML = localStorage.backgroundstatus;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
98
test/assets/www/background/index2.html
Executable file
98
test/assets/www/background/index2.html
Executable file
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Background Page 2</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">
|
||||
|
||||
function onLoad() {
|
||||
console.log("Page2: onload");
|
||||
log("Page2: onload @ " + new Date().toLocaleTimeString());
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
function onUnLoaded() {
|
||||
console.log("Page2: onunload");
|
||||
log("Page2: onunload @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
|
||||
window.setInterval(function() {
|
||||
log("Page2: Running");
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function onPause() {
|
||||
console.log("Page2: onpause");
|
||||
log("Page2: onpause @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onResume() {
|
||||
console.log("Page2: onresume");
|
||||
log("Page2: onresume @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function log(s) {
|
||||
var el = document.getElementById('status');
|
||||
var status = el.innerHTML + s + "<br>";
|
||||
el.innerHTML = status;
|
||||
localStorage.backgroundstatus = status;
|
||||
}
|
||||
|
||||
function clearStatus() {
|
||||
console.log("clear()");
|
||||
localStorage.backgroundstatus = "";
|
||||
document.getElementById('status').innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</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">
|
||||
<h4>Press "Back" button to return to Page 1.</h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Info for event testing:</h4>
|
||||
<div id="status"></div>
|
||||
</div>
|
||||
|
||||
<a href="index.html" class="btn large" >Load new page</a>
|
||||
<a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
|
||||
|
||||
<script>
|
||||
document.getElementById('status').innerHTML = localStorage.backgroundstatus;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
4895
test/assets/www/cordova-1.6.0rc1.js
Executable file
4895
test/assets/www/cordova-1.6.0rc1.js
Executable file
File diff suppressed because it is too large
Load Diff
2
test/assets/www/cordova.js
vendored
Executable file
2
test/assets/www/cordova.js
vendored
Executable file
@ -0,0 +1,2 @@
|
||||
document.write('<script type="text/javascript" charset="utf-8" src="../cordova-1.6.0rc1.js"></script>');
|
||||
document.write('<script type="text/javascript" charset="utf-8" src="cordova-1.6.0rc1.js"></script>');
|
1
test/assets/www/htmlnotfound/error.html
Executable file
1
test/assets/www/htmlnotfound/error.html
Executable file
@ -0,0 +1 @@
|
||||
This is an error page.
|
32
test/assets/www/iframe/index.html
Executable file
32
test/assets/www/iframe/index.html
Executable file
@ -0,0 +1,32 @@
|
||||
<!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>
|
||||
<script>
|
||||
function loadUrl(url) {
|
||||
document.getElementById('iframe').src = url;
|
||||
}</script>
|
||||
</head>
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>IFrame</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 Google Maps should be successful.<br>
|
||||
Some reason loading Page 2 & Cordova page replaces current page. (ERROR?)
|
||||
</div>
|
||||
<iframe id="iframe" src="" width="100%" height="200px"></iframe>
|
||||
<a href="javascript:" class="btn large" onclick="loadUrl('http://maps.google.com/maps?output=embed');">Google Maps</a>
|
||||
<a href="javascript:" class="btn large" onclick="loadUrl('index2.html');">Page 2</a>
|
||||
<a href="javascript:" class="btn large" onclick="loadUrl('file:///android_asset/www/lifecycle/index.html');">Cordova page</a>
|
||||
</body>
|
||||
</html>
|
23
test/assets/www/iframe/index2.html
Executable file
23
test/assets/www/iframe/index2.html
Executable file
@ -0,0 +1,23 @@
|
||||
<!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>IFrame window</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">
|
||||
This is displaying a Cordova page inside iframe. The info above should be filled out.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
44
test/assets/www/index.html
Executable file
44
test/assets/www/index.html
Executable file
@ -0,0 +1,44 @@
|
||||
<!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>
|
||||
<script>
|
||||
function startActivity(className) {
|
||||
cordova.exec(function() {console.log("Success");}, function(e) {console.log("Error: "+e);}, "Activity", "start", [className]);
|
||||
};
|
||||
|
||||
localStorage.lifecyclestatus = "";
|
||||
localStorage.backgroundstatus = "";
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</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>
|
||||
|
||||
<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.errorurl');">Error URL</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.lifecycle');">Lifecycle</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.loading');">Loading indicator</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.menus');">Menus</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.background');">No multitasking</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.splashscreen');">Splash screen</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.timeout');">Load timeout</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.userwebview');">User WebView/Client/Chrome</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.whitelist');">Whitelist</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.xhr');">XHR</button>
|
||||
</body>
|
||||
</html>
|
49
test/assets/www/jqmtabbackbutton/index.html
Executable file
49
test/assets/www/jqmtabbackbutton/index.html
Executable file
@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Backbutton</title>
|
||||
|
||||
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
|
||||
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
|
||||
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
|
||||
<script type="text/javascript" src="../cordova.js"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
|
||||
// Without backbutton handler, each tab loaded will be popped off history until history is empty, then it will exit app.
|
||||
function handleBackButton() {
|
||||
alert("Back Button Pressed! - exiting app");
|
||||
navigator.app.exitApp();
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
console.log("onDeviceReady()");
|
||||
document.addEventListener("backbutton", handleBackButton, false);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div data-role="page" id="tabTab">
|
||||
<div data-role="header">
|
||||
<h1>Main</h1>
|
||||
</div>
|
||||
<div data-role="content" id="tabContent">
|
||||
To test, press several tabs.<br>
|
||||
The "backbutton" can be pressed any time to exit app.
|
||||
</div>
|
||||
<div data-role="footer" data-position="fixed">
|
||||
<div data-role="navbar">
|
||||
<ul>
|
||||
<li><a href="tab1.html" data-transition="none">Tab 1</a>
|
||||
</li>
|
||||
<li><a href="tab2.html" data-transition="none">Tab 2</a>
|
||||
</li>
|
||||
<li><a href="tab3.html" data-transition="none">Tab 3</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
29
test/assets/www/jqmtabbackbutton/tab1.html
Executable file
29
test/assets/www/jqmtabbackbutton/tab1.html
Executable file
@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Tab 1</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div data-role="page" id="tab1Tab">
|
||||
<div data-role="header">
|
||||
<h1>Tab 1</h1>
|
||||
</div>
|
||||
<div data-role="content" id="tab1Content">
|
||||
Tab 1 content.
|
||||
</div>
|
||||
<div data-role="footer" data-position="fixed">
|
||||
<div data-role="navbar">
|
||||
<ul>
|
||||
<li><a href="tab1.html" data-transition="none">Tab 1</a>
|
||||
</li>
|
||||
<li><a href="tab2.html" data-transition="none">Tab 2</a>
|
||||
</li>
|
||||
<li><a href="tab3.html" data-transition="none">Tab 3</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /navbar -->
|
||||
</div>
|
||||
<!-- /footer -->
|
||||
</div>
|
30
test/assets/www/jqmtabbackbutton/tab2.html
Executable file
30
test/assets/www/jqmtabbackbutton/tab2.html
Executable file
@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Tab 2</title>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div data-role="page" id="tab2Tab">
|
||||
<div data-role="header">
|
||||
<h1>Tab 2</h1>
|
||||
</div>
|
||||
<div data-role="content" id="tab2Content">
|
||||
Tab 2 content.
|
||||
</div>
|
||||
<div data-role="footer" data-position="fixed">
|
||||
<div data-role="navbar">
|
||||
<ul>
|
||||
<li><a href="tab1.html" data-transition="none">Tab 1</a>
|
||||
</li>
|
||||
<li><a href="tab2.html" data-transition="none">Tab 2</a>
|
||||
</li>
|
||||
<li><a href="tab3.html" data-transition="none">Tab 3</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /navbar -->
|
||||
</div>
|
||||
<!-- /footer -->
|
||||
</div>
|
30
test/assets/www/jqmtabbackbutton/tab3.html
Executable file
30
test/assets/www/jqmtabbackbutton/tab3.html
Executable file
@ -0,0 +1,30 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Tab 3</title>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div data-role="page" id="tab3Tab">
|
||||
<div data-role="header">
|
||||
<h1>Tab 3</h1>
|
||||
</div>
|
||||
<div data-role="content" id="tab3Content">
|
||||
Tab 3 content.
|
||||
</div>
|
||||
<div data-role="footer" data-position="fixed">
|
||||
<div data-role="navbar">
|
||||
<ul>
|
||||
<li><a href="tab1.html" data-transition="none">Tab 1</a>
|
||||
</li>
|
||||
<li><a href="tab2.html" data-transition="none">Tab 2</a>
|
||||
</li>
|
||||
<li><a href="tab3.html" data-transition="none">Tab 3</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /navbar -->
|
||||
</div>
|
||||
<!-- /footer -->
|
||||
</div>
|
99
test/assets/www/lifecycle/index.html
Executable file
99
test/assets/www/lifecycle/index.html
Executable file
@ -0,0 +1,99 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Lifecycle Page 1</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">
|
||||
|
||||
function onLoad() {
|
||||
console.log("Page1: onload");
|
||||
log("Page1: onload @ " + new Date().toLocaleTimeString());
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
function onUnLoaded() {
|
||||
console.log("Page1: onunload");
|
||||
log("Page1: onunload @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
|
||||
window.setInterval(function() {
|
||||
log("Page1: Running");
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function onPause() {
|
||||
console.log("Page1: onpause");
|
||||
log("Page1: onpause @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onResume() {
|
||||
console.log("Page1: onresume");
|
||||
log("Page1: onresume @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function log(s) {
|
||||
var el = document.getElementById('status');
|
||||
var status = el.innerHTML + s + "<br>";
|
||||
el.innerHTML = status;
|
||||
localStorage.lifecyclestatus = status;
|
||||
}
|
||||
|
||||
function clearStatus() {
|
||||
console.log("clear()");
|
||||
localStorage.lifecyclestatus = "";
|
||||
document.getElementById('status').innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</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">
|
||||
<h4>Press "Home" button, then return to this app to see pause/resume.<br>
|
||||
There should be "Running" entries between pause and resume since app continues to run in the background.</h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Info for event testing:</h4>
|
||||
<div id="status"></div>
|
||||
</div>
|
||||
|
||||
<a href="index2.html" class="btn large" >Load new page</a>
|
||||
<a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
|
||||
|
||||
<script>
|
||||
document.getElementById('status').innerHTML = localStorage.lifecyclestatus;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
98
test/assets/www/lifecycle/index2.html
Executable file
98
test/assets/www/lifecycle/index2.html
Executable file
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Lifecycle Page 2</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">
|
||||
|
||||
function onLoad() {
|
||||
console.log("Page2: onload");
|
||||
log("Page2: onload @ " + new Date().toLocaleTimeString());
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
function onUnLoaded() {
|
||||
console.log("Page2: onunload");
|
||||
log("Page2: onunload @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
|
||||
window.setInterval(function() {
|
||||
log("Page2: Running");
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function onPause() {
|
||||
console.log("Page2: onpause");
|
||||
log("Page2: onpause @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function onResume() {
|
||||
console.log("Page2: onresume");
|
||||
log("Page2: onresume @ " + new Date().toLocaleTimeString());
|
||||
}
|
||||
|
||||
function log(s) {
|
||||
var el = document.getElementById('status');
|
||||
var status = el.innerHTML + s + "<br>";
|
||||
el.innerHTML = status;
|
||||
localStorage.lifecyclestatus = status;
|
||||
}
|
||||
|
||||
function clearStatus() {
|
||||
console.log("clear()");
|
||||
localStorage.lifecyclestatus = "";
|
||||
document.getElementById('status').innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</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">
|
||||
<h4>Press "Back" button to return to Page 1.</h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Info for event testing:</h4>
|
||||
<div id="status"></div>
|
||||
</div>
|
||||
|
||||
<a href="index.html" class="btn large" >Load new page</a>
|
||||
<a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
|
||||
|
||||
<script>
|
||||
document.getElementById('status').innerHTML = localStorage.lifecyclestatus;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
146
test/assets/www/main.js
Executable file
146
test/assets/www/main.js
Executable file
@ -0,0 +1,146 @@
|
||||
var deviceInfo = function() {
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
};
|
||||
|
||||
var getLocation = function() {
|
||||
var suc = function(p) {
|
||||
alert(p.coords.latitude + " " + p.coords.longitude);
|
||||
};
|
||||
var locFail = function() {
|
||||
};
|
||||
navigator.geolocation.getCurrentPosition(suc, locFail);
|
||||
};
|
||||
|
||||
var beep = function() {
|
||||
navigator.notification.beep(2);
|
||||
};
|
||||
|
||||
var vibrate = function() {
|
||||
navigator.notification.vibrate(0);
|
||||
};
|
||||
|
||||
function roundNumber(num) {
|
||||
var dec = 3;
|
||||
var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
|
||||
return result;
|
||||
}
|
||||
|
||||
var accelerationWatch = null;
|
||||
|
||||
function updateAcceleration(a) {
|
||||
document.getElementById('x').innerHTML = roundNumber(a.x);
|
||||
document.getElementById('y').innerHTML = roundNumber(a.y);
|
||||
document.getElementById('z').innerHTML = roundNumber(a.z);
|
||||
}
|
||||
|
||||
var toggleAccel = function() {
|
||||
if (accelerationWatch !== null) {
|
||||
navigator.accelerometer.clearWatch(accelerationWatch);
|
||||
updateAcceleration({
|
||||
x : "",
|
||||
y : "",
|
||||
z : ""
|
||||
});
|
||||
accelerationWatch = null;
|
||||
} else {
|
||||
var options = {};
|
||||
options.frequency = 1000;
|
||||
accelerationWatch = navigator.accelerometer.watchAcceleration(
|
||||
updateAcceleration, function(ex) {
|
||||
alert("accel fail (" + ex.name + ": " + ex.message + ")");
|
||||
}, options);
|
||||
}
|
||||
};
|
||||
|
||||
var preventBehavior = function(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
function dump_pic(data) {
|
||||
var viewport = document.getElementById('viewport');
|
||||
console.log(data);
|
||||
viewport.style.display = "";
|
||||
viewport.style.position = "absolute";
|
||||
viewport.style.top = "10px";
|
||||
viewport.style.left = "10px";
|
||||
document.getElementById("test_img").src = "data:image/jpeg;base64," + data;
|
||||
}
|
||||
|
||||
function fail(msg) {
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
function show_pic() {
|
||||
navigator.camera.getPicture(dump_pic, fail, {
|
||||
quality : 50
|
||||
});
|
||||
}
|
||||
|
||||
function close() {
|
||||
var viewport = document.getElementById('viewport');
|
||||
viewport.style.position = "relative";
|
||||
viewport.style.display = "none";
|
||||
}
|
||||
|
||||
function contacts_success(contacts) {
|
||||
alert(contacts.length
|
||||
+ ' contacts returned.'
|
||||
+ (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted)
|
||||
: ''));
|
||||
}
|
||||
|
||||
function get_contacts() {
|
||||
var obj = new ContactFindOptions();
|
||||
obj.filter = "";
|
||||
obj.multiple = true;
|
||||
navigator.contacts.find(
|
||||
[ "displayName", "name" ], contacts_success,
|
||||
fail, obj);
|
||||
}
|
||||
|
||||
function check_network() {
|
||||
var networkState = navigator.network.connection.type;
|
||||
|
||||
var states = {};
|
||||
states[Connection.UNKNOWN] = 'Unknown connection';
|
||||
states[Connection.ETHERNET] = 'Ethernet connection';
|
||||
states[Connection.WIFI] = 'WiFi connection';
|
||||
states[Connection.CELL_2G] = 'Cell 2G connection';
|
||||
states[Connection.CELL_3G] = 'Cell 3G connection';
|
||||
states[Connection.CELL_4G] = 'Cell 4G connection';
|
||||
states[Connection.NONE] = 'No network connection';
|
||||
|
||||
confirm('Connection type:\n ' + states[networkState]);
|
||||
}
|
||||
|
||||
var watchID = null;
|
||||
|
||||
function updateHeading(h) {
|
||||
document.getElementById('h').innerHTML = h.magneticHeading;
|
||||
}
|
||||
|
||||
function toggleCompass() {
|
||||
if (watchID !== null) {
|
||||
navigator.compass.clearWatch(watchID);
|
||||
watchID = null;
|
||||
updateHeading({ magneticHeading : "Off"});
|
||||
} else {
|
||||
var options = { frequency: 1000 };
|
||||
watchID = navigator.compass.watchHeading(updateHeading, function(e) {
|
||||
alert('Compass Error: ' + e.code);
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
// the next line makes it impossible to see Contacts on the HTC Evo since it
|
||||
// doesn't have a scroll button
|
||||
// document.addEventListener("touchmove", preventBehavior, false);
|
||||
document.addEventListener("deviceready", deviceInfo, true);
|
||||
}
|
117
test/assets/www/master.css
Executable file
117
test/assets/www/master.css
Executable file
@ -0,0 +1,117 @@
|
||||
body {
|
||||
background:#222 none repeat scroll 0 0;
|
||||
color:#666;
|
||||
font-family:Helvetica;
|
||||
font-size:72%;
|
||||
line-height:1.5em;
|
||||
margin:0;
|
||||
border-top:1px solid #393939;
|
||||
}
|
||||
|
||||
#info{
|
||||
background:#ffa;
|
||||
border: 1px solid #ffd324;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
clear:both;
|
||||
margin:15px 6px 0;
|
||||
width:295px;
|
||||
padding:4px 0px 2px 10px;
|
||||
}
|
||||
|
||||
#info > h4{
|
||||
font-size:.95em;
|
||||
margin:5px 0;
|
||||
}
|
||||
|
||||
#stage.theme{
|
||||
padding-top:3px;
|
||||
}
|
||||
|
||||
/* Definition List */
|
||||
#stage.theme > dl{
|
||||
padding-top:10px;
|
||||
clear:both;
|
||||
margin:0;
|
||||
list-style-type:none;
|
||||
padding-left:10px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
#stage.theme > dl > dt{
|
||||
font-weight:bold;
|
||||
float:left;
|
||||
margin-left:5px;
|
||||
}
|
||||
|
||||
#stage.theme > dl > dd{
|
||||
width:45px;
|
||||
float:left;
|
||||
color:#a87;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Content Styling */
|
||||
#stage.theme > h1, #stage.theme > h2, #stage.theme > p{
|
||||
margin:1em 0 .5em 13px;
|
||||
}
|
||||
|
||||
#stage.theme > h1{
|
||||
color:#eee;
|
||||
font-size:1.6em;
|
||||
text-align:center;
|
||||
margin:0;
|
||||
margin-top:15px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#stage.theme > h2{
|
||||
clear:both;
|
||||
margin:0;
|
||||
padding:3px;
|
||||
font-size:1em;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
/* Stage Buttons */
|
||||
#stage.theme a.btn{
|
||||
border: 1px solid #555;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
text-align:center;
|
||||
display:block;
|
||||
float:left;
|
||||
background:#444;
|
||||
width:150px;
|
||||
color:#9ab;
|
||||
font-size:1.1em;
|
||||
text-decoration:none;
|
||||
padding:1.2em 0;
|
||||
margin:3px 0px 3px 5px;
|
||||
}
|
||||
#stage.theme a.btn.large{
|
||||
width:308px;
|
||||
padding:1.2em 0;
|
||||
}
|
||||
|
||||
/* Stage Buttons */
|
||||
#stage.theme button.btn{
|
||||
border: 1px solid #555;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
text-align:center;
|
||||
display:block;
|
||||
float:left;
|
||||
background:#444;
|
||||
width:150px;
|
||||
color:#9ab;
|
||||
font-size:1.1em;
|
||||
text-decoration:none;
|
||||
padding:1.2em 0;
|
||||
margin:3px 0px 3px 5px;
|
||||
}
|
||||
#stage.theme button.btn.large{
|
||||
width:308px;
|
||||
padding:1.2em 0;
|
||||
}
|
||||
|
29
test/assets/www/menus/index.html
Executable file
29
test/assets/www/menus/index.html
Executable file
@ -0,0 +1,29 @@
|
||||
<!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>Menu 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">
|
||||
<h4>The menu items should be:</h4>
|
||||
<li>Item1<br>
|
||||
<li>Item2<br>
|
||||
<li>Item3<br>
|
||||
<h4>There is also a context menu. Touch and hold finger here to see:</h4>
|
||||
<li>Context Item1<br>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
22
test/assets/www/splashscreen/index.html
Executable file
22
test/assets/www/splashscreen/index.html
Executable file
@ -0,0 +1,22 @@
|
||||
<!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>Splash 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">
|
||||
You should have seen the splash screen for 2 seconds.</div>
|
||||
</body>
|
||||
</html>
|
49
test/assets/www/userwebview/index.html
Executable file
49
test/assets/www/userwebview/index.html
Executable file
@ -0,0 +1,49 @@
|
||||
<!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>User WebView/Client/Chrome 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">
|
||||
<h4>The following should be seen in LogCat:</h4>
|
||||
<li>userwebview: TestViewClient()<br>
|
||||
<li>userwebview: TestChromeClient()<br>
|
||||
<li>userwebview: onGeolocationPermissionsShowPrompt(file://)<br>
|
||||
<li>userwebview: shouldOverrideUrlLoading(test://this_will_call_shouldOverrideUrlLoading)<br>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
/**
|
||||
* Get current location
|
||||
*/
|
||||
console.log("getLocation()");
|
||||
|
||||
// Success callback
|
||||
var success = function(p){
|
||||
console.log("Location = "+p.coords.latitude+","+p.coords.longitude);
|
||||
window.location = "test://this_will_call_shouldOverrideUrlLoading";
|
||||
};
|
||||
|
||||
// Fail callback
|
||||
var fail = function(e){
|
||||
console.log("Error: "+e.code);
|
||||
};
|
||||
|
||||
// Get location
|
||||
navigator.geolocation.getCurrentPosition(success, fail, {enableHighAccuracy: true});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
28
test/assets/www/whitelist/index.html
Executable file
28
test/assets/www/whitelist/index.html
Executable file
@ -0,0 +1,28 @@
|
||||
<!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>Whitelist Page 1</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 Page 2 should be successful.<br>
|
||||
Loading Page 3 should be in web browser.
|
||||
Loading Page 2 with target=_blank should be in web browser? (THIS DOESN'T HAPPEN.) https://issues.apache.org/jira/browse/CB-362
|
||||
</div>
|
||||
<a href="index2.html" class="btn large">Page 2</a>
|
||||
<a href="http://www.google.com" class="btn large">Page 3</a>
|
||||
<a href="index2.html" class="btn large" target="_blank">Page 2 with target=_blank</a>
|
||||
</body>
|
||||
</html>
|
23
test/assets/www/whitelist/index2.html
Executable file
23
test/assets/www/whitelist/index2.html
Executable file
@ -0,0 +1,23 @@
|
||||
<!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>Whitelist Page 2</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">
|
||||
Press "backbutton"
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
47
test/assets/www/xhr/index.html
Executable file
47
test/assets/www/xhr/index.html
Executable file
@ -0,0 +1,47 @@
|
||||
<!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>
|
||||
<script>
|
||||
function XHR(url) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange=function(){
|
||||
if(xmlhttp.readyState === 4){
|
||||
// If success
|
||||
if (xmlhttp.status === 200) {
|
||||
alert("XHR success. Result="+xmlhttp.responseText);
|
||||
}
|
||||
// If error
|
||||
else {
|
||||
alert("XHR error. Status="+xmlhttp.status);
|
||||
}
|
||||
}
|
||||
};
|
||||
console.log("GET "+url);
|
||||
xmlhttp.open("GET", url , true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>XHR</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">
|
||||
</div>
|
||||
<a href="javascript:" class="btn large" onclick="XHR('file:///android_asset/www/xhr/index.html')">Load file://</a>
|
||||
<a href="javascript:" class="btn large" onclick="XHR('http://www.google.com');">Load Google</a>
|
||||
<!--
|
||||
<a href="javascript:" class="btn large" onclick="XHR('content://com.android.contacts/data/1');">Load content://</a>
|
||||
-->
|
||||
</body>
|
||||
</html>
|
BIN
test/libs/cordova-1.6.0rc1.jar
Executable file
BIN
test/libs/cordova-1.6.0rc1.jar
Executable file
Binary file not shown.
11
test/project.properties
Executable file
11
test/project.properties
Executable file
@ -0,0 +1,11 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=Google Inc.:Google APIs:14
|
BIN
test/res/drawable-hdpi/ic_launcher.png
Executable file
BIN
test/res/drawable-hdpi/ic_launcher.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
BIN
test/res/drawable-ldpi/ic_launcher.png
Executable file
BIN
test/res/drawable-ldpi/ic_launcher.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
test/res/drawable-mdpi/ic_launcher.png
Executable file
BIN
test/res/drawable-mdpi/ic_launcher.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
test/res/drawable/icon.png
Executable file
BIN
test/res/drawable/icon.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
test/res/drawable/sandy.jpg
Executable file
BIN
test/res/drawable/sandy.jpg
Executable file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
13
test/res/layout/main.xml
Executable file
13
test/res/layout/main.xml
Executable file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, tests"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
4
test/res/values/strings.xml
Executable file
4
test/res/values/strings.xml
Executable file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">CordovaTests</string>
|
||||
</resources>
|
5
test/res/xml/cordova.xml
Executable file
5
test/res/xml/cordova.xml
Executable file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<cordova>
|
||||
<access origin="http://127.0.0.1*"/>
|
||||
<log level="DEBUG"/>
|
||||
</cordova>
|
19
test/res/xml/plugins.xml
Executable file
19
test/res/xml/plugins.xml
Executable file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<plugins>
|
||||
<plugin name="App" value="org.apache.cordova.App"/>
|
||||
<plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
|
||||
<plugin name="Device" value="org.apache.cordova.Device"/>
|
||||
<plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
|
||||
<plugin name="Compass" value="org.apache.cordova.CompassListener"/>
|
||||
<plugin name="Media" value="org.apache.cordova.AudioHandler"/>
|
||||
<plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
|
||||
<plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
|
||||
<plugin name="File" value="org.apache.cordova.FileUtils"/>
|
||||
<plugin name="Network Status" value="org.apache.cordova.NetworkManager"/>
|
||||
<plugin name="Notification" value="org.apache.cordova.Notification"/>
|
||||
<plugin name="Storage" value="org.apache.cordova.Storage"/>
|
||||
<plugin name="Temperature" value="org.apache.cordova.TempListener"/>
|
||||
<plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
|
||||
<plugin name="Capture" value="org.apache.cordova.Capture"/>
|
||||
<plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
|
||||
</plugins>
|
63
test/src/org/apache/cordova/test/ActivityPlugin.java
Executable file
63
test/src/org/apache/cordova/test/ActivityPlugin.java
Executable file
@ -0,0 +1,63 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import org.apache.cordova.api.LOG;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.phonegap.api.Plugin;
|
||||
import com.phonegap.api.PluginResult;
|
||||
|
||||
/**
|
||||
* This class provides a service.
|
||||
*/
|
||||
public class ActivityPlugin extends Plugin {
|
||||
|
||||
static String TAG = "ActivityPlugin";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public ActivityPlugin() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the request and returns PluginResult.
|
||||
*
|
||||
* @param action The action to execute.
|
||||
* @param args JSONArry of arguments for the plugin.
|
||||
* @param callbackId The callback id used when calling back into JavaScript.
|
||||
* @return A PluginResult object with a status and message.
|
||||
*/
|
||||
@Override
|
||||
public PluginResult execute(String action, JSONArray args, String callbackId) {
|
||||
PluginResult.Status status = PluginResult.Status.OK;
|
||||
String result = "";
|
||||
|
||||
try {
|
||||
if (action.equals("start")) {
|
||||
this.startActivity(args.getString(0));
|
||||
}
|
||||
return new PluginResult(status, result);
|
||||
} catch (JSONException e) {
|
||||
return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// LOCAL METHODS
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
public void startActivity(String className) {
|
||||
try {
|
||||
Intent intent = new Intent().setClass(this.ctx.getContext(), Class.forName(className));
|
||||
LOG.d(TAG, "Starting activity %s", className);
|
||||
this.ctx.startActivity(intent);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
LOG.e(TAG, "Error starting activity %s", className);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
25
test/src/org/apache/cordova/test/FixWebView.java
Executable file
25
test/src/org/apache/cordova/test/FixWebView.java
Executable file
@ -0,0 +1,25 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class FixWebView extends WebView {
|
||||
|
||||
public FixWebView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseTimers() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is with different signature in order to stop the timers while move application to background
|
||||
* @param realPause
|
||||
*/
|
||||
public void pauseTimers(@SuppressWarnings("unused") boolean realPause) {
|
||||
super.pauseTimers();
|
||||
}
|
||||
|
||||
}
|
12
test/src/org/apache/cordova/test/backbuttonmultipage.java
Executable file
12
test/src/org/apache/cordova/test/backbuttonmultipage.java
Executable file
@ -0,0 +1,12 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class backbuttonmultipage extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/backbuttonmultipage/index.html");
|
||||
}
|
||||
}
|
16
test/src/org/apache/cordova/test/background.java
Executable file
16
test/src/org/apache/cordova/test/background.java
Executable file
@ -0,0 +1,16 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class background extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init(new FixWebView(this), new CordovaWebViewClient(this), new CordovaChromeClient(this));
|
||||
super.setBooleanProperty("keepRunning", false);
|
||||
super.loadUrl("file:///android_asset/www/background/index.html");
|
||||
}
|
||||
}
|
14
test/src/org/apache/cordova/test/errorurl.java
Executable file
14
test/src/org/apache/cordova/test/errorurl.java
Executable file
@ -0,0 +1,14 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class errorurl extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
this.setStringProperty("errorUrl", "file:///android_asset/www/htmlnotfound/error.html");
|
||||
super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
|
||||
}
|
||||
}
|
13
test/src/org/apache/cordova/test/htmlnotfound.java
Executable file
13
test/src/org/apache/cordova/test/htmlnotfound.java
Executable file
@ -0,0 +1,13 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class htmlnotfound extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
|
||||
}
|
||||
}
|
12
test/src/org/apache/cordova/test/iframe.java
Executable file
12
test/src/org/apache/cordova/test/iframe.java
Executable file
@ -0,0 +1,12 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class iframe extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/iframe/index.html");
|
||||
}
|
||||
}
|
12
test/src/org/apache/cordova/test/jqmtabbackbutton.java
Executable file
12
test/src/org/apache/cordova/test/jqmtabbackbutton.java
Executable file
@ -0,0 +1,12 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class jqmtabbackbutton extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/jqmtabbackbutton/index.html");
|
||||
}
|
||||
}
|
12
test/src/org/apache/cordova/test/lifecycle.java
Executable file
12
test/src/org/apache/cordova/test/lifecycle.java
Executable file
@ -0,0 +1,12 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class lifecycle extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/lifecycle/index.html");
|
||||
}
|
||||
}
|
13
test/src/org/apache/cordova/test/loading.java
Executable file
13
test/src/org/apache/cordova/test/loading.java
Executable file
@ -0,0 +1,13 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class loading extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.setStringProperty("loadingDialog", "Testing,Loading...");
|
||||
super.loadUrl("http://www.google.com");
|
||||
}
|
||||
}
|
62
test/src/org/apache/cordova/test/menus.java
Executable file
62
test/src/org/apache/cordova/test/menus.java
Executable file
@ -0,0 +1,62 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
|
||||
import org.apache.cordova.*;
|
||||
import org.apache.cordova.api.LOG;
|
||||
|
||||
public class menus extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
super.registerForContextMenu(super.appView);
|
||||
super.loadUrl("file:///android_asset/www/menus/index.html");
|
||||
}
|
||||
|
||||
// Demonstrate how to add your own menus to app
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
int base = Menu.FIRST;
|
||||
// Group, item id, order, title
|
||||
menu.add(base, base, base, "Item1");
|
||||
menu.add(base, base + 1, base + 1, "Item2");
|
||||
menu.add(base, base + 2, base + 2, "Item3");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
LOG.d("menus", "Item " + item.getItemId() + " pressed.");
|
||||
this.appView.loadUrl("javascript:alert('Menu " + item.getItemId() + " pressed.')");
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
LOG.d("menus", "onPrepareOptionsMenu()");
|
||||
// this.appView.loadUrl("javascript:alert('onPrepareOptionsMenu()')");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo info) {
|
||||
LOG.d("menus", "onCreateContextMenu()");
|
||||
menu.setHeaderTitle("Test Context Menu");
|
||||
menu.add(200, 200, 200, "Context Item1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
this.appView.loadUrl("javascript:alert('Context Menu " + item.getItemId() + " pressed.')");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
17
test/src/org/apache/cordova/test/splashscreen.java
Executable file
17
test/src/org/apache/cordova/test/splashscreen.java
Executable file
@ -0,0 +1,17 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class splashscreen extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
|
||||
// Show splashscreen
|
||||
this.setIntegerProperty("splashscreen", R.drawable.sandy);
|
||||
|
||||
super.loadUrl("file:///android_asset/www/splashscreen/index.html", 2000);
|
||||
}
|
||||
}
|
14
test/src/org/apache/cordova/test/tests.java
Executable file
14
test/src/org/apache/cordova/test/tests.java
Executable file
@ -0,0 +1,14 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class tests extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
super.pluginManager.addService("Activity", "org.apache.cordova.test.ActivityPlugin");
|
||||
super.loadUrl("file:///android_asset/www/index.html");
|
||||
}
|
||||
}
|
16
test/src/org/apache/cordova/test/timeout.java
Executable file
16
test/src/org/apache/cordova/test/timeout.java
Executable file
@ -0,0 +1,16 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class timeout extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init();
|
||||
|
||||
// Short timeout to cause error
|
||||
this.setIntegerProperty("loadUrlTimeoutValue", 10);
|
||||
super.loadUrl("http://www.google.com");
|
||||
}
|
||||
}
|
54
test/src/org/apache/cordova/test/userwebview.java
Executable file
54
test/src/org/apache/cordova/test/userwebview.java
Executable file
@ -0,0 +1,54 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.GeolocationPermissions.Callback;
|
||||
|
||||
import org.apache.cordova.*;
|
||||
import org.apache.cordova.api.LOG;
|
||||
|
||||
public class userwebview extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.init(new WebView(this), new TestViewClient(this), new TestChromeClient(this));
|
||||
super.loadUrl("file:///android_asset/www/userwebview/index.html");
|
||||
}
|
||||
|
||||
public class TestChromeClient extends CordovaChromeClient {
|
||||
public TestChromeClient(DroidGap arg0) {
|
||||
super(arg0);
|
||||
LOG.d("userwebview", "TestChromeClient()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
|
||||
LOG.d("userwebview", "onGeolocationPermissionsShowPrompt(" + origin + ")");
|
||||
super.onGeolocationPermissionsShowPrompt(origin, callback);
|
||||
callback.invoke(origin, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class can be used to override the GapViewClient and receive notification of webview events.
|
||||
*/
|
||||
public class TestViewClient extends CordovaWebViewClient {
|
||||
public TestViewClient(DroidGap arg0) {
|
||||
super(arg0);
|
||||
LOG.d("userwebview", "TestViewClient()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
LOG.d("userwebview", "shouldOverrideUrlLoading(" + url + ")");
|
||||
return super.shouldOverrideUrlLoading(view, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
||||
LOG.d("userwebview", "onReceivedError: Error code=" + errorCode + " Description=" + description + " URL=" + failingUrl);
|
||||
super.onReceivedError(view, errorCode, description, failingUrl);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
12
test/src/org/apache/cordova/test/whitelist.java
Executable file
12
test/src/org/apache/cordova/test/whitelist.java
Executable file
@ -0,0 +1,12 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class whitelist extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/whitelist/index.html");
|
||||
}
|
||||
}
|
12
test/src/org/apache/cordova/test/xhr.java
Executable file
12
test/src/org/apache/cordova/test/xhr.java
Executable file
@ -0,0 +1,12 @@
|
||||
package org.apache.cordova.test;
|
||||
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class xhr extends DroidGap {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/xhr/index.html");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user