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.
- data/lib/mobile_template/version.rb +1 -1
- data/mobile_template.gemspec +1 -1
- data/templates/assets/Gemfile +1 -1
- data/templates/assets/source/javascripts/vendor/cordova.js +2106 -1975
- data/templates/assets/source/javascripts/vendor/jquery.js +614 -477
- data/templates/assets/source/javascripts/vendor/jquery.mobile.js +519 -378
- data/templates/assets/source/stylesheets/vendor/jquery.mobile.css.scss +683 -502
- data/templates/cordova_android/VERSION +1 -1
- data/templates/cordova_android/bin/create +5 -1
- data/templates/cordova_android/bin/templates/project/cordova/create +5 -0
- data/templates/cordova_android/bin/templates/project/cordova/debug +1 -1
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/AndroidManifest.xml +18 -25
- data/templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/index.html +6 -6
- data/templates/cordova_android/framework/assets/js/cordova.android.js +2106 -1975
- data/templates/cordova_android/framework/assets/www/index.html +1 -1
- data/templates/cordova_android/framework/build.xml +2 -42
- data/templates/cordova_android/framework/project.properties +1 -1
- data/templates/cordova_android/framework/res/drawable/splash.png +0 -0
- data/templates/cordova_android/framework/res/drawable-hdpi/icon.png +0 -0
- data/templates/cordova_android/framework/res/drawable-ldpi/icon.png +0 -0
- data/templates/cordova_android/framework/res/drawable-mdpi/icon.png +0 -0
- data/templates/cordova_android/framework/res/xml/plugins.xml +2 -1
- data/templates/cordova_android/framework/src/com/phonegap/api/PluginManager.java +1 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/AudioPlayer.java +24 -16
- data/templates/cordova_android/framework/src/org/apache/cordova/CameraLauncher.java +35 -10
- data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessor.java +2 -1
- data/templates/cordova_android/framework/src/org/apache/cordova/ContactAccessorSdk5.java +67 -65
- data/templates/cordova_android/framework/src/org/apache/cordova/ContactManager.java +51 -63
- data/templates/cordova_android/framework/src/org/apache/cordova/CordovaChromeClient.java +3 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/CordovaWebViewClient.java +6 -2
- data/templates/cordova_android/framework/src/org/apache/cordova/Device.java +108 -108
- data/templates/cordova_android/framework/src/org/apache/cordova/DroidGap.java +110 -77
- data/templates/cordova_android/framework/src/org/apache/cordova/FileTransfer.java +90 -44
- data/templates/cordova_android/framework/src/org/apache/cordova/FileUtils.java +20 -20
- data/templates/cordova_android/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java +2 -2
- data/templates/cordova_android/framework/src/org/apache/cordova/NetworkManager.java +7 -8
- data/templates/cordova_android/framework/src/org/apache/cordova/Notification.java +2 -2
- data/templates/cordova_android/framework/src/org/apache/cordova/SplashScreen.java +23 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/Storage.java +3 -3
- data/templates/cordova_android/framework/src/org/apache/cordova/api/CordovaInterface.java +2 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginEntry.java +119 -0
- data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginManager.java +260 -258
- data/templates/cordova_android/framework/src/org/apache/cordova/api/PluginResult.java +2 -2
- data/templates/cordova_android/releasenotes.md +42 -0
- data/templates/cordova_android/test/.classpath +8 -0
- data/templates/cordova_android/test/.project +33 -0
- data/templates/cordova_android/test/AndroidManifest.xml +87 -0
- data/templates/cordova_android/test/README.md +23 -0
- data/templates/cordova_android/test/ant.properties +17 -0
- data/templates/cordova_android/test/assets/www/backbuttonmultipage/index.html +23 -0
- data/templates/cordova_android/test/assets/www/backbuttonmultipage/sample2.html +23 -0
- data/templates/cordova_android/test/assets/www/backbuttonmultipage/sample3.html +26 -0
- data/templates/cordova_android/test/assets/www/background/index.html +99 -0
- data/templates/cordova_android/test/assets/www/background/index2.html +98 -0
- data/templates/cordova_android/test/assets/www/cordova-1.6.0.js +4985 -0
- data/templates/cordova_android/test/assets/www/cordova.js +2 -0
- data/templates/cordova_android/test/assets/www/htmlnotfound/error.html +1 -0
- data/templates/cordova_android/test/assets/www/iframe/index.html +33 -0
- data/templates/cordova_android/test/assets/www/iframe/index2.html +24 -0
- data/templates/cordova_android/test/assets/www/index.html +47 -0
- data/templates/cordova_android/test/assets/www/jqmtabbackbutton/index.html +49 -0
- data/templates/cordova_android/test/assets/www/jqmtabbackbutton/tab1.html +29 -0
- data/templates/cordova_android/test/assets/www/jqmtabbackbutton/tab2.html +30 -0
- data/templates/cordova_android/test/assets/www/jqmtabbackbutton/tab3.html +30 -0
- data/templates/cordova_android/test/assets/www/lifecycle/index.html +108 -0
- data/templates/cordova_android/test/assets/www/lifecycle/index2.html +104 -0
- data/templates/cordova_android/test/assets/www/main.js +150 -0
- data/templates/cordova_android/test/assets/www/master.css +117 -0
- data/templates/cordova_android/test/assets/www/menus/index.html +29 -0
- data/templates/cordova_android/test/assets/www/splashscreen/index.html +22 -0
- data/templates/cordova_android/test/assets/www/userwebview/index.html +49 -0
- data/templates/cordova_android/test/assets/www/whitelist/index.html +29 -0
- data/templates/cordova_android/test/assets/www/whitelist/index2.html +23 -0
- data/templates/cordova_android/test/assets/www/xhr/index.html +48 -0
- data/templates/cordova_android/test/build.xml +85 -0
- data/templates/cordova_android/test/libs/cordova-1.6.0.jar +0 -0
- data/templates/cordova_android/test/project.properties +11 -0
- data/templates/cordova_android/{framework → test}/res/drawable/icon.png +0 -0
- data/templates/cordova_android/test/res/drawable/sandy.jpg +0 -0
- data/templates/cordova_android/test/res/drawable-hdpi/ic_launcher.png +0 -0
- data/templates/cordova_android/test/res/drawable-ldpi/ic_launcher.png +0 -0
- data/templates/cordova_android/test/res/drawable-mdpi/ic_launcher.png +0 -0
- data/templates/cordova_android/test/res/layout/main.xml +13 -0
- data/templates/cordova_android/test/res/values/strings.xml +4 -0
- data/templates/cordova_android/{bin/templates/project/cordova/templates/project → test}/res/xml/cordova.xml +0 -0
- data/templates/cordova_android/{bin/templates/project/cordova/templates/project → test}/res/xml/plugins.xml +1 -1
- data/templates/cordova_android/test/src/org/apache/cordova/test/ActivityPlugin.java +81 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/FixWebView.java +43 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/backbuttonmultipage.java +30 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/background.java +34 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/errorurl.java +32 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/htmlnotfound.java +31 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/iframe.java +30 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/jqmtabbackbutton.java +30 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/lifecycle.java +30 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/loading.java +31 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/menus.java +80 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/splashscreen.java +35 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/tests.java +32 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/timeout.java +34 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/userwebview.java +72 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/whitelist.java +51 -0
- data/templates/cordova_android/test/src/org/apache/cordova/test/xhr.java +30 -0
- metadata +83 -30
- data/templates/cordova_android/framework/assets/js/accelerometer.js +0 -137
- data/templates/cordova_android/framework/assets/js/app.js +0 -89
- data/templates/cordova_android/framework/assets/js/battery.js +0 -134
- data/templates/cordova_android/framework/assets/js/camera.js +0 -168
- data/templates/cordova_android/framework/assets/js/capture.js +0 -203
- data/templates/cordova_android/framework/assets/js/compass.js +0 -168
- data/templates/cordova_android/framework/assets/js/contact.js +0 -310
- data/templates/cordova_android/framework/assets/js/cordova.js.base +0 -924
- data/templates/cordova_android/framework/assets/js/crypto.js +0 -54
- data/templates/cordova_android/framework/assets/js/device.js +0 -83
- data/templates/cordova_android/framework/assets/js/file.js +0 -1082
- data/templates/cordova_android/framework/assets/js/filetransfer.js +0 -125
- data/templates/cordova_android/framework/assets/js/geolocation.js +0 -209
- data/templates/cordova_android/framework/assets/js/header.txt +0 -19
- data/templates/cordova_android/framework/assets/js/media.js +0 -233
- data/templates/cordova_android/framework/assets/js/network.js +0 -100
- data/templates/cordova_android/framework/assets/js/notification.js +0 -133
- data/templates/cordova_android/framework/assets/js/position.js +0 -100
- data/templates/cordova_android/framework/assets/js/storage.js +0 -439
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.15
|
21
|
+
version: 2.0.15.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.15.1
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: thor
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: '0.14'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.14'
|
36
46
|
description: Use phonegap (only android), jquery mobile and middleman for mobile app
|
37
47
|
development
|
38
48
|
email:
|
@@ -156,8 +166,6 @@ files:
|
|
156
166
|
- templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/main.js
|
157
167
|
- templates/cordova_android/bin/templates/project/cordova/templates/project/assets/www/master.css
|
158
168
|
- templates/cordova_android/bin/templates/project/cordova/templates/project/res/drawable/icon.png
|
159
|
-
- templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/cordova.xml
|
160
|
-
- templates/cordova_android/bin/templates/project/cordova/templates/project/res/xml/plugins.xml
|
161
169
|
- templates/cordova_android/bin/test
|
162
170
|
- templates/cordova_android/bin/tests/autotest.coffee
|
163
171
|
- templates/cordova_android/bin/tests/create.coffee
|
@@ -167,32 +175,15 @@ files:
|
|
167
175
|
- templates/cordova_android/framework/.project
|
168
176
|
- templates/cordova_android/framework/AndroidManifest.xml
|
169
177
|
- templates/cordova_android/framework/ant.properties
|
170
|
-
- templates/cordova_android/framework/assets/js/accelerometer.js
|
171
|
-
- templates/cordova_android/framework/assets/js/app.js
|
172
|
-
- templates/cordova_android/framework/assets/js/battery.js
|
173
|
-
- templates/cordova_android/framework/assets/js/camera.js
|
174
|
-
- templates/cordova_android/framework/assets/js/capture.js
|
175
|
-
- templates/cordova_android/framework/assets/js/compass.js
|
176
|
-
- templates/cordova_android/framework/assets/js/contact.js
|
177
178
|
- templates/cordova_android/framework/assets/js/cordova.android.js
|
178
|
-
- templates/cordova_android/framework/assets/js/cordova.js.base
|
179
|
-
- templates/cordova_android/framework/assets/js/crypto.js
|
180
|
-
- templates/cordova_android/framework/assets/js/device.js
|
181
|
-
- templates/cordova_android/framework/assets/js/file.js
|
182
|
-
- templates/cordova_android/framework/assets/js/filetransfer.js
|
183
|
-
- templates/cordova_android/framework/assets/js/geolocation.js
|
184
|
-
- templates/cordova_android/framework/assets/js/header.txt
|
185
|
-
- templates/cordova_android/framework/assets/js/media.js
|
186
|
-
- templates/cordova_android/framework/assets/js/network.js
|
187
|
-
- templates/cordova_android/framework/assets/js/notification.js
|
188
|
-
- templates/cordova_android/framework/assets/js/position.js
|
189
|
-
- templates/cordova_android/framework/assets/js/storage.js
|
190
179
|
- templates/cordova_android/framework/assets/www/index.html
|
191
180
|
- templates/cordova_android/framework/build.xml
|
192
181
|
- templates/cordova_android/framework/libs/commons-codec-1.3.jar
|
193
182
|
- templates/cordova_android/framework/proguard-project.txt
|
194
183
|
- templates/cordova_android/framework/project.properties
|
195
|
-
- templates/cordova_android/framework/res/drawable/icon.png
|
184
|
+
- templates/cordova_android/framework/res/drawable-hdpi/icon.png
|
185
|
+
- templates/cordova_android/framework/res/drawable-ldpi/icon.png
|
186
|
+
- templates/cordova_android/framework/res/drawable-mdpi/icon.png
|
196
187
|
- templates/cordova_android/framework/res/drawable/splash.png
|
197
188
|
- templates/cordova_android/framework/res/layout/main.xml
|
198
189
|
- templates/cordova_android/framework/res/values/strings.xml
|
@@ -236,6 +227,7 @@ files:
|
|
236
227
|
- templates/cordova_android/framework/src/org/apache/cordova/Notification.java
|
237
228
|
- templates/cordova_android/framework/src/org/apache/cordova/PreferenceNode.java
|
238
229
|
- templates/cordova_android/framework/src/org/apache/cordova/PreferenceSet.java
|
230
|
+
- templates/cordova_android/framework/src/org/apache/cordova/SplashScreen.java
|
239
231
|
- templates/cordova_android/framework/src/org/apache/cordova/StandAlone.java
|
240
232
|
- templates/cordova_android/framework/src/org/apache/cordova/Storage.java
|
241
233
|
- templates/cordova_android/framework/src/org/apache/cordova/TempListener.java
|
@@ -243,6 +235,7 @@ files:
|
|
243
235
|
- templates/cordova_android/framework/src/org/apache/cordova/api/IPlugin.java
|
244
236
|
- templates/cordova_android/framework/src/org/apache/cordova/api/LOG.java
|
245
237
|
- templates/cordova_android/framework/src/org/apache/cordova/api/Plugin.java
|
238
|
+
- templates/cordova_android/framework/src/org/apache/cordova/api/PluginEntry.java
|
246
239
|
- templates/cordova_android/framework/src/org/apache/cordova/api/PluginManager.java
|
247
240
|
- templates/cordova_android/framework/src/org/apache/cordova/api/PluginResult.java
|
248
241
|
- templates/cordova_android/framework/src/org/apache/cordova/file/EncodingException.java
|
@@ -252,6 +245,66 @@ files:
|
|
252
245
|
- templates/cordova_android/framework/src/org/apache/cordova/file/TypeMismatchException.java
|
253
246
|
- templates/cordova_android/framework/test/org/apache/cordova/PreferenceNodeTest.java
|
254
247
|
- templates/cordova_android/framework/test/org/apache/cordova/PreferenceSetTest.java
|
248
|
+
- templates/cordova_android/releasenotes.md
|
249
|
+
- templates/cordova_android/test/.classpath
|
250
|
+
- templates/cordova_android/test/.project
|
251
|
+
- templates/cordova_android/test/AndroidManifest.xml
|
252
|
+
- templates/cordova_android/test/README.md
|
253
|
+
- templates/cordova_android/test/ant.properties
|
254
|
+
- templates/cordova_android/test/assets/www/backbuttonmultipage/index.html
|
255
|
+
- templates/cordova_android/test/assets/www/backbuttonmultipage/sample2.html
|
256
|
+
- templates/cordova_android/test/assets/www/backbuttonmultipage/sample3.html
|
257
|
+
- templates/cordova_android/test/assets/www/background/index.html
|
258
|
+
- templates/cordova_android/test/assets/www/background/index2.html
|
259
|
+
- templates/cordova_android/test/assets/www/cordova-1.6.0.js
|
260
|
+
- templates/cordova_android/test/assets/www/cordova.js
|
261
|
+
- templates/cordova_android/test/assets/www/htmlnotfound/error.html
|
262
|
+
- templates/cordova_android/test/assets/www/iframe/index.html
|
263
|
+
- templates/cordova_android/test/assets/www/iframe/index2.html
|
264
|
+
- templates/cordova_android/test/assets/www/index.html
|
265
|
+
- templates/cordova_android/test/assets/www/jqmtabbackbutton/index.html
|
266
|
+
- templates/cordova_android/test/assets/www/jqmtabbackbutton/tab1.html
|
267
|
+
- templates/cordova_android/test/assets/www/jqmtabbackbutton/tab2.html
|
268
|
+
- templates/cordova_android/test/assets/www/jqmtabbackbutton/tab3.html
|
269
|
+
- templates/cordova_android/test/assets/www/lifecycle/index.html
|
270
|
+
- templates/cordova_android/test/assets/www/lifecycle/index2.html
|
271
|
+
- templates/cordova_android/test/assets/www/main.js
|
272
|
+
- templates/cordova_android/test/assets/www/master.css
|
273
|
+
- templates/cordova_android/test/assets/www/menus/index.html
|
274
|
+
- templates/cordova_android/test/assets/www/splashscreen/index.html
|
275
|
+
- templates/cordova_android/test/assets/www/userwebview/index.html
|
276
|
+
- templates/cordova_android/test/assets/www/whitelist/index.html
|
277
|
+
- templates/cordova_android/test/assets/www/whitelist/index2.html
|
278
|
+
- templates/cordova_android/test/assets/www/xhr/index.html
|
279
|
+
- templates/cordova_android/test/build.xml
|
280
|
+
- templates/cordova_android/test/libs/cordova-1.6.0.jar
|
281
|
+
- templates/cordova_android/test/project.properties
|
282
|
+
- templates/cordova_android/test/res/drawable-hdpi/ic_launcher.png
|
283
|
+
- templates/cordova_android/test/res/drawable-ldpi/ic_launcher.png
|
284
|
+
- templates/cordova_android/test/res/drawable-mdpi/ic_launcher.png
|
285
|
+
- templates/cordova_android/test/res/drawable/icon.png
|
286
|
+
- templates/cordova_android/test/res/drawable/sandy.jpg
|
287
|
+
- templates/cordova_android/test/res/layout/main.xml
|
288
|
+
- templates/cordova_android/test/res/values/strings.xml
|
289
|
+
- templates/cordova_android/test/res/xml/cordova.xml
|
290
|
+
- templates/cordova_android/test/res/xml/plugins.xml
|
291
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/ActivityPlugin.java
|
292
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/FixWebView.java
|
293
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/backbuttonmultipage.java
|
294
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/background.java
|
295
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/errorurl.java
|
296
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/htmlnotfound.java
|
297
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/iframe.java
|
298
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/jqmtabbackbutton.java
|
299
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/lifecycle.java
|
300
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/loading.java
|
301
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/menus.java
|
302
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/splashscreen.java
|
303
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/tests.java
|
304
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/timeout.java
|
305
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/userwebview.java
|
306
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/whitelist.java
|
307
|
+
- templates/cordova_android/test/src/org/apache/cordova/test/xhr.java
|
255
308
|
homepage: ''
|
256
309
|
licenses: []
|
257
310
|
post_install_message:
|
@@ -272,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
325
|
version: '0'
|
273
326
|
requirements: []
|
274
327
|
rubyforge_project:
|
275
|
-
rubygems_version: 1.8.
|
328
|
+
rubygems_version: 1.8.23
|
276
329
|
signing_key:
|
277
330
|
specification_version: 3
|
278
331
|
summary: Mobile Template Generator
|
@@ -1,137 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
* or more contributor license agreements. See the NOTICE file
|
4
|
-
* distributed with this work for additional information
|
5
|
-
* regarding copyright ownership. The ASF licenses this file
|
6
|
-
* to you under the Apache License, Version 2.0 (the
|
7
|
-
* "License"); you may not use this file except in compliance
|
8
|
-
* with the License. You may obtain a copy of the License at
|
9
|
-
*
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
*
|
12
|
-
* Unless required by applicable law or agreed to in writing,
|
13
|
-
* software distributed under the License is distributed on an
|
14
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
* KIND, either express or implied. See the License for the
|
16
|
-
* specific language governing permissions and limitations
|
17
|
-
* under the License.
|
18
|
-
*/
|
19
|
-
|
20
|
-
if (!Cordova.hasResource("accelerometer")) {
|
21
|
-
Cordova.addResource("accelerometer");
|
22
|
-
|
23
|
-
/** @constructor */
|
24
|
-
var Acceleration = function(x, y, z) {
|
25
|
-
this.x = x;
|
26
|
-
this.y = y;
|
27
|
-
this.z = z;
|
28
|
-
this.timestamp = new Date().getTime();
|
29
|
-
};
|
30
|
-
|
31
|
-
/**
|
32
|
-
* This class provides access to device accelerometer data.
|
33
|
-
* @constructor
|
34
|
-
*/
|
35
|
-
var Accelerometer = function() {
|
36
|
-
|
37
|
-
/**
|
38
|
-
* The last known acceleration. type=Acceleration()
|
39
|
-
*/
|
40
|
-
this.lastAcceleration = null;
|
41
|
-
|
42
|
-
/**
|
43
|
-
* List of accelerometer watch timers
|
44
|
-
*/
|
45
|
-
this.timers = {};
|
46
|
-
};
|
47
|
-
|
48
|
-
Accelerometer.ERROR_MSG = ["Not running", "Starting", "", "Failed to start"];
|
49
|
-
|
50
|
-
/**
|
51
|
-
* Asynchronously aquires the current acceleration.
|
52
|
-
*
|
53
|
-
* @param {Function} successCallback The function to call when the acceleration data is available
|
54
|
-
* @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
|
55
|
-
* @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
|
56
|
-
*/
|
57
|
-
Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) {
|
58
|
-
|
59
|
-
// successCallback required
|
60
|
-
if (typeof successCallback !== "function") {
|
61
|
-
console.log("Accelerometer Error: successCallback is not a function");
|
62
|
-
return;
|
63
|
-
}
|
64
|
-
|
65
|
-
// errorCallback optional
|
66
|
-
if (errorCallback && (typeof errorCallback !== "function")) {
|
67
|
-
console.log("Accelerometer Error: errorCallback is not a function");
|
68
|
-
return;
|
69
|
-
}
|
70
|
-
|
71
|
-
// Get acceleration
|
72
|
-
Cordova.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []);
|
73
|
-
};
|
74
|
-
|
75
|
-
/**
|
76
|
-
* Asynchronously aquires the acceleration repeatedly at a given interval.
|
77
|
-
*
|
78
|
-
* @param {Function} successCallback The function to call each time the acceleration data is available
|
79
|
-
* @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL)
|
80
|
-
* @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL)
|
81
|
-
* @return String The watch id that must be passed to #clearWatch to stop watching.
|
82
|
-
*/
|
83
|
-
Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) {
|
84
|
-
|
85
|
-
// Default interval (10 sec)
|
86
|
-
var frequency = (options !== undefined)? options.frequency : 10000;
|
87
|
-
|
88
|
-
// successCallback required
|
89
|
-
if (typeof successCallback !== "function") {
|
90
|
-
console.log("Accelerometer Error: successCallback is not a function");
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
|
94
|
-
// errorCallback optional
|
95
|
-
if (errorCallback && (typeof errorCallback !== "function")) {
|
96
|
-
console.log("Accelerometer Error: errorCallback is not a function");
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
|
100
|
-
// Make sure accelerometer timeout > frequency + 10 sec
|
101
|
-
Cordova.exec(
|
102
|
-
function(timeout) {
|
103
|
-
if (timeout < (frequency + 10000)) {
|
104
|
-
Cordova.exec(null, null, "Accelerometer", "setTimeout", [frequency + 10000]);
|
105
|
-
}
|
106
|
-
},
|
107
|
-
function(e) { }, "Accelerometer", "getTimeout", []);
|
108
|
-
|
109
|
-
// Start watch timer
|
110
|
-
var id = Cordova.createUUID();
|
111
|
-
navigator.accelerometer.timers[id] = setInterval(function() {
|
112
|
-
Cordova.exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []);
|
113
|
-
}, (frequency ? frequency : 1));
|
114
|
-
|
115
|
-
return id;
|
116
|
-
};
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Clears the specified accelerometer watch.
|
120
|
-
*
|
121
|
-
* @param {String} id The id of the watch returned from #watchAcceleration.
|
122
|
-
*/
|
123
|
-
Accelerometer.prototype.clearWatch = function(id) {
|
124
|
-
|
125
|
-
// Stop javascript timer & remove from timer list
|
126
|
-
if (id && navigator.accelerometer.timers[id] !== undefined) {
|
127
|
-
clearInterval(navigator.accelerometer.timers[id]);
|
128
|
-
delete navigator.accelerometer.timers[id];
|
129
|
-
}
|
130
|
-
};
|
131
|
-
|
132
|
-
Cordova.addConstructor(function() {
|
133
|
-
if (typeof navigator.accelerometer === "undefined") {
|
134
|
-
navigator.accelerometer = new Accelerometer();
|
135
|
-
}
|
136
|
-
});
|
137
|
-
}
|
@@ -1,89 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
* or more contributor license agreements. See the NOTICE file
|
4
|
-
* distributed with this work for additional information
|
5
|
-
* regarding copyright ownership. The ASF licenses this file
|
6
|
-
* to you under the Apache License, Version 2.0 (the
|
7
|
-
* "License"); you may not use this file except in compliance
|
8
|
-
* with the License. You may obtain a copy of the License at
|
9
|
-
*
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
*
|
12
|
-
* Unless required by applicable law or agreed to in writing,
|
13
|
-
* software distributed under the License is distributed on an
|
14
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
* KIND, either express or implied. See the License for the
|
16
|
-
* specific language governing permissions and limitations
|
17
|
-
* under the License.
|
18
|
-
*/
|
19
|
-
|
20
|
-
if (!Cordova.hasResource("app")) {
|
21
|
-
Cordova.addResource("app");
|
22
|
-
(function() {
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Constructor
|
26
|
-
* @constructor
|
27
|
-
*/
|
28
|
-
var App = function() {};
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Clear the resource cache.
|
32
|
-
*/
|
33
|
-
App.prototype.clearCache = function() {
|
34
|
-
Cordova.exec(null, null, "App", "clearCache", []);
|
35
|
-
};
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Load the url into the webview or into new browser instance.
|
39
|
-
*
|
40
|
-
* @param url The URL to load
|
41
|
-
* @param props Properties that can be passed in to the activity:
|
42
|
-
* wait: int => wait msec before loading URL
|
43
|
-
* loadingDialog: "Title,Message" => display a native loading dialog
|
44
|
-
* loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error
|
45
|
-
* clearHistory: boolean => clear webview history (default=false)
|
46
|
-
* openExternal: boolean => open in a new browser (default=false)
|
47
|
-
*
|
48
|
-
* Example:
|
49
|
-
* navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
|
50
|
-
*/
|
51
|
-
App.prototype.loadUrl = function(url, props) {
|
52
|
-
Cordova.exec(null, null, "App", "loadUrl", [url, props]);
|
53
|
-
};
|
54
|
-
|
55
|
-
/**
|
56
|
-
* Cancel loadUrl that is waiting to be loaded.
|
57
|
-
*/
|
58
|
-
App.prototype.cancelLoadUrl = function() {
|
59
|
-
Cordova.exec(null, null, "App", "cancelLoadUrl", []);
|
60
|
-
};
|
61
|
-
|
62
|
-
/**
|
63
|
-
* Clear web history in this web view.
|
64
|
-
* Instead of BACK button loading the previous web page, it will exit the app.
|
65
|
-
*/
|
66
|
-
App.prototype.clearHistory = function() {
|
67
|
-
Cordova.exec(null, null, "App", "clearHistory", []);
|
68
|
-
};
|
69
|
-
|
70
|
-
/**
|
71
|
-
* Go to previous page displayed.
|
72
|
-
* This is the same as pressing the backbutton on Android device.
|
73
|
-
*/
|
74
|
-
App.prototype.backHistory = function() {
|
75
|
-
Cordova.exec(null, null, "App", "backHistory", []);
|
76
|
-
};
|
77
|
-
|
78
|
-
/**
|
79
|
-
* Exit and terminate the application.
|
80
|
-
*/
|
81
|
-
App.prototype.exitApp = function() {
|
82
|
-
return Cordova.exec(null, null, "App", "exitApp", []);
|
83
|
-
};
|
84
|
-
|
85
|
-
Cordova.addConstructor(function() {
|
86
|
-
navigator.app = new App();
|
87
|
-
});
|
88
|
-
}());
|
89
|
-
}
|
@@ -1,134 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
3
|
-
* or more contributor license agreements. See the NOTICE file
|
4
|
-
* distributed with this work for additional information
|
5
|
-
* regarding copyright ownership. The ASF licenses this file
|
6
|
-
* to you under the Apache License, Version 2.0 (the
|
7
|
-
* "License"); you may not use this file except in compliance
|
8
|
-
* with the License. You may obtain a copy of the License at
|
9
|
-
*
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
*
|
12
|
-
* Unless required by applicable law or agreed to in writing,
|
13
|
-
* software distributed under the License is distributed on an
|
14
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
-
* KIND, either express or implied. See the License for the
|
16
|
-
* specific language governing permissions and limitations
|
17
|
-
* under the License.
|
18
|
-
*/
|
19
|
-
|
20
|
-
if (!Cordova.hasResource("battery")) {
|
21
|
-
Cordova.addResource("battery");
|
22
|
-
|
23
|
-
/**
|
24
|
-
* This class contains information about the current battery status.
|
25
|
-
* @constructor
|
26
|
-
*/
|
27
|
-
var Battery = function() {
|
28
|
-
this._level = null;
|
29
|
-
this._isPlugged = null;
|
30
|
-
this._batteryListener = [];
|
31
|
-
this._lowListener = [];
|
32
|
-
this._criticalListener = [];
|
33
|
-
};
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Registers as an event producer for battery events.
|
37
|
-
*
|
38
|
-
* @param {Object} eventType
|
39
|
-
* @param {Object} handler
|
40
|
-
* @param {Object} add
|
41
|
-
*/
|
42
|
-
Battery.prototype.eventHandler = function(eventType, handler, add) {
|
43
|
-
var me = navigator.battery;
|
44
|
-
if (add) {
|
45
|
-
// If there are no current registered event listeners start the battery listener on native side.
|
46
|
-
if (me._batteryListener.length === 0 && me._lowListener.length === 0 && me._criticalListener.length === 0) {
|
47
|
-
Cordova.exec(me._status, me._error, "Battery", "start", []);
|
48
|
-
}
|
49
|
-
|
50
|
-
// Register the event listener in the proper array
|
51
|
-
if (eventType === "batterystatus") {
|
52
|
-
if (me._batteryListener.indexOf(handler) === -1) {
|
53
|
-
me._batteryListener.push(handler);
|
54
|
-
}
|
55
|
-
} else if (eventType === "batterylow") {
|
56
|
-
if (me._lowListener.indexOf(handler) === -1) {
|
57
|
-
me._lowListener.push(handler);
|
58
|
-
}
|
59
|
-
} else if (eventType === "batterycritical") {
|
60
|
-
if (me._criticalListener.indexOf(handler) === -1) {
|
61
|
-
me._criticalListener.push(handler);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
} else {
|
65
|
-
var pos = -1;
|
66
|
-
// Remove the event listener from the proper array
|
67
|
-
if (eventType === "batterystatus") {
|
68
|
-
pos = me._batteryListener.indexOf(handler);
|
69
|
-
if (pos > -1) {
|
70
|
-
me._batteryListener.splice(pos, 1);
|
71
|
-
}
|
72
|
-
} else if (eventType === "batterylow") {
|
73
|
-
pos = me._lowListener.indexOf(handler);
|
74
|
-
if (pos > -1) {
|
75
|
-
me._lowListener.splice(pos, 1);
|
76
|
-
}
|
77
|
-
} else if (eventType === "batterycritical") {
|
78
|
-
pos = me._criticalListener.indexOf(handler);
|
79
|
-
if (pos > -1) {
|
80
|
-
me._criticalListener.splice(pos, 1);
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
// If there are no more registered event listeners stop the battery listener on native side.
|
85
|
-
if (me._batteryListener.length === 0 && me._lowListener.length === 0 && me._criticalListener.length === 0) {
|
86
|
-
Cordova.exec(null, null, "Battery", "stop", []);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Callback for battery status
|
93
|
-
*
|
94
|
-
* @param {Object} info keys: level, isPlugged
|
95
|
-
*/
|
96
|
-
Battery.prototype._status = function(info) {
|
97
|
-
if (info) {
|
98
|
-
var me = this;
|
99
|
-
var level = info.level;
|
100
|
-
if (me._level !== level || me._isPlugged !== info.isPlugged) {
|
101
|
-
// Fire batterystatus event
|
102
|
-
Cordova.fireWindowEvent("batterystatus", info);
|
103
|
-
|
104
|
-
// Fire low battery event
|
105
|
-
if (level === 20 || level === 5) {
|
106
|
-
if (level === 20) {
|
107
|
-
Cordova.fireWindowEvent("batterylow", info);
|
108
|
-
}
|
109
|
-
else {
|
110
|
-
Cordova.fireWindowEvent("batterycritical", info);
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
me._level = level;
|
115
|
-
me._isPlugged = info.isPlugged;
|
116
|
-
}
|
117
|
-
};
|
118
|
-
|
119
|
-
/**
|
120
|
-
* Error callback for battery start
|
121
|
-
*/
|
122
|
-
Battery.prototype._error = function(e) {
|
123
|
-
console.log("Error initializing Battery: " + e);
|
124
|
-
};
|
125
|
-
|
126
|
-
Cordova.addConstructor(function() {
|
127
|
-
if (typeof navigator.battery === "undefined") {
|
128
|
-
navigator.battery = new Battery();
|
129
|
-
Cordova.addWindowEventHandler("batterystatus", navigator.battery.eventHandler);
|
130
|
-
Cordova.addWindowEventHandler("batterylow", navigator.battery.eventHandler);
|
131
|
-
Cordova.addWindowEventHandler("batterycritical", navigator.battery.eventHandler);
|
132
|
-
}
|
133
|
-
});
|
134
|
-
}
|