mobile_template 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/lib/mobile_template/version.rb +1 -1
  2. data/mobile_template.gemspec +1 -1
  3. data/templates/assets/Gemfile +1 -1
  4. data/templates/assets/source/javascripts/vendor/cordova.js +2106 -1975
  5. data/templates/assets/source/javascripts/vendor/jquery.js +614 -477
  6. data/templates/assets/source/javascripts/vendor/jquery.mobile.js +519 -378
  7. data/templates/assets/source/stylesheets/vendor/jquery.mobile.css.scss +683 -502
  8. data/templates/cordova_android/VERSION +1 -1
  9. data/templates/cordova_android/bin/create +5 -1
  10. data/templates/cordova_android/bin/templates/project/cordova/create +5 -0
  11. data/templates/cordova_android/bin/templates/project/cordova/debug +1 -1
  12. data/templates/cordova_android/bin/templates/project/cordova/templates/project/AndroidManifest.xml +18 -25
  13. data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/index.html +6 -6
  14. data/templates/cordova_android/framework/assets/js/cordova.android.js +2106 -1975
  15. data/templates/cordova_android/framework/assets/www/index.html +1 -1
  16. data/templates/cordova_android/framework/build.xml +2 -42
  17. data/templates/cordova_android/framework/project.properties +1 -1
  18. data/templates/cordova_android/framework/res/drawable/splash.png +0 -0
  19. data/templates/cordova_android/framework/res/drawable-hdpi/icon.png +0 -0
  20. data/templates/cordova_android/framework/res/drawable-ldpi/icon.png +0 -0
  21. data/templates/cordova_android/framework/res/drawable-mdpi/icon.png +0 -0
  22. data/templates/cordova_android/framework/res/xml/plugins.xml +2 -1
  23. data/templates/cordova_android/framework/src/com/phonegap/api/PluginManager.java +1 -0
  24. data/templates/cordova_android/framework/src/org/apache/cordova/AudioPlayer.java +24 -16
  25. data/templates/cordova_android/framework/src/org/apache/cordova/CameraLauncher.java +35 -10
  26. data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessor.java +2 -1
  27. data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessorSdk5.java +67 -65
  28. data/templates/cordova_android/framework/src/org/apache/cordova/ContactManager.java +51 -63
  29. data/templates/cordova_android/framework/src/org/apache/cordova/CordovaChromeClient.java +3 -0
  30. data/templates/cordova_android/framework/src/org/apache/cordova/CordovaWebViewClient.java +6 -2
  31. data/templates/cordova_android/framework/src/org/apache/cordova/Device.java +108 -108
  32. data/templates/cordova_android/framework/src/org/apache/cordova/DroidGap.java +110 -77
  33. data/templates/cordova_android/framework/src/org/apache/cordova/FileTransfer.java +90 -44
  34. data/templates/cordova_android/framework/src/org/apache/cordova/FileUtils.java +20 -20
  35. data/templates/cordova_android/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java +2 -2
  36. data/templates/cordova_android/framework/src/org/apache/cordova/NetworkManager.java +7 -8
  37. data/templates/cordova_android/framework/src/org/apache/cordova/Notification.java +2 -2
  38. data/templates/cordova_android/framework/src/org/apache/cordova/SplashScreen.java +23 -0
  39. data/templates/cordova_android/framework/src/org/apache/cordova/Storage.java +3 -3
  40. data/templates/cordova_android/framework/src/org/apache/cordova/api/CordovaInterface.java +2 -0
  41. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginEntry.java +119 -0
  42. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginManager.java +260 -258
  43. data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginResult.java +2 -2
  44. data/templates/cordova_android/releasenotes.md +42 -0
  45. data/templates/cordova_android/test/.classpath +8 -0
  46. data/templates/cordova_android/test/.project +33 -0
  47. data/templates/cordova_android/test/AndroidManifest.xml +87 -0
  48. data/templates/cordova_android/test/README.md +23 -0
  49. data/templates/cordova_android/test/ant.properties +17 -0
  50. data/templates/cordova_android/test/assets/www/backbuttonmultipage/index.html +23 -0
  51. data/templates/cordova_android/test/assets/www/backbuttonmultipage/sample2.html +23 -0
  52. data/templates/cordova_android/test/assets/www/backbuttonmultipage/sample3.html +26 -0
  53. data/templates/cordova_android/test/assets/www/background/index.html +99 -0
  54. data/templates/cordova_android/test/assets/www/background/index2.html +98 -0
  55. data/templates/cordova_android/test/assets/www/cordova-1.6.0.js +4985 -0
  56. data/templates/cordova_android/test/assets/www/cordova.js +2 -0
  57. data/templates/cordova_android/test/assets/www/htmlnotfound/error.html +1 -0
  58. data/templates/cordova_android/test/assets/www/iframe/index.html +33 -0
  59. data/templates/cordova_android/test/assets/www/iframe/index2.html +24 -0
  60. data/templates/cordova_android/test/assets/www/index.html +47 -0
  61. data/templates/cordova_android/test/assets/www/jqmtabbackbutton/index.html +49 -0
  62. data/templates/cordova_android/test/assets/www/jqmtabbackbutton/tab1.html +29 -0
  63. data/templates/cordova_android/test/assets/www/jqmtabbackbutton/tab2.html +30 -0
  64. data/templates/cordova_android/test/assets/www/jqmtabbackbutton/tab3.html +30 -0
  65. data/templates/cordova_android/test/assets/www/lifecycle/index.html +108 -0
  66. data/templates/cordova_android/test/assets/www/lifecycle/index2.html +104 -0
  67. data/templates/cordova_android/test/assets/www/main.js +150 -0
  68. data/templates/cordova_android/test/assets/www/master.css +117 -0
  69. data/templates/cordova_android/test/assets/www/menus/index.html +29 -0
  70. data/templates/cordova_android/test/assets/www/splashscreen/index.html +22 -0
  71. data/templates/cordova_android/test/assets/www/userwebview/index.html +49 -0
  72. data/templates/cordova_android/test/assets/www/whitelist/index.html +29 -0
  73. data/templates/cordova_android/test/assets/www/whitelist/index2.html +23 -0
  74. data/templates/cordova_android/test/assets/www/xhr/index.html +48 -0
  75. data/templates/cordova_android/test/build.xml +85 -0
  76. data/templates/cordova_android/test/libs/cordova-1.6.0.jar +0 -0
  77. data/templates/cordova_android/test/project.properties +11 -0
  78. data/templates/cordova_android/{framework → test}/res/drawable/icon.png +0 -0
  79. data/templates/cordova_android/test/res/drawable/sandy.jpg +0 -0
  80. data/templates/cordova_android/test/res/drawable-hdpi/ic_launcher.png +0 -0
  81. data/templates/cordova_android/test/res/drawable-ldpi/ic_launcher.png +0 -0
  82. data/templates/cordova_android/test/res/drawable-mdpi/ic_launcher.png +0 -0
  83. data/templates/cordova_android/test/res/layout/main.xml +13 -0
  84. data/templates/cordova_android/test/res/values/strings.xml +4 -0
  85. data/templates/cordova_android/{bin/templates/project/cordova/templates/project → test}/res/xml/cordova.xml +0 -0
  86. data/templates/cordova_android/{bin/templates/project/cordova/templates/project → test}/res/xml/plugins.xml +1 -1
  87. data/templates/cordova_android/test/src/org/apache/cordova/test/ActivityPlugin.java +81 -0
  88. data/templates/cordova_android/test/src/org/apache/cordova/test/FixWebView.java +43 -0
  89. data/templates/cordova_android/test/src/org/apache/cordova/test/backbuttonmultipage.java +30 -0
  90. data/templates/cordova_android/test/src/org/apache/cordova/test/background.java +34 -0
  91. data/templates/cordova_android/test/src/org/apache/cordova/test/errorurl.java +32 -0
  92. data/templates/cordova_android/test/src/org/apache/cordova/test/htmlnotfound.java +31 -0
  93. data/templates/cordova_android/test/src/org/apache/cordova/test/iframe.java +30 -0
  94. data/templates/cordova_android/test/src/org/apache/cordova/test/jqmtabbackbutton.java +30 -0
  95. data/templates/cordova_android/test/src/org/apache/cordova/test/lifecycle.java +30 -0
  96. data/templates/cordova_android/test/src/org/apache/cordova/test/loading.java +31 -0
  97. data/templates/cordova_android/test/src/org/apache/cordova/test/menus.java +80 -0
  98. data/templates/cordova_android/test/src/org/apache/cordova/test/splashscreen.java +35 -0
  99. data/templates/cordova_android/test/src/org/apache/cordova/test/tests.java +32 -0
  100. data/templates/cordova_android/test/src/org/apache/cordova/test/timeout.java +34 -0
  101. data/templates/cordova_android/test/src/org/apache/cordova/test/userwebview.java +72 -0
  102. data/templates/cordova_android/test/src/org/apache/cordova/test/whitelist.java +51 -0
  103. data/templates/cordova_android/test/src/org/apache/cordova/test/xhr.java +30 -0
  104. metadata +83 -30
  105. data/templates/cordova_android/framework/assets/js/accelerometer.js +0 -137
  106. data/templates/cordova_android/framework/assets/js/app.js +0 -89
  107. data/templates/cordova_android/framework/assets/js/battery.js +0 -134
  108. data/templates/cordova_android/framework/assets/js/camera.js +0 -168
  109. data/templates/cordova_android/framework/assets/js/capture.js +0 -203
  110. data/templates/cordova_android/framework/assets/js/compass.js +0 -168
  111. data/templates/cordova_android/framework/assets/js/contact.js +0 -310
  112. data/templates/cordova_android/framework/assets/js/cordova.js.base +0 -924
  113. data/templates/cordova_android/framework/assets/js/crypto.js +0 -54
  114. data/templates/cordova_android/framework/assets/js/device.js +0 -83
  115. data/templates/cordova_android/framework/assets/js/file.js +0 -1082
  116. data/templates/cordova_android/framework/assets/js/filetransfer.js +0 -125
  117. data/templates/cordova_android/framework/assets/js/geolocation.js +0 -209
  118. data/templates/cordova_android/framework/assets/js/header.txt +0 -19
  119. data/templates/cordova_android/framework/assets/js/media.js +0 -233
  120. data/templates/cordova_android/framework/assets/js/network.js +0 -100
  121. data/templates/cordova_android/framework/assets/js/notification.js +0 -133
  122. data/templates/cordova_android/framework/assets/js/position.js +0 -100
  123. data/templates/cordova_android/framework/assets/js/storage.js +0 -439
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>CordovaTest</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ <buildCommand>
14
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15
+ <arguments>
16
+ </arguments>
17
+ </buildCommand>
18
+ <buildCommand>
19
+ <name>org.eclipse.jdt.core.javabuilder</name>
20
+ <arguments>
21
+ </arguments>
22
+ </buildCommand>
23
+ <buildCommand>
24
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
25
+ <arguments>
26
+ </arguments>
27
+ </buildCommand>
28
+ </buildSpec>
29
+ <natures>
30
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31
+ <nature>org.eclipse.jdt.core.javanature</nature>
32
+ </natures>
33
+ </projectDescription>
@@ -0,0 +1,87 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
3
+ package="org.apache.cordova.test" android:versionName="1.1" android:versionCode="5">
4
+ <supports-screens
5
+ android:largeScreens="true"
6
+ android:normalScreens="true"
7
+ android:smallScreens="true"
8
+ android:xlargeScreens="true"
9
+ android:resizeable="true"
10
+ android:anyDensity="true"
11
+ />
12
+
13
+ <uses-permission android:name="android.permission.CAMERA" />
14
+ <uses-permission android:name="android.permission.VIBRATE" />
15
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
16
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
17
+ <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
18
+ <uses-permission android:name="android.permission.INTERNET" />
19
+ <uses-permission android:name="android.permission.RECEIVE_SMS" />
20
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
21
+ <uses-permission android:name="android.permission.RECORD_VIDEO"/>
22
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
23
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
24
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
25
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
26
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
27
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" />
28
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
29
+
30
+ <uses-feature android:name="android.hardware.camera" />
31
+ <uses-feature android:name="android.hardware.camera.autofocus" />
32
+
33
+ <application android:icon="@drawable/icon" android:label="@string/app_name"
34
+ android:debuggable="true">
35
+ <activity android:name="tests" android:label="@string/app_name"
36
+ android:configChanges="orientation|keyboardHidden">
37
+ <intent-filter>
38
+ <action android:name="android.intent.action.MAIN" />
39
+ <category android:name="android.intent.category.LAUNCHER" />
40
+ </intent-filter>
41
+ </activity>
42
+ <activity android:name="splashscreen" android:label="@string/app_name"
43
+ android:configChanges="orientation|keyboardHidden">
44
+ </activity>
45
+ <activity android:name="timeout" android:label="@string/app_name"
46
+ android:configChanges="orientation|keyboardHidden">
47
+ </activity>
48
+ <activity android:name="htmlnotfound" android:label="@string/app_name"
49
+ android:configChanges="orientation|keyboardHidden">
50
+ </activity>
51
+ <activity android:name="errorurl" android:label="@string/app_name"
52
+ android:configChanges="orientation|keyboardHidden">
53
+ </activity>
54
+ <activity android:name="userwebview" android:label="@string/app_name"
55
+ android:configChanges="orientation|keyboardHidden">
56
+ </activity>
57
+ <activity android:name="menus" android:label="@string/app_name"
58
+ android:configChanges="orientation|keyboardHidden">
59
+ </activity>
60
+ <activity android:name="loading" android:label="@string/app_name"
61
+ android:configChanges="orientation|keyboardHidden">
62
+ </activity>
63
+ <activity android:name="lifecycle" android:label="@string/app_name"
64
+ android:configChanges="orientation|keyboardHidden">
65
+ </activity>
66
+ <activity android:name="jqmtabbackbutton" android:label="@string/app_name"
67
+ android:configChanges="orientation|keyboardHidden">
68
+ </activity>
69
+ <activity android:name="backbuttonmultipage" android:label="@string/app_name"
70
+ android:configChanges="orientation|keyboardHidden">
71
+ </activity>
72
+ <activity android:name="whitelist" android:label="@string/app_name"
73
+ android:configChanges="orientation|keyboardHidden">
74
+ </activity>
75
+ <activity android:name="background" android:label="@string/app_name"
76
+ android:configChanges="orientation|keyboardHidden">
77
+ </activity>
78
+ <activity android:name="iframe" android:label="@string/app_name"
79
+ android:configChanges="orientation|keyboardHidden">
80
+ </activity>
81
+ <activity android:name="xhr" android:label="@string/app_name"
82
+ android:configChanges="orientation|keyboardHidden">
83
+ </activity>
84
+ </application>
85
+
86
+ <uses-sdk android:minSdkVersion="5" />
87
+ </manifest>
@@ -0,0 +1,23 @@
1
+ ## Android Native Tests ##
2
+
3
+ These tests are designed to verify Android native features and other Android specific features.
4
+
5
+ Before running the tests, they need to be set up.
6
+
7
+ 1. Copy the version of cordova-x.y.z.js into assets/www directory
8
+ 2. Edit assets/www/cordova.js to reference the correct version
9
+ 3. Copy cordova-x.y.z.jar into libs directory
10
+
11
+ To run from command line:
12
+
13
+ 4. Build by entering "ant debug install"
14
+ 5. Run tests by clicking on "CordovaTest" icon on device
15
+
16
+ To run from Eclipse:
17
+
18
+ 4. Import Android project into Eclipse
19
+ 5. Ensure Project properties "Java Build Path" includes the lib/cordova-x.y.z.jar
20
+ 6. Create run configuration if not already created
21
+ 7. Run tests
22
+
23
+
@@ -0,0 +1,17 @@
1
+ # This file is used to override default values used by the Ant build system.
2
+ #
3
+ # This file must be checked in Version Control Systems, as it is
4
+ # integral to the build system of your project.
5
+
6
+ # This file is only used by the Ant script.
7
+
8
+ # You can use this to override default values such as
9
+ # 'source.dir' for the location of your java source folder and
10
+ # 'out.dir' for the location of your output folder.
11
+
12
+ # You can also use it define how the release builds are signed by declaring
13
+ # the following properties:
14
+ # 'key.store' for the location of your keystore and
15
+ # 'key.alias' for the name of the key to use.
16
+ # The password will be asked during the build when you use the 'release' target.
17
+
@@ -0,0 +1,23 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
+ <title>Backbutton</title>
5
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
6
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
7
+ <script type="text/javascript" charset="utf-8" src="../main.js"></script>
8
+
9
+ <body onload="init();" id="stage" class="theme">
10
+ <h1>Cordova Android Tests</h1>
11
+ <div id="info">
12
+ <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
13
+ <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
14
+ <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
15
+ </div>
16
+ <div id="info">
17
+ <h4>Page 1</h4>
18
+ Go to next page.<br>
19
+ If returning from previous page, press "backbutton". You should exit this app.
20
+ </div>
21
+ <a href="sample2.html" class="btn large">Next page</a>
22
+ </body>
23
+ </html>
@@ -0,0 +1,23 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
+ <title>Backbutton</title>
5
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
6
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
7
+ <script type="text/javascript" charset="utf-8" src="../main.js"></script>
8
+
9
+ <body onload="init();" id="stage" class="theme">
10
+ <h1>Cordova Android Tests</h1>
11
+ <div id="info">
12
+ <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
13
+ <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
14
+ <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
15
+ </div>
16
+ <div id="info">
17
+ <h4>Page 2</h4>
18
+ Go to next page.<br>
19
+ If returning from previous page, press "backbutton". You should go to Page 1.
20
+ </div>
21
+ <a href="sample3.html" class="btn large">Next page</a>
22
+ </body>
23
+ </html>
@@ -0,0 +1,26 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
+ <title>Backbutton</title>
5
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
6
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
7
+ <script type="text/javascript" charset="utf-8" src="../main.js"></script>
8
+
9
+ <body onload="init();" id="stage" class="theme">
10
+ <h1>Cordova Android Tests</h1>
11
+ <div id="info">
12
+ <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
13
+ <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
14
+ <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
15
+ </div>
16
+ <div id="info">
17
+ <h4>Page 3</h4>
18
+ Press the 3 buttons below. You should stay on same page.<br>
19
+ Press "backbutton" 4 times. This will go back to #test3, #test2, #test1, then return to previous Page 2.<br>
20
+ (NOTE: IS THIS CORRECT BEHAVIOR?)
21
+ </div>
22
+ <a href="sample3.html#test1" class="btn large">page3#test1</a>
23
+ <a href="sample3.html#test2" class="btn large">page3#test2</a>
24
+ <a href="sample3.html#test3" class="btn large">page3#test3</a>
25
+ </body>
26
+ </html>
@@ -0,0 +1,99 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
6
+ <title>Background Page 1</title>
7
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
8
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+
12
+ function onLoad() {
13
+ console.log("Page1: onload");
14
+ log("Page1: onload @ " + new Date().toLocaleTimeString());
15
+ document.addEventListener("deviceready", onDeviceReady, false);
16
+ }
17
+
18
+ function onUnLoaded() {
19
+ console.log("Page1: onunload");
20
+ log("Page1: onunload @ " + new Date().toLocaleTimeString());
21
+ }
22
+
23
+ function onDeviceReady() {
24
+ // Register the event listener
25
+ document.getElementById("platform").innerHTML = device.platform;
26
+ document.getElementById("version").innerHTML = device.version;
27
+ document.getElementById("uuid").innerHTML = device.uuid;
28
+ document.getElementById("name").innerHTML = device.name;
29
+ document.getElementById("width").innerHTML = screen.width;
30
+ document.getElementById("height").innerHTML = screen.height;
31
+ document.getElementById("colorDepth").innerHTML = screen.colorDepth;
32
+
33
+ document.addEventListener("pause", onPause, false);
34
+ document.addEventListener("resume", onResume, false);
35
+
36
+ window.setInterval(function() {
37
+ log("Page1: Running");
38
+ }, 2000);
39
+ }
40
+
41
+ function onPause() {
42
+ console.log("Page1: onpause");
43
+ log("Page1: onpause @ " + new Date().toLocaleTimeString());
44
+ }
45
+
46
+ function onResume() {
47
+ console.log("Page1: onresume");
48
+ log("Page1: onresume @ " + new Date().toLocaleTimeString());
49
+ }
50
+
51
+ function log(s) {
52
+ var el = document.getElementById('status');
53
+ var status = el.innerHTML + s + "<br>";
54
+ el.innerHTML = status;
55
+ localStorage.backgroundstatus = status;
56
+ }
57
+
58
+ function clearStatus() {
59
+ console.log("clear()");
60
+ localStorage.backgroundstatus = "";
61
+ document.getElementById('status').innerHTML = "";
62
+ }
63
+
64
+ </script>
65
+ </head>
66
+ <body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
67
+ <h1>Events</h1>
68
+ <div id="info">
69
+ <h4>
70
+ Platform: <span id="platform"> &nbsp;</span>, Version: <span
71
+ id="version">&nbsp;</span>
72
+ </h4>
73
+ <h4>
74
+ UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span>
75
+ </h4>
76
+ <h4>
77
+ Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;
78
+ </span>, Color Depth: <span id="colorDepth"></span>
79
+ </h4>
80
+ </div>
81
+ <div id="info">
82
+ Press "Home" button, then return to this app to see pause/resume.<br>
83
+ There shouldn't be any "Running" entries between pause and resume.<br>
84
+ </div>
85
+ <div id="info">
86
+ <h4>Info for event testing:</h4>
87
+ <div id="status"></div>
88
+ </div>
89
+
90
+ <!-- a href="index2.html" class="btn large" >Load new page</a -->
91
+ <a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
92
+
93
+ <script>
94
+ document.getElementById('status').innerHTML = localStorage.backgroundstatus;
95
+ </script>
96
+ </body>
97
+ </html>
98
+
99
+
@@ -0,0 +1,98 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
6
+ <title>Background Page 2</title>
7
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
8
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+
12
+ function onLoad() {
13
+ console.log("Page2: onload");
14
+ log("Page2: onload @ " + new Date().toLocaleTimeString());
15
+ document.addEventListener("deviceready", onDeviceReady, false);
16
+ }
17
+
18
+ function onUnLoaded() {
19
+ console.log("Page2: onunload");
20
+ log("Page2: onunload @ " + new Date().toLocaleTimeString());
21
+ }
22
+
23
+ function onDeviceReady() {
24
+ // Register the event listener
25
+ document.getElementById("platform").innerHTML = device.platform;
26
+ document.getElementById("version").innerHTML = device.version;
27
+ document.getElementById("uuid").innerHTML = device.uuid;
28
+ document.getElementById("name").innerHTML = device.name;
29
+ document.getElementById("width").innerHTML = screen.width;
30
+ document.getElementById("height").innerHTML = screen.height;
31
+ document.getElementById("colorDepth").innerHTML = screen.colorDepth;
32
+
33
+ document.addEventListener("pause", onPause, false);
34
+ document.addEventListener("resume", onResume, false);
35
+
36
+ window.setInterval(function() {
37
+ log("Page2: Running");
38
+ }, 2000);
39
+ }
40
+
41
+ function onPause() {
42
+ console.log("Page2: onpause");
43
+ log("Page2: onpause @ " + new Date().toLocaleTimeString());
44
+ }
45
+
46
+ function onResume() {
47
+ console.log("Page2: onresume");
48
+ log("Page2: onresume @ " + new Date().toLocaleTimeString());
49
+ }
50
+
51
+ function log(s) {
52
+ var el = document.getElementById('status');
53
+ var status = el.innerHTML + s + "<br>";
54
+ el.innerHTML = status;
55
+ localStorage.backgroundstatus = status;
56
+ }
57
+
58
+ function clearStatus() {
59
+ console.log("clear()");
60
+ localStorage.backgroundstatus = "";
61
+ document.getElementById('status').innerHTML = "";
62
+ }
63
+
64
+ </script>
65
+ </head>
66
+ <body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
67
+ <h1>Events</h1>
68
+ <div id="info">
69
+ <h4>
70
+ Platform: <span id="platform"> &nbsp;</span>, Version: <span
71
+ id="version">&nbsp;</span>
72
+ </h4>
73
+ <h4>
74
+ UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span>
75
+ </h4>
76
+ <h4>
77
+ Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;
78
+ </span>, Color Depth: <span id="colorDepth"></span>
79
+ </h4>
80
+ </div>
81
+ <div id="info">
82
+ <h4>Press "Back" button to return to Page 1.</h4>
83
+ </div>
84
+ <div id="info">
85
+ <h4>Info for event testing:</h4>
86
+ <div id="status"></div>
87
+ </div>
88
+
89
+ <a href="index.html" class="btn large" >Load new page</a>
90
+ <a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
91
+
92
+ <script>
93
+ document.getElementById('status').innerHTML = localStorage.backgroundstatus;
94
+ </script>
95
+ </body>
96
+ </html>
97
+
98
+