Compare commits
1311 Commits
accel_hack
...
1.9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5e7c3fad3 | ||
|
|
2a8b9ab75e | ||
|
|
c8f0ffb42f | ||
|
|
b3e68b96cf | ||
|
|
ae7a550a09 | ||
|
|
e069bbb800 | ||
|
|
17ff6be6a9 | ||
|
|
d42489c67a | ||
|
|
e2047afa42 | ||
|
|
231b39d2dc | ||
|
|
dddce30368 | ||
|
|
e0e4ba2bd7 | ||
|
|
e0eadb6b76 | ||
|
|
483e5dfbea | ||
|
|
8aa9d8213d | ||
|
|
a74f71c935 | ||
|
|
87b81e53f0 | ||
|
|
a2816e31c3 | ||
|
|
f78af9f27b | ||
|
|
98138a0a60 | ||
|
|
e639b6303e | ||
|
|
99fb3ebe00 | ||
|
|
5829840409 | ||
|
|
4699ab5500 | ||
|
|
69fc7f39b7 | ||
|
|
510a962a52 | ||
|
|
570fc3cfb2 | ||
|
|
5d211f2fa6 | ||
|
|
dcb127c14d | ||
|
|
fba87de064 | ||
|
|
576f8cba44 | ||
|
|
b9f9429542 | ||
|
|
bf0df9f3c3 | ||
|
|
1d458f2782 | ||
|
|
5ca4b4a884 | ||
|
|
5935052ead | ||
|
|
f3f2ad9144 | ||
|
|
9d1edc4554 | ||
|
|
5143b8a492 | ||
|
|
7c67f40fc4 | ||
|
|
167b600135 | ||
|
|
6c465e25d3 | ||
|
|
c183d06ed1 | ||
|
|
574731b853 | ||
|
|
94568a4ec8 | ||
|
|
b22c0e5b6d | ||
|
|
ab3347d25d | ||
|
|
66872de8e5 | ||
|
|
f6d4402fdc | ||
|
|
9f66ccb5f3 | ||
|
|
b339330592 | ||
|
|
56acd2953b | ||
|
|
6f8e13297e | ||
|
|
e9a9144098 | ||
|
|
d1905dbee8 | ||
|
|
adc88f01b7 | ||
|
|
ccf0c5db67 | ||
|
|
507554b8e8 | ||
|
|
4795133daf | ||
|
|
c1c9075962 | ||
|
|
a691e9f744 | ||
|
|
8969eed506 | ||
|
|
be83095edf | ||
|
|
5c7783305a | ||
|
|
f394f7457b | ||
|
|
d60806bfa6 | ||
|
|
32febcb892 | ||
|
|
6c594b6f5f | ||
|
|
67d46432ed | ||
|
|
adf4166caa | ||
|
|
40b9810a63 | ||
|
|
aa45670d87 | ||
|
|
e6d801a594 | ||
|
|
0aec2be4dd | ||
|
|
c86b618aaa | ||
|
|
451afabfbb | ||
|
|
f60049f713 | ||
|
|
ee0cd679d3 | ||
|
|
07ed6daeda | ||
|
|
b5800ced61 | ||
|
|
6d879f19f8 | ||
|
|
dde79c14f5 | ||
|
|
b08f245504 | ||
|
|
cbd0b7a94b | ||
|
|
f060d09272 | ||
|
|
6edad7e7de | ||
|
|
f0f596c892 | ||
|
|
dbe65f1d35 | ||
|
|
cdaf620f92 | ||
|
|
09b753d09e | ||
|
|
838fa5635f | ||
|
|
0a4d218010 | ||
|
|
24944cff22 | ||
|
|
34820f4344 | ||
|
|
56047e5fc8 | ||
|
|
80ee6c1a91 | ||
|
|
5649fbac20 | ||
|
|
586d3ecd60 | ||
|
|
9ebdca66d9 | ||
|
|
41ddcf2218 | ||
|
|
cbe1216bc2 | ||
|
|
234ee63859 | ||
|
|
2402541974 | ||
|
|
8b1fb30f59 | ||
|
|
bf6864bce0 | ||
|
|
34ebdaddc1 | ||
|
|
9f42772b7e | ||
|
|
47211f6cb3 | ||
|
|
95b48705fe | ||
|
|
6c1a2e1230 | ||
|
|
55b1e40885 | ||
|
|
d87f404d6e | ||
|
|
48c6ec87cf | ||
|
|
71972dcaab | ||
|
|
3fd158ad6e | ||
|
|
447af8da6a | ||
|
|
e8b80e8752 | ||
|
|
30a1164f6a | ||
|
|
80a5ea137b | ||
|
|
db8a8f3556 | ||
|
|
81195db87d | ||
|
|
23ec117f57 | ||
|
|
d3e24b0c48 | ||
|
|
58c3f9a187 | ||
|
|
03aaab6f8b | ||
|
|
a489ae0fb6 | ||
|
|
c8af154205 | ||
|
|
6d1e0356ac | ||
|
|
adfdb16dc5 | ||
|
|
825b9eafc2 | ||
|
|
0ad9ff0d87 | ||
|
|
24e5c24dd4 | ||
|
|
8451133d00 | ||
|
|
be165c677f | ||
|
|
55ee289ed6 | ||
|
|
22e5ccfed4 | ||
|
|
508cafad1d | ||
|
|
ca979a99e8 | ||
|
|
4ecbaa79cf | ||
|
|
c12f01261a | ||
|
|
d6d2749411 | ||
|
|
509588b130 | ||
|
|
c21e8c9c87 | ||
|
|
e7411e8260 | ||
|
|
59f9b6f359 | ||
|
|
5f93a26eea | ||
|
|
d79403e352 | ||
|
|
ed94d0dd30 | ||
|
|
43df9f6b9c | ||
|
|
fd12f57f10 | ||
|
|
ca1a322c76 | ||
|
|
7d0cc5837d | ||
|
|
5edb3acad5 | ||
|
|
e35a8de4bb | ||
|
|
b77f1cbff8 | ||
|
|
8b93e87e3e | ||
|
|
cb61e90148 | ||
|
|
ccd4365922 | ||
|
|
d7b79f5042 | ||
|
|
95fa0f4461 | ||
|
|
c37b2d236b | ||
|
|
2d77bcf1a4 | ||
|
|
0c9295f8bc | ||
|
|
3b27d89c4a | ||
|
|
8356ac67e8 | ||
|
|
fae0c3dcfd | ||
|
|
6b24f2d547 | ||
|
|
2d5dcf24da | ||
|
|
15ddef26f4 | ||
|
|
531efe1e30 | ||
|
|
df89d33fab | ||
|
|
cb98bbce1f | ||
|
|
24adc6d00c | ||
|
|
71e47aa772 | ||
|
|
dffd2deb53 | ||
|
|
8ff48b371e | ||
|
|
6de66b87cb | ||
|
|
5dacb8d2d5 | ||
|
|
0850229c9f | ||
|
|
1f45503e2f | ||
|
|
c8a521c182 | ||
|
|
5c48ccd92a | ||
|
|
f74d8aaf2b | ||
|
|
7eb3e5d139 | ||
|
|
ffa1eb1ee9 | ||
|
|
24dfbfd84f | ||
|
|
ad6d71fef3 | ||
|
|
c178031f06 | ||
|
|
20db698475 | ||
|
|
dd624ccd9c | ||
|
|
ac504768b2 | ||
|
|
2d7b7160c3 | ||
|
|
2fbb9c285d | ||
|
|
47d99e5193 | ||
|
|
0437d6cc1a | ||
|
|
c6851cf7c5 | ||
|
|
45680a562e | ||
|
|
3b9d46fadc | ||
|
|
f840f3aceb | ||
|
|
afa1ecf3c5 | ||
|
|
295b9f4f5b | ||
|
|
79048a5a84 | ||
|
|
d683bd3744 | ||
|
|
9f5f4973ae | ||
|
|
441785b51d | ||
|
|
0d32115c3f | ||
|
|
e660768e4b | ||
|
|
01abb32025 | ||
|
|
d44d9ddca6 | ||
|
|
13f92b2b76 | ||
|
|
e6aa64760e | ||
|
|
3829df665f | ||
|
|
c8fafa6bbd | ||
|
|
aede2235d0 | ||
|
|
c56c73f250 | ||
|
|
fc50a0d954 | ||
|
|
c6349668dd | ||
|
|
dd0b6b1e30 | ||
|
|
eb66eb02cb | ||
|
|
5b324c85b0 | ||
|
|
fc9cff7d26 | ||
|
|
6a628f7f2d | ||
|
|
f3e70c79eb | ||
|
|
08a32272d3 | ||
|
|
a705b72740 | ||
|
|
de6652dd9d | ||
|
|
b2f49b15ba | ||
|
|
c0dcbecbea | ||
|
|
b323f329cc | ||
|
|
2625a57fdd | ||
|
|
2142d00bb9 | ||
|
|
4ce585be02 | ||
|
|
c2631ee0f7 | ||
|
|
8ab1733374 | ||
|
|
bafa438ce3 | ||
|
|
18cc90b3d8 | ||
|
|
0fd1e3c57b | ||
|
|
1ee484f70d | ||
|
|
724ea49f0b | ||
|
|
6fc2a3b84e | ||
|
|
b84d64912b | ||
|
|
e28f09e95b | ||
|
|
21f6d9c527 | ||
|
|
8e0c3c1fa1 | ||
|
|
9e10160366 | ||
|
|
d38dd4c131 | ||
|
|
84aaf02b0f | ||
|
|
269b90ad6f | ||
|
|
c11c4bea94 | ||
|
|
7de660808c | ||
|
|
1fcaf2435f | ||
|
|
87fbb5c92f | ||
|
|
3636a18bba | ||
|
|
ea8d6b17ec | ||
|
|
27e511b785 | ||
|
|
9dfa503bad | ||
|
|
a087116915 | ||
|
|
216f6a9b32 | ||
|
|
e32503fad7 | ||
|
|
c33f768570 | ||
|
|
20c7b512f3 | ||
|
|
5abe8dd506 | ||
|
|
e4119f3fd2 | ||
|
|
480e5ca4d1 | ||
|
|
e2d91c2556 | ||
|
|
634a9c0f4c | ||
|
|
f4cf2cecb5 | ||
|
|
5ab5cf03b5 | ||
|
|
13ba1e4900 | ||
|
|
c846111099 | ||
|
|
960e0f3412 | ||
|
|
39f261c6e2 | ||
|
|
17c919edd9 | ||
|
|
d7c8bc799d | ||
|
|
99b3693f40 | ||
|
|
483bb53d9c | ||
|
|
80ec23887e | ||
|
|
ea81b97bfc | ||
|
|
be39bf8d91 | ||
|
|
f4da7e164d | ||
|
|
ca66c4bf59 | ||
|
|
4192489836 | ||
|
|
05192a91da | ||
|
|
3835144b93 | ||
|
|
bdf452b02a | ||
|
|
bcc2957f20 | ||
|
|
81059b398f | ||
|
|
2e4667da88 | ||
|
|
9718aa5d4a | ||
|
|
d5dd43289b | ||
|
|
31d5a94ea9 | ||
|
|
1e5457a47d | ||
|
|
7b75e2f1b0 | ||
|
|
180696baec | ||
|
|
76820ebaff | ||
|
|
1bd7a662df | ||
|
|
c341cf0d47 | ||
|
|
327589a1d7 | ||
|
|
531b8f641f | ||
|
|
f2c38ea0a7 | ||
|
|
0772a315c4 | ||
|
|
8ac274cdca | ||
|
|
08d7a9c87a | ||
|
|
fea79bc971 | ||
|
|
eb48055acd | ||
|
|
e4a52de0a5 | ||
|
|
f2526bbc78 | ||
|
|
1794f2e047 | ||
|
|
b99e9abb5f | ||
|
|
e77f9bb8fc | ||
|
|
628f88cf79 | ||
|
|
ac06892dec | ||
|
|
87238f26f6 | ||
|
|
95013e87dd | ||
|
|
d604e8b9b4 | ||
|
|
9a2eb04054 | ||
|
|
f34da8a96f | ||
|
|
5e1997c8d8 | ||
|
|
36e6b572b7 | ||
|
|
3bda8afdc1 | ||
|
|
cdf148bb58 | ||
|
|
b532cf8545 | ||
|
|
ecebcbabf8 | ||
|
|
aa00e07b3c | ||
|
|
cb473dfed4 | ||
|
|
8b05ce41dd | ||
|
|
5d43835db8 | ||
|
|
838286df96 | ||
|
|
527f17d19e | ||
|
|
04aa6d3c38 | ||
|
|
e213772f98 | ||
|
|
0577b4bf5d | ||
|
|
a37d0699db | ||
|
|
2818e05e71 | ||
|
|
5fa77e97bd | ||
|
|
8d479c8269 | ||
|
|
700ae50e9b | ||
|
|
900be3afe0 | ||
|
|
d2b329636f | ||
|
|
49b50ce66c | ||
|
|
b793fbfc28 | ||
|
|
993fb296d6 | ||
|
|
59ff94fefb | ||
|
|
dfc86b1af1 | ||
|
|
f3c29840a7 | ||
|
|
6dabe4c010 | ||
|
|
1e2c38598f | ||
|
|
8ecfcb12c7 | ||
|
|
ae8bc77ee7 | ||
|
|
e25490751c | ||
|
|
9d0e8fa436 | ||
|
|
9d26598334 | ||
|
|
a688319ea7 | ||
|
|
bbf10e3baa | ||
|
|
7e70d76232 | ||
|
|
04b3e4d847 | ||
|
|
dc93556ef0 | ||
|
|
692a59a692 | ||
|
|
df691518e3 | ||
|
|
8f2cdcc049 | ||
|
|
d27064794c | ||
|
|
8a7af93765 | ||
|
|
f3c96ce1a0 | ||
|
|
715c0a5bea | ||
|
|
4b05ead3ac | ||
|
|
b4292868eb | ||
|
|
c5025ee2bb | ||
|
|
8923e52a5e | ||
|
|
aa4f2cc4d9 | ||
|
|
4a23f86411 | ||
|
|
a69bd65152 | ||
|
|
7392b63b99 | ||
|
|
73aa5cc7c3 | ||
|
|
7bf35e9c83 | ||
|
|
adb871f9e1 | ||
|
|
21b7346277 | ||
|
|
79935d31ef | ||
|
|
d2fc08959a | ||
|
|
3ebc1d71df | ||
|
|
f6503f8476 | ||
|
|
d593448182 | ||
|
|
403b87b68b | ||
|
|
bf69362709 | ||
|
|
c00fb987f6 | ||
|
|
7c6450de50 | ||
|
|
10cbcd7f5a | ||
|
|
e918ffd751 | ||
|
|
3ed41597d2 | ||
|
|
5722d976ce | ||
|
|
8555c42196 | ||
|
|
e85394dd99 | ||
|
|
cc5cfad58d | ||
|
|
363b1429e3 | ||
|
|
900ff9ed2c | ||
|
|
c9d4276207 | ||
|
|
fef0e429db | ||
|
|
26044ad662 | ||
|
|
42430d5d11 | ||
|
|
770a257ed3 | ||
|
|
9fe1f21c9f | ||
|
|
49d8d22d7f | ||
|
|
d274891c2c | ||
|
|
c099c65365 | ||
|
|
79ba28d6c4 | ||
|
|
b4d1ca6181 | ||
|
|
657faaff7f | ||
|
|
a43e80ae1d | ||
|
|
5253b5fb31 | ||
|
|
8b12bf79e4 | ||
|
|
45d75524c9 | ||
|
|
8a137395ae | ||
|
|
390fe537f8 | ||
|
|
40cd71484c | ||
|
|
9188773152 | ||
|
|
cc8edea065 | ||
|
|
14b368e731 | ||
|
|
4d03577220 | ||
|
|
040619cd61 | ||
|
|
d6fef8d6e3 | ||
|
|
7c1eb7da9b | ||
|
|
d87ee719a3 | ||
|
|
a52ba37cf7 | ||
|
|
cd667d6af5 | ||
|
|
7e4158ce94 | ||
|
|
0ba803ff46 | ||
|
|
6c48c6a3a1 | ||
|
|
7ee135e516 | ||
|
|
fd69095d3d | ||
|
|
357c0ee1ca | ||
|
|
40637c1486 | ||
|
|
a84d2eab02 | ||
|
|
52213541a3 | ||
|
|
c7d4d83476 | ||
|
|
003e3d4d85 | ||
|
|
95b9cd0229 | ||
|
|
044a61d881 | ||
|
|
9aa1cd756a | ||
|
|
ee4c91539a | ||
|
|
77547f8826 | ||
|
|
52a3a919f9 | ||
|
|
1293d64589 | ||
|
|
54968b755b | ||
|
|
d8d7c29afe | ||
|
|
1c7626aba2 | ||
|
|
e0fea2c352 | ||
|
|
210cc2bd5e | ||
|
|
664a061d10 | ||
|
|
fa4d6d369a | ||
|
|
3bff8aec88 | ||
|
|
e64cb2fc4f | ||
|
|
c5ada0f09f | ||
|
|
44edcbb3cf | ||
|
|
3fd2f590fd | ||
|
|
4f61531422 | ||
|
|
6e82ec4152 | ||
|
|
9206dca741 | ||
|
|
503640f6b5 | ||
|
|
e1e04f859c | ||
|
|
e30896155c | ||
|
|
282f59cd99 | ||
|
|
89e260a5a1 | ||
|
|
20891aee1a | ||
|
|
6e5ef1e819 | ||
|
|
e8544d30d1 | ||
|
|
f9af33b750 | ||
|
|
d28a60ed97 | ||
|
|
0890be5815 | ||
|
|
308a5f1509 | ||
|
|
7904bcc054 | ||
|
|
c7e3b46e2e | ||
|
|
490a13d3c4 | ||
|
|
1dfe7e59a7 | ||
|
|
a2cdcd47be | ||
|
|
a42451969f | ||
|
|
7955c6dd02 | ||
|
|
56096ad00e | ||
|
|
faacdd6b02 | ||
|
|
bdd7449af3 | ||
|
|
64c462c8ad | ||
|
|
cb0b054079 | ||
|
|
41b49df944 | ||
|
|
ffa76246e3 | ||
|
|
3af4d6b139 | ||
|
|
752b1b0e30 | ||
|
|
d91beb5ad9 | ||
|
|
8db5e06c62 | ||
|
|
bc309c9f00 | ||
|
|
9078fe17b5 | ||
|
|
3172ae4525 | ||
|
|
58774addad | ||
|
|
8c191331ae | ||
|
|
7f7c211769 | ||
|
|
51bf8c39af | ||
|
|
4bba9ac5a0 | ||
|
|
e9eb08486a | ||
|
|
3466ef6dfd | ||
|
|
36bca7d609 | ||
|
|
cc04b54adf | ||
|
|
e96ae91800 | ||
|
|
1d5af102c7 | ||
|
|
b106d2cae8 | ||
|
|
c66142d6b8 | ||
|
|
5fac30ea34 | ||
|
|
fae551f0ce | ||
|
|
65e3a8a453 | ||
|
|
1511183dfd | ||
|
|
a640804897 | ||
|
|
f95fdb5873 | ||
|
|
4b9e50146e | ||
|
|
26408fabe4 | ||
|
|
1dfc65face | ||
|
|
18bf4cd94b | ||
|
|
729d141c3f | ||
|
|
29001eeb3a | ||
|
|
acc9173e6e | ||
|
|
f387720e54 | ||
|
|
2094854588 | ||
|
|
8dbb8f58b1 | ||
|
|
75963c88d5 | ||
|
|
188e3e7d7d | ||
|
|
e02322b66b | ||
|
|
8904c67fb5 | ||
|
|
feff655530 | ||
|
|
71ea25f40a | ||
|
|
7840448133 | ||
|
|
e77e552293 | ||
|
|
5ceb6e2cfa | ||
|
|
035ad08c69 | ||
|
|
80d0a0cb4c | ||
|
|
05e233bf1d | ||
|
|
853a734f82 | ||
|
|
d5580557f1 | ||
|
|
7a6a59383b | ||
|
|
c70a1e8594 | ||
|
|
cd5bf6195e | ||
|
|
7c8db0ea44 | ||
|
|
119f6cca85 | ||
|
|
4a25d780ce | ||
|
|
798cb3e347 | ||
|
|
63ae953432 | ||
|
|
36caaf366f | ||
|
|
3ebfb6717c | ||
|
|
9409caad69 | ||
|
|
5406d6c98f | ||
|
|
29c7e12505 | ||
|
|
cbdd400fe7 | ||
|
|
a6db1112c6 | ||
|
|
bfef72a7c4 | ||
|
|
7ce2a8cb71 | ||
|
|
2a866e2a7c | ||
|
|
827af8a920 | ||
|
|
0caca9ae55 | ||
|
|
0bbcf5cfd2 | ||
|
|
fd93404c7c | ||
|
|
e9fcb296bb | ||
|
|
d5d95ad489 | ||
|
|
db0a1919f3 | ||
|
|
141b8355ac | ||
|
|
affab67ca3 | ||
|
|
cf9848bd59 | ||
|
|
7ad3f76d9a | ||
|
|
7244a5a727 | ||
|
|
538cdb03fc | ||
|
|
8057bca4f2 | ||
|
|
546b33c936 | ||
|
|
9b5a63e8e4 | ||
|
|
798d502083 | ||
|
|
813637eb78 | ||
|
|
e4a5000f9e | ||
|
|
fd07cfc461 | ||
|
|
d1ec1f7693 | ||
|
|
e1d3f1491f | ||
|
|
5075a3e087 | ||
|
|
a35a33c05e | ||
|
|
5a40613ccc | ||
|
|
2d690ad014 | ||
|
|
ff2ee67cb8 | ||
|
|
505081f42f | ||
|
|
80ee464dce | ||
|
|
e4a992095f | ||
|
|
aa6e011255 | ||
|
|
12816aa8f3 | ||
|
|
60b5d42324 | ||
|
|
d3d1c06c09 | ||
|
|
010e162cd7 | ||
|
|
191e1bf150 | ||
|
|
cdeddf1bb2 | ||
|
|
bd7ed19b52 | ||
|
|
64b770b761 | ||
|
|
628473cc5b | ||
|
|
75f3651376 | ||
|
|
3e25953d33 | ||
|
|
996791696b | ||
|
|
a08854eaf0 | ||
|
|
81ec4bc4fb | ||
|
|
0b9ed0c7c7 | ||
|
|
ffb614dd91 | ||
|
|
e26685becf | ||
|
|
90b8c20e28 | ||
|
|
a8db71cd67 | ||
|
|
543fe1f43f | ||
|
|
1f2f9a02dd | ||
|
|
551f0f7e4a | ||
|
|
369d140040 | ||
|
|
ac509369e9 | ||
|
|
5faed8378c | ||
|
|
7ee04ebf31 | ||
|
|
0ec47c5bd8 | ||
|
|
fe3e7041b7 | ||
|
|
75ab33ad0c | ||
|
|
1377f60b29 | ||
|
|
8b595f9796 | ||
|
|
1f8d6b4866 | ||
|
|
ea87dfe08a | ||
|
|
2d388025ad | ||
|
|
424078432a | ||
|
|
bb2bd22fad | ||
|
|
6b29787df7 | ||
|
|
804ac714ae | ||
|
|
9ede0ceca1 | ||
|
|
24ad506da5 | ||
|
|
80695ec5e4 | ||
|
|
6098f46d08 | ||
|
|
367d7500d5 | ||
|
|
0d57404cf1 | ||
|
|
67393c516e | ||
|
|
ebb9f09168 | ||
|
|
a4d66c63a4 | ||
|
|
6a9253e928 | ||
|
|
0f988717d0 | ||
|
|
025577c41d | ||
|
|
f271e2e0fa | ||
|
|
821eb24a54 | ||
|
|
336a58ca5a | ||
|
|
aa6e4185de | ||
|
|
75c2cdb3ad | ||
|
|
e92057a00f | ||
|
|
80df4a8fb2 | ||
|
|
bb777c096c | ||
|
|
94c1fb3e63 | ||
|
|
e9bb66622c | ||
|
|
362841008a | ||
|
|
6fabcfc8d3 | ||
|
|
9040eea76c | ||
|
|
9c0b15f7af | ||
|
|
2b20b1880d | ||
|
|
61c4836366 | ||
|
|
e8826090bb | ||
|
|
e1b3a8cdce | ||
|
|
0b6a39bc6f | ||
|
|
aa577416de | ||
|
|
d34c0b086e | ||
|
|
073f71563c | ||
|
|
9eb02a4882 | ||
|
|
6c3d13fc74 | ||
|
|
70de3d49a2 | ||
|
|
e41746b6a8 | ||
|
|
6af5e2e2e1 | ||
|
|
9083e921d9 | ||
|
|
4a38f160fb | ||
|
|
0297807bd0 | ||
|
|
2e9cbdf38d | ||
|
|
498f879383 | ||
|
|
91f4097fd8 | ||
|
|
0ece6cedfe | ||
|
|
f3fd6901d6 | ||
|
|
4f121aa07d | ||
|
|
4119fd513a | ||
|
|
a6ae85b4ea | ||
|
|
5ffdaeb213 | ||
|
|
95c48f7f6c | ||
|
|
d34dcf8ee5 | ||
|
|
e7f206b598 | ||
|
|
9aacb7f811 | ||
|
|
caf2694ced | ||
|
|
7bf8c617c3 | ||
|
|
9ad78a50f7 | ||
|
|
85a24d491e | ||
|
|
65fd082537 | ||
|
|
d9ec6df5a8 | ||
|
|
63bd7f470e | ||
|
|
c419f7d269 | ||
|
|
3e5a52ceee | ||
|
|
97faebda41 | ||
|
|
f111ea56ed | ||
|
|
e2acd1af33 | ||
|
|
ff4ea29713 | ||
|
|
8d35b1aeef | ||
|
|
75233711e3 | ||
|
|
4b488fc911 | ||
|
|
facb752cc7 | ||
|
|
c5d3a60f56 | ||
|
|
8a5dec8d8b | ||
|
|
43baa58ab3 | ||
|
|
a9c34e65fb | ||
|
|
5180340f18 | ||
|
|
8a4737947b | ||
|
|
0e316321f9 | ||
|
|
ef8e8a3ab4 | ||
|
|
fe265ce9e1 | ||
|
|
28b972be52 | ||
|
|
4a9fbb6869 | ||
|
|
8cf00fc788 | ||
|
|
8b908fbad0 | ||
|
|
e44cc8add1 | ||
|
|
5a3208291c | ||
|
|
1c064b0922 | ||
|
|
ffdb240114 | ||
|
|
2f9060dd3e | ||
|
|
efe021916e | ||
|
|
65cf68b5d2 | ||
|
|
91d8dd42c1 | ||
|
|
7e2044c5b4 | ||
|
|
3666490347 | ||
|
|
80891b8495 | ||
|
|
55379d6fba | ||
|
|
361a7aacc5 | ||
|
|
19040671a9 | ||
|
|
4ecfbac586 | ||
|
|
8d46d33675 | ||
|
|
a735a631f6 | ||
|
|
381d1615b4 | ||
|
|
ad8086fab5 | ||
|
|
19332c1903 | ||
|
|
fd22a7915e | ||
|
|
8c7db9aa32 | ||
|
|
7bb34dea14 | ||
|
|
004453b03f | ||
|
|
a1edf92fa4 | ||
|
|
e28458869f | ||
|
|
b4c4fa9667 | ||
|
|
229e15f685 | ||
|
|
39d6952494 | ||
|
|
b864a8a6c6 | ||
|
|
f5dac1451d | ||
|
|
2bf765897b | ||
|
|
411288b051 | ||
|
|
1c97467e39 | ||
|
|
7c39edfcd0 | ||
|
|
9f673db79f | ||
|
|
8c807315e9 | ||
|
|
be48b576d9 | ||
|
|
648e56cb67 | ||
|
|
b37defd3cf | ||
|
|
c093881f54 | ||
|
|
e09c728fd0 | ||
|
|
d098b6133e | ||
|
|
c067299ace | ||
|
|
029ddeade0 | ||
|
|
17ccb2db4d | ||
|
|
6b84ead393 | ||
|
|
9bf3a82964 | ||
|
|
7afa2d3840 | ||
|
|
e789349c23 | ||
|
|
f7ebc98375 | ||
|
|
2787a960d8 | ||
|
|
4af8952dc3 | ||
|
|
701717fd55 | ||
|
|
3de2084af2 | ||
|
|
6d532c9fe5 | ||
|
|
eb0e0d9d11 | ||
|
|
53410781e4 | ||
|
|
2bee9a8442 | ||
|
|
7c9eca1fab | ||
|
|
017fa1b917 | ||
|
|
24bb836221 | ||
|
|
6993c7edd1 | ||
|
|
4cc3772e84 | ||
|
|
2a3c387ce3 | ||
|
|
c80ddc1b22 | ||
|
|
e1092590d6 | ||
|
|
24f979394f | ||
|
|
9971d61601 | ||
|
|
6c65a6a016 | ||
|
|
37b9cc47bd | ||
|
|
66f7afbed2 | ||
|
|
b1c0be3dd6 | ||
|
|
60be45b9d9 | ||
|
|
393bd5a1f5 | ||
|
|
1de036a744 | ||
|
|
a235513991 | ||
|
|
22a9cabeb9 | ||
|
|
5de4ae7554 | ||
|
|
f19d8f9bba | ||
|
|
d4ccc702b2 | ||
|
|
a0c748620a | ||
|
|
b85a769372 | ||
|
|
dd52081deb | ||
|
|
ebd92a4b12 | ||
|
|
0a7a77e77b | ||
|
|
9d1e73656f | ||
|
|
6e62a76564 | ||
|
|
3895570edd | ||
|
|
28b01fe494 | ||
|
|
709eacd9dc | ||
|
|
090890b22a | ||
|
|
ce9d577415 | ||
|
|
cfc9631873 | ||
|
|
3bf48f82af | ||
|
|
f9bcf71a7a | ||
|
|
9d5aa9406c | ||
|
|
0b1e760fc1 | ||
|
|
941b64f6a2 | ||
|
|
7cc1cc4a3f | ||
|
|
c98b758e94 | ||
|
|
102d37d48a | ||
|
|
4b647fc58d | ||
|
|
b7156c6803 | ||
|
|
b8cc36e805 | ||
|
|
76b2df208e | ||
|
|
9643314553 | ||
|
|
1e3422ae70 | ||
|
|
fc1bea4947 | ||
|
|
afb48e52b6 | ||
|
|
b5dc62d9ef | ||
|
|
2a786044de | ||
|
|
f3d7ce8fc3 | ||
|
|
85dab52cf7 | ||
|
|
c96c9b00b9 | ||
|
|
b059a31787 | ||
|
|
8cb71673c2 | ||
|
|
5c8913351c | ||
|
|
8ef93ff0e5 | ||
|
|
042c34192b | ||
|
|
ac2e92321f | ||
|
|
05eacf4792 | ||
|
|
435c903baf | ||
|
|
53de070a41 | ||
|
|
54fdcbfd46 | ||
|
|
44aa0aeb0f | ||
|
|
7d53eb8e3e | ||
|
|
7bc0d624ac | ||
|
|
a5039f021d | ||
|
|
80e66d87a9 | ||
|
|
d35e8cd44b | ||
|
|
eb3b1f91d4 | ||
|
|
8a1ab69235 | ||
|
|
66f3018767 | ||
|
|
ff7de25b62 | ||
|
|
85eb6e4997 | ||
|
|
0280d5dd82 | ||
|
|
3c90a9a23c | ||
|
|
088c342198 | ||
|
|
af18a8e1aa | ||
|
|
11a29e11e1 | ||
|
|
226e4dddcd | ||
|
|
08c44f5c5d | ||
|
|
66dbd9ef8b | ||
|
|
1c3ea54dcb | ||
|
|
a65638ab59 | ||
|
|
1a9471a2e0 | ||
|
|
c15971253f | ||
|
|
a67dfdb75e | ||
|
|
9b52827744 | ||
|
|
c5b268756b | ||
|
|
afa85a74b3 | ||
|
|
517b5e0db9 | ||
|
|
327bda49a0 | ||
|
|
c978341d83 | ||
|
|
939754e1c9 | ||
|
|
5e733ede9f | ||
|
|
d1448e9073 | ||
|
|
e5fb0c0e71 | ||
|
|
33bfb44f67 | ||
|
|
a89c8bf482 | ||
|
|
b46cbfd673 | ||
|
|
a67aeed571 | ||
|
|
fbb6b22de6 | ||
|
|
315b5a59b3 | ||
|
|
8da5ad8eca | ||
|
|
740e50ce61 | ||
|
|
3ce0fc4897 | ||
|
|
8d1722ad67 | ||
|
|
7d41646a35 | ||
|
|
992ee0bca4 | ||
|
|
d00a9f33cd | ||
|
|
431c80782e | ||
|
|
39ec9c095d | ||
|
|
10e1808c56 | ||
|
|
9036eb8fcc | ||
|
|
4280fdf252 | ||
|
|
ca5e141b5b | ||
|
|
8f7a5decb6 | ||
|
|
1d79b6617b | ||
|
|
6c3eefe6f9 | ||
|
|
2177cd0a39 | ||
|
|
6618015151 | ||
|
|
e99f75d59b | ||
|
|
ab8cfe01d0 | ||
|
|
e84c59d23c | ||
|
|
e81fc239a7 | ||
|
|
839c577243 | ||
|
|
116169a4c5 | ||
|
|
346ed60f0d | ||
|
|
bde59adc04 | ||
|
|
ffbc010d7b | ||
|
|
bdadbbc339 | ||
|
|
b94eedaf07 | ||
|
|
58ecac335b | ||
|
|
fd8bb2f671 | ||
|
|
0aacfbdd50 | ||
|
|
2cd116e4e7 | ||
|
|
673a8871df | ||
|
|
44945f9d5e | ||
|
|
887f754014 | ||
|
|
674015460f | ||
|
|
40084293c3 | ||
|
|
ed4c57e791 | ||
|
|
bf164f4161 | ||
|
|
626119ae3b | ||
|
|
307f9d1871 | ||
|
|
e766188689 | ||
|
|
d74569ffa7 | ||
|
|
d424af03e4 | ||
|
|
f6f80537c3 | ||
|
|
908485751b | ||
|
|
b850d225f4 | ||
|
|
010c774988 | ||
|
|
969f0c87d7 | ||
|
|
b3e9794189 | ||
|
|
935295c9b8 | ||
|
|
648df2624f | ||
|
|
04de2052fd | ||
|
|
60eb60b4f5 | ||
|
|
ec307fdda8 | ||
|
|
7344964c05 | ||
|
|
1e4dc1bf5d | ||
|
|
1fc56921aa | ||
|
|
21a34a8980 | ||
|
|
8d73b364f2 | ||
|
|
fb2c25c6c6 | ||
|
|
47ca081f36 | ||
|
|
939b70243d | ||
|
|
d44bb7a9d8 | ||
|
|
dccc29daf2 | ||
|
|
b402efd1f7 | ||
|
|
0c3a8fb9f7 | ||
|
|
64d4337d5f | ||
|
|
a9e1751812 | ||
|
|
2bc7bd6768 | ||
|
|
1711fb07d7 | ||
|
|
6f4673f590 | ||
|
|
5e858f8bc3 | ||
|
|
691b093ccd | ||
|
|
99002f9dce | ||
|
|
b07072c12b | ||
|
|
36dd964ba4 | ||
|
|
f848527c28 | ||
|
|
6aa055f46e | ||
|
|
7952668cf7 | ||
|
|
a0c761664d | ||
|
|
9fd9cf55cf | ||
|
|
3c9089b9c7 | ||
|
|
f220489543 | ||
|
|
b65f9517db | ||
|
|
1a0de5f626 | ||
|
|
3c0bef6cc1 | ||
|
|
040194157f | ||
|
|
7ebf8130e4 | ||
|
|
64310dc85c | ||
|
|
cd2e86af2f | ||
|
|
b353f3608d | ||
|
|
cda154209d | ||
|
|
e3c72fa915 | ||
|
|
9354b429f3 | ||
|
|
b1f0c037bd | ||
|
|
726f1094d9 | ||
|
|
1b8ab156df | ||
|
|
ee01b5058f | ||
|
|
03ea8a0b5a | ||
|
|
f090f9a70c | ||
|
|
b7abc2c344 | ||
|
|
53bdf2dd6b | ||
|
|
b9e1b1d280 | ||
|
|
9051b157f8 | ||
|
|
f16d9b01b7 | ||
|
|
2a9bc2ddf8 | ||
|
|
6e39c46b07 | ||
|
|
567ca94245 | ||
|
|
812a4b32b4 | ||
|
|
023df10f31 | ||
|
|
8d513e2765 | ||
|
|
1eae6786c4 | ||
|
|
73f278963b | ||
|
|
54eff557d9 | ||
|
|
a7415bcfc9 | ||
|
|
b6bd9ad5b8 | ||
|
|
f71d9deb5e | ||
|
|
115b428a9d | ||
|
|
92a1e4a2d9 | ||
|
|
2504db13d7 | ||
|
|
43c72e684c | ||
|
|
46f0bf60c4 | ||
|
|
8bad4eb7eb | ||
|
|
fbe96f891b | ||
|
|
ab8950a5af | ||
|
|
26adfb6346 | ||
|
|
43b6b6d34e | ||
|
|
04ddc68dfd | ||
|
|
42cd10cf56 | ||
|
|
5f3bc33f8e | ||
|
|
2131070ee9 | ||
|
|
b2a82975e5 | ||
|
|
ddeba91faf | ||
|
|
6e572f05e4 | ||
|
|
50b435c4d1 | ||
|
|
af5c5dc021 | ||
|
|
87fd9665fe | ||
|
|
5e9ca84b40 | ||
|
|
090ad56d0b | ||
|
|
e3ebfea064 | ||
|
|
44761f87d2 | ||
|
|
04e3ceac96 | ||
|
|
afc7e605ff | ||
|
|
1c5aa6cd00 | ||
|
|
c1a87ebaaa | ||
|
|
46babe7a48 | ||
|
|
0dc64d2aa7 | ||
|
|
1d9e522bd9 | ||
|
|
5dcac6d7fe | ||
|
|
07418a3606 | ||
|
|
0e08af98ca | ||
|
|
b8b1ad8421 | ||
|
|
4fa1f40b44 | ||
|
|
5f55ebf1d9 | ||
|
|
9798de7efa | ||
|
|
102745875c | ||
|
|
dce0d93df8 | ||
|
|
1428ac5ed5 | ||
|
|
4f1bc1401f | ||
|
|
28ff6e1150 | ||
|
|
5ffe5fa3c5 | ||
|
|
49341356d7 | ||
|
|
e8b85f6cf7 | ||
|
|
4b2398b487 | ||
|
|
10f3313ed5 | ||
|
|
46664c6494 | ||
|
|
8ce7e61ed7 | ||
|
|
912458c679 | ||
|
|
e117b95057 | ||
|
|
3a0101261d | ||
|
|
48d3bc09f3 | ||
|
|
0b3e27b3fa | ||
|
|
b66535a17d | ||
|
|
fdc78e1b08 | ||
|
|
36064c564e | ||
|
|
7102810283 | ||
|
|
ab4d4e22da | ||
|
|
80c15de606 | ||
|
|
be5cac6d0b | ||
|
|
2bb67ee4b0 | ||
|
|
f7254044ee | ||
|
|
2e5d6f5b74 | ||
|
|
b7024ad1f5 | ||
|
|
577284b960 | ||
|
|
35b3808701 | ||
|
|
45c9a88fd7 | ||
|
|
831670e4ae | ||
|
|
37a9307681 | ||
|
|
34f6e878d5 | ||
|
|
bc1e039ea1 | ||
|
|
8c624c7f22 | ||
|
|
f63b8140af | ||
|
|
153d42f693 | ||
|
|
5647e54399 | ||
|
|
8663ed412f | ||
|
|
1761cbb3dc | ||
|
|
072613be99 | ||
|
|
6b7fc8119f | ||
|
|
29549b835a | ||
|
|
60fc61065e | ||
|
|
de23753204 | ||
|
|
9cd4d4c603 | ||
|
|
bc086cb93d | ||
|
|
f15bdf9445 | ||
|
|
9358e23726 | ||
|
|
6d605c1cbf | ||
|
|
be16eebf55 | ||
|
|
1f3bd9f51c | ||
|
|
5bdc81e84d | ||
|
|
08963b5e5f | ||
|
|
522a7225db | ||
|
|
032db387f8 | ||
|
|
5164464d28 | ||
|
|
a66ef4641f | ||
|
|
3fd372f9d1 | ||
|
|
b125f4e74b | ||
|
|
3a9c106aba | ||
|
|
a31ce5ef2a | ||
|
|
bf3b38036b | ||
|
|
34859ec479 | ||
|
|
4a6105de6b | ||
|
|
50ab0e0834 | ||
|
|
72b2ec804c | ||
|
|
086e6ea56b | ||
|
|
122395e0d0 | ||
|
|
98206852de | ||
|
|
dc960b9835 | ||
|
|
9adb85a64b | ||
|
|
23b02e7267 | ||
|
|
e3cef16629 | ||
|
|
5a2398dbea | ||
|
|
f1421bc724 | ||
|
|
7d6ffc676d | ||
|
|
385be26046 | ||
|
|
68146329b9 | ||
|
|
1231268a6b | ||
|
|
cbff3812e8 | ||
|
|
f8ae11993f | ||
|
|
3138178fea | ||
|
|
f20e5cf943 | ||
|
|
a1b35b7636 | ||
|
|
8eaaa04746 | ||
|
|
2bbf62c489 | ||
|
|
c80397ad68 | ||
|
|
c91ea37438 | ||
|
|
9671083bed | ||
|
|
6071b9c75a | ||
|
|
668bc9e0ca | ||
|
|
297ddb99fe | ||
|
|
cbd5686e7d | ||
|
|
a772acbd89 | ||
|
|
c2240966ef | ||
|
|
36984f4697 | ||
|
|
ac92498594 | ||
|
|
7bfe94ffc7 | ||
|
|
f85f4e6b69 | ||
|
|
c13c0c37e3 | ||
|
|
2098436a2c | ||
|
|
a427b8cead | ||
|
|
bcf920669b | ||
|
|
a9f057c278 | ||
|
|
4e4207f294 | ||
|
|
c86f7d053c | ||
|
|
7f7cc1db2a | ||
|
|
edfa41c9f9 | ||
|
|
1768b507f8 | ||
|
|
36949f4af1 | ||
|
|
328bc106e5 | ||
|
|
063e189bb7 | ||
|
|
1a9173d2c3 | ||
|
|
fdca4c5ecb | ||
|
|
b079a24373 | ||
|
|
ace84227cc | ||
|
|
f68b75c1cf | ||
|
|
f272748c5b | ||
|
|
a59cad68e2 | ||
|
|
eff7c92dae | ||
|
|
ca4d7f7fd2 | ||
|
|
0ed522481f | ||
|
|
2d4a321cc1 | ||
|
|
00dc18a488 | ||
|
|
b95ad44c18 | ||
|
|
9d3306ccc5 | ||
|
|
c2bcc29cfb | ||
|
|
0a2d7bf536 | ||
|
|
0895083f1f | ||
|
|
8de6d9ce15 | ||
|
|
c483ebd1d7 | ||
|
|
92d2b5812c | ||
|
|
9c2e4cfd9c | ||
|
|
8da131cc45 | ||
|
|
5cd25316fa | ||
|
|
705b8f6874 | ||
|
|
c050e00b8f | ||
|
|
03f6267c82 | ||
|
|
d955502ca2 | ||
|
|
f606012c87 | ||
|
|
3f24c63fc5 | ||
|
|
b78896e5f0 | ||
|
|
0efe871efe | ||
|
|
633100a3ce | ||
|
|
1c0de5ad8d | ||
|
|
e4d1087b72 | ||
|
|
040a3d7d43 | ||
|
|
fb281ddc9f | ||
|
|
afd278cf80 | ||
|
|
53fca124ab | ||
|
|
d72c77d6f3 | ||
|
|
0a7762743e | ||
|
|
863807a7a5 | ||
|
|
5c20ba57e9 | ||
|
|
a13b8fc124 | ||
|
|
2b015164f4 | ||
|
|
a21080fb76 | ||
|
|
cda0319be3 | ||
|
|
7108076260 | ||
|
|
7f3cf4a884 | ||
|
|
2d2adf29fd | ||
|
|
b02f376826 | ||
|
|
1fa41df3f1 | ||
|
|
77801de1ae | ||
|
|
3c9bae3402 | ||
|
|
d208f7bea7 | ||
|
|
4f360c2680 | ||
|
|
9e931cc3f6 | ||
|
|
5c24abcafd | ||
|
|
6d403c5864 | ||
|
|
0417a9873b | ||
|
|
22e9530c66 | ||
|
|
40997b4cb8 | ||
|
|
5d83a44ec3 | ||
|
|
d39781f3fb | ||
|
|
75636f7f00 | ||
|
|
f77e51290b | ||
|
|
8163416e27 | ||
|
|
9185848cbc | ||
|
|
d2e19d8818 | ||
|
|
5c481ebe40 | ||
|
|
1febba48ff | ||
|
|
a6faa68a5c | ||
|
|
48ace80183 | ||
|
|
b06d02028a | ||
|
|
c53427d7ec | ||
|
|
f818f9bda9 | ||
|
|
83070fc4ea | ||
|
|
6cd1d8113e | ||
|
|
5a90792e0d | ||
|
|
90b708fe83 | ||
|
|
f48a19554c | ||
|
|
cf7a4f0fb6 | ||
|
|
86a7a0d9e3 | ||
|
|
a5323d77f5 | ||
|
|
190cec7730 | ||
|
|
be7f0a2496 | ||
|
|
06779773dd | ||
|
|
2384714138 | ||
|
|
91f1f475e9 | ||
|
|
b1af7d8739 | ||
|
|
86d6053d2d | ||
|
|
c6280edbed | ||
|
|
4fd8a4dad8 | ||
|
|
fb2b8345d1 | ||
|
|
c9a579af8c | ||
|
|
92b838e07a | ||
|
|
f0cd97de72 | ||
|
|
764c9191b7 | ||
|
|
fbcaf15353 | ||
|
|
4eec4c0801 | ||
|
|
b01668d262 | ||
|
|
ae800455b1 | ||
|
|
56f0e8e087 | ||
|
|
8ca1804de9 | ||
|
|
0c52ed44a0 | ||
|
|
bb5a628a28 | ||
|
|
49de553ee8 | ||
|
|
1af469c8b1 | ||
|
|
2b2b4f5dd4 | ||
|
|
742910f369 | ||
|
|
3365dba870 | ||
|
|
ac0ba41ccf | ||
|
|
745aa7201c | ||
|
|
ea8dc73525 | ||
|
|
8683667041 | ||
|
|
24869b637d | ||
|
|
13679fe00d | ||
|
|
9f1730ae47 | ||
|
|
5e46fad0e9 | ||
|
|
e0d1414c4a | ||
|
|
8e5de2cb7b | ||
|
|
ca01781766 | ||
|
|
f7a4a0aef8 | ||
|
|
27ff3068f5 | ||
|
|
27c4de6aa0 | ||
|
|
e5bbbbe35c | ||
|
|
b4d3a10773 | ||
|
|
1850d2c04e | ||
|
|
5bdad8c0ca | ||
|
|
4b3255e4fd | ||
|
|
d5646584ee | ||
|
|
f15555ee34 | ||
|
|
b18657cf72 | ||
|
|
32b68f568b | ||
|
|
4e02179bf8 | ||
|
|
853dc0d8aa | ||
|
|
4d5d8d253b | ||
|
|
ab4ca5ec8b | ||
|
|
9ff45f70e2 | ||
|
|
3cba58ce57 | ||
|
|
8e7ce8780e | ||
|
|
707738c3ee | ||
|
|
e3b32e7679 | ||
|
|
ea1184cdd3 | ||
|
|
89dd0396fe | ||
|
|
8c0cb5716d | ||
|
|
6d60a2b012 | ||
|
|
7304741164 | ||
|
|
d2048a7c5a | ||
|
|
ac952b25bb | ||
|
|
d6e79f158f | ||
|
|
9bf83337c9 | ||
|
|
36bd034ee5 | ||
|
|
dc58c67883 | ||
|
|
88eef5df66 | ||
|
|
c75e66a2fc | ||
|
|
4e31d4af63 | ||
|
|
5972147e36 | ||
|
|
8ec0de457f | ||
|
|
310766180f | ||
|
|
db9d603881 | ||
|
|
e5f03b6aed | ||
|
|
bde54704d3 | ||
|
|
d20abc9aad | ||
|
|
945c0d95e6 | ||
|
|
bb501de22c | ||
|
|
bab03882e1 | ||
|
|
7ad30dfc63 | ||
|
|
4c5f820316 | ||
|
|
b65a0b1bd6 | ||
|
|
8f18dae2c1 | ||
|
|
653190c6a1 |
20
.gitignore
vendored
@@ -1,6 +1,20 @@
|
||||
.DS_Store
|
||||
default.properties
|
||||
bin
|
||||
gen
|
||||
assets/www/phonegap.js
|
||||
assets/www/cordova.js
|
||||
local.properties
|
||||
framework/phonegap.jar
|
||||
framework/proguard.cfg
|
||||
framework/cordova.jar
|
||||
framework/cordova-*.jar
|
||||
framework/phonegap-*.jar
|
||||
framework/bin
|
||||
framework/test/org/apache/cordova/*.class
|
||||
framework/assets/www/.DS_Store
|
||||
framework/assets/www/cordova-*.js
|
||||
framework/assets/www/phonegap-*.js
|
||||
example
|
||||
./test
|
||||
tmp
|
||||
*.tmp
|
||||
test/libs/*.jar
|
||||
bin/node_modules
|
||||
|
||||
219
LICENSE
@@ -1,21 +1,202 @@
|
||||
Copyright (c) 2010 Nitobi
|
||||
website: http://phonegap.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
Software), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
5
NOTICE
Normal file
@@ -0,0 +1,5 @@
|
||||
Apache Cordova
|
||||
Copyright 2012 The Apache Software Foundation
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org)
|
||||
128
README.md
Normal file → Executable file
@@ -1,46 +1,114 @@
|
||||
PhoneGap/Android
|
||||
================
|
||||
PhoneGap/Android is an Android application library that allows for PhoneGap based projects to be built for the Android Platform. PhoneGap based applications are, at the core, an application written with web technology: HTML, CSS and JavaScript.
|
||||
Cordova Android
|
||||
===
|
||||
|
||||
Cordova Android is an Android application library that allows for Cordova based projects to be built for the Android Platform. Cordova based applications are, at the core, an application written with web technology: HTML, CSS and JavaScript.
|
||||
|
||||
Apache Cordova is an effort undergoing incubation at The Apache
|
||||
Software Foundation (ASF), sponsored by the Apache Incubator project.
|
||||
Incubation is required of all newly accepted projects until a further
|
||||
review indicates that the infrastructure, communications, and decision
|
||||
making process have stabilized in a manner consistent with other
|
||||
successful ASF projects. While incubation status is not necessarily
|
||||
a reflection of the completeness or stability of the code, it does
|
||||
indicate that the project has yet to be fully endorsed by the ASF.
|
||||
|
||||
Requires
|
||||
---
|
||||
|
||||
Pre-requisites
|
||||
--------------
|
||||
- Java JDK 1.5
|
||||
- Android SDK Package [http://developer.android.com](http://developer.android.com)
|
||||
- Apache ANT
|
||||
- Ruby
|
||||
- Android SDK [http://developer.android.com](http://developer.android.com)
|
||||
- Apache Commons Codec [http://commons.apache.org/codec/](http://commons.apache.org/codec/)
|
||||
|
||||
Recommended
|
||||
-----------
|
||||
- Eclipse (Great for debugging and extending PhoneGap/Android with your own Java plugins.)
|
||||
Test Requirements
|
||||
---
|
||||
- JUnit - [https://github.com/KentBeck/junit](https://github.com/KentBeck/junit)
|
||||
|
||||
Building
|
||||
---
|
||||
|
||||
Getting Started with PhoneGap/Android
|
||||
--------------------------------------
|
||||
To create your cordova.jar, copy the commons codec:
|
||||
|
||||
1. From the root of this repo run the following command to generate a new PhoneGap/Android app:
|
||||
mv commons-codec-1.6.jar framework/libs
|
||||
|
||||
<pre>
|
||||
./droidgap [android_sdk_path] [name] [package_name] [www] [path]
|
||||
then run in the framework directory:
|
||||
|
||||
android_sdk_path ... The path to your Android SDK install.
|
||||
name ............... The name of your application.
|
||||
package_name ....... The name of your package (For example: com.nitobi.demo)
|
||||
www ................ The path to your www folder. (Wherein your HTML, CSS and JS app is.)
|
||||
path ............... The path to generate the application.
|
||||
</pre>
|
||||
android update project -p . -t android-15
|
||||
ant jar
|
||||
|
||||
Thats it!
|
||||
|
||||
Importing a PhoneGap/Android app into Eclipse
|
||||
---------------------------------------------
|
||||
Cordova Android Developer Tools
|
||||
---
|
||||
|
||||
The Cordova developer tooling is split between general tooling and project level tooling.
|
||||
|
||||
To enable the command-line tools available in the ./bin directory, make
|
||||
sure you have all of the dependencies installed. You will need
|
||||
[NodeJS](http://nodejs.org) (which should come with `npm`). To install
|
||||
the dependencies:
|
||||
|
||||
$ cd bin
|
||||
$ npm install
|
||||
|
||||
General Commands
|
||||
|
||||
./bin/create [path package activity] ... create the ./example app or a cordova android project
|
||||
./bin/bench ............................ generate a bench proj
|
||||
./bin/autotest ......................... test the cli tools
|
||||
./bin/test ............................. run mobile-spec
|
||||
|
||||
Project Commands
|
||||
|
||||
These commands live in a generated Cordova Android project.
|
||||
|
||||
./cordovap/debug [path] ..................... install to first device
|
||||
./cordova/emulate .......................... start avd (emulator) named default
|
||||
./cordova/log .............................. starts logcat
|
||||
|
||||
Running the Example Project
|
||||
---
|
||||
|
||||
Start avd (emulator) named `default`:
|
||||
|
||||
./bin/emulate
|
||||
|
||||
Create the example project and build it to the first device:
|
||||
|
||||
./bin/create
|
||||
cd example
|
||||
./cordova/debug
|
||||
|
||||
Start adb logcat (console.log calls output here):
|
||||
|
||||
./cordova/log
|
||||
|
||||
Running the [callback/callback-test](http://github.com/callback/callback-test) tests:
|
||||
---
|
||||
|
||||
./bin/test
|
||||
|
||||
Creating a new Cordova Android Project
|
||||
---
|
||||
|
||||
./bin/create ~/Desktop/myapp com.phonegap.special MyApp
|
||||
|
||||
Importing a Cordova Android Project into Eclipse
|
||||
----
|
||||
|
||||
1. File > New > Project...
|
||||
2. Android > Android Project
|
||||
3. Create project from existing source (point to the generated app). This should import the project into Eclipse. Almost done!
|
||||
4. Right click on libs/phonegap.jar and add to build path.
|
||||
3. Create project from existing source (point to the generated app found in tmp/android)
|
||||
4. Right click on libs/cordova.jar and add to build path
|
||||
5. Right click on the project root: Run as > Run Configurations
|
||||
6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to).
|
||||
6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)
|
||||
|
||||
For more info see
|
||||
-----------------
|
||||
Running Tests
|
||||
----
|
||||
Please see details under test/README.md.
|
||||
|
||||
Further Reading
|
||||
---
|
||||
|
||||
- [http://developer.android.com](http://developer.android.com)
|
||||
- [http://docs.phonegap.com](http://docs.phonegap.com)
|
||||
- [http://wiki.phonegap.com](http://wiki.phonegap.com)
|
||||
- [http://wiki.phonegap.com](http://wiki.phonegap.com)
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
<!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>PhoneGap</title>
|
||||
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
var deviceInfo = function(){
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
console.log("Height:" + window.innerHeight);
|
||||
console.log("Width:" + window.innerWidth);
|
||||
}
|
||||
|
||||
var getLocation = function() {
|
||||
var suc = function(p){
|
||||
alert(p.coords.latitude + " " + p.coords.longitude);
|
||||
};
|
||||
var fail = function(){};
|
||||
navigator.geolocation.getCurrentPosition(suc,fail);
|
||||
}
|
||||
|
||||
var beep = function(){
|
||||
navigator.notification.beep(2);
|
||||
}
|
||||
|
||||
var vibrate = function(){
|
||||
navigator.notification.vibrate(0);
|
||||
}
|
||||
|
||||
var getContact = function(){
|
||||
var suc = function(c){ alert("Contact 4: " + c.contacts[3].name); };
|
||||
var fail = function(){};
|
||||
navigator.ContactManager.get(suc, fail);
|
||||
}
|
||||
|
||||
var watchAccel = function() {
|
||||
var suc = function(a){
|
||||
document.getElementById('x').innerHTML = roundNumber(a.x);
|
||||
document.getElementById('y').innerHTML = roundNumber(a.y);
|
||||
document.getElementById('z').innerHTML = roundNumber(a.z);
|
||||
};
|
||||
var fail = function(){};
|
||||
var opt = {};
|
||||
opt.frequency = 100;
|
||||
timer = navigator.accelerometer.watchAcceleration(suc,fail,opt);
|
||||
}
|
||||
|
||||
function roundNumber(num) {
|
||||
var dec = 3;
|
||||
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
|
||||
return result;
|
||||
}
|
||||
|
||||
var preventBehavior = function(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
function show_pic()
|
||||
{
|
||||
var viewport = document.getElementById('viewport');
|
||||
viewport.style.display = "";
|
||||
navigator.camera.getPicture(dump_pic, fail, { quality: 50 });
|
||||
}
|
||||
|
||||
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 close()
|
||||
{
|
||||
var viewport = document.getElementById('viewport');
|
||||
viewport.style.position = "relative";
|
||||
viewport.style.display = "none";
|
||||
}
|
||||
|
||||
function fail(fail)
|
||||
{
|
||||
alert(fail);
|
||||
}
|
||||
|
||||
// This is just to do this.
|
||||
function readFile()
|
||||
{
|
||||
navigator.file.read('/sdcard/phonegap.txt', fail , fail);
|
||||
}
|
||||
|
||||
function writeFile()
|
||||
{
|
||||
navigator.file.write('foo.txt', "This is a test of writing to a file", fail, fail);
|
||||
}
|
||||
|
||||
function get_contacts()
|
||||
{
|
||||
navigator.ContactManager.getAllContacts(count_contacts, fail, null);
|
||||
}
|
||||
|
||||
function count_contacts(contacts)
|
||||
{
|
||||
alert(contacts.length);
|
||||
}
|
||||
|
||||
function init(){
|
||||
document.addEventListener("touchmove", preventBehavior, false);
|
||||
document.addEventListener("deviceready", deviceInfo, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Welcome to PhoneGap!</h1>
|
||||
<h2>this file is located at assets/index.html</h2>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span></h4>
|
||||
<h4>Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span></h4>
|
||||
</div>
|
||||
<dl id="accel-data">
|
||||
<dt>X:</dt><dd id="x"> </dd>
|
||||
<dt>Y:</dt><dd id="y"> </dd>
|
||||
<dt>Z:</dt><dd id="z"> </dd>
|
||||
</dl>
|
||||
<a href="#" class="btn large" onclick="watchAccel();">Watch Accelerometer</a>
|
||||
<a href="#" class="btn large" onclick="getLocation();">Get Location</a>
|
||||
<a href="tel://411" class="btn large">Call 411</a>
|
||||
<a href="#" class="btn large" onclick="beep();">Beep</a>
|
||||
<a href="#" class="btn large" onclick="vibrate();">Vibrate</a>
|
||||
<a href="#" class="btn large" onclick="show_pic();">Get a Picture</a>
|
||||
<a href="#" class="btn large" onclick="get_contacts();">Get phone's contacts</a>
|
||||
<div id="viewport" class="viewport" style="display: none;">
|
||||
<img style="width:60px;height:60px" id="test_img" src="" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
134
bin/create
Executable file
@@ -0,0 +1,134 @@
|
||||
#! /bin/sh
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# create a cordova/android project
|
||||
#
|
||||
# USAGE
|
||||
# ./create [path package activity]
|
||||
#
|
||||
set -e
|
||||
|
||||
if [ -n "$1" ] && [ "$1" == "-h" ]
|
||||
then
|
||||
echo 'usage: create path package activity'
|
||||
echo "Make sure the Android SDK tools folder is in your PATH!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BUILD_PATH=$( cd "$( dirname "$0" )/.." && pwd )
|
||||
VERSION=$(cat $BUILD_PATH/VERSION)
|
||||
|
||||
PROJECT_PATH=${1:-"./example"}
|
||||
PACKAGE=${2:-"org.apache.cordova.example"}
|
||||
ACTIVITY=${3:-"cordovaExample"}
|
||||
|
||||
# clobber any existing example
|
||||
if [ -d $PROJECT_PATH ]
|
||||
then
|
||||
echo "Project already exists! Delete and recreate"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# cleanup after exit and/or on error
|
||||
function on_exit {
|
||||
# [ -f $BUILD_PATH/framework/libs/commons-codec-1.6.jar ] && rm $BUILD_PATH/framework/libs/commons-codec-1.6.jar
|
||||
# [ -d $BUILD_PATH/framework/libs ] && rmdir $BUILD_PATH/framework/libs
|
||||
if [ -f $BUILD_PATH/framework/assets/www/cordova-$VERSION.js ]
|
||||
then
|
||||
rm $BUILD_PATH/framework/assets/www/cordova-$VERSION.js
|
||||
fi
|
||||
if [ -f $BUILD_PATH/framework/cordova-$VERSION.jar ]
|
||||
then
|
||||
rm $BUILD_PATH/framework/cordova-$VERSION.jar
|
||||
fi
|
||||
}
|
||||
|
||||
function on_error {
|
||||
echo "An error occured. Deleting project..."
|
||||
[ -d $PROJECT_PATH ] && rm -rf $PROJECT_PATH
|
||||
}
|
||||
|
||||
# we do not want the script to silently fail
|
||||
trap on_error ERR
|
||||
trap on_exit EXIT
|
||||
|
||||
ANDROID_BIN=$( which android )
|
||||
PACKAGE_AS_PATH=$(echo $PACKAGE | sed 's/\./\//g')
|
||||
ACTIVITY_PATH=$PROJECT_PATH/src/$PACKAGE_AS_PATH/$ACTIVITY.java
|
||||
MANIFEST_PATH=$PROJECT_PATH/AndroidManifest.xml
|
||||
|
||||
TARGET=$($ANDROID_BIN list targets | grep id: | tail -1 | cut -f 2 -d ' ' )
|
||||
|
||||
# if this a distribution release no need to build a jar
|
||||
if [ ! -e $BUILD_PATH/cordova-$VERSION.jar ] && [ -d $BUILD_PATH/framework ]
|
||||
then
|
||||
# update the cordova-android framework for the desired target
|
||||
$ANDROID_BIN update project --target $TARGET --path $BUILD_PATH/framework &> /dev/null
|
||||
|
||||
if [ ! -e $BUILD_PATH/framework/libs/commons-codec-1.6.jar ]; then
|
||||
# Use curl to get the jar (TODO: Support Apache Mirrors)
|
||||
curl -OL http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip &> /dev/null
|
||||
unzip commons-codec-1.6-bin.zip &> /dev/null
|
||||
mkdir -p $BUILD_PATH/framework/libs
|
||||
cp commons-codec-1.6/commons-codec-1.6.jar $BUILD_PATH/framework/libs
|
||||
# cleanup yo
|
||||
rm commons-codec-1.6-bin.zip && rm -rf commons-codec-1.6
|
||||
fi
|
||||
|
||||
# compile cordova.js and cordova.jar
|
||||
(cd $BUILD_PATH/framework && ant jar &> /dev/null )
|
||||
fi
|
||||
|
||||
|
||||
# create new android project
|
||||
$ANDROID_BIN create project --target $TARGET --path $PROJECT_PATH --package $PACKAGE --activity $ACTIVITY &> /dev/null
|
||||
|
||||
# copy project template
|
||||
cp -r $BUILD_PATH/bin/templates/project/assets $PROJECT_PATH
|
||||
cp -r $BUILD_PATH/bin/templates/project/res $PROJECT_PATH
|
||||
|
||||
# copy cordova.js, cordova.jar and res/xml
|
||||
if [ -d $BUILD_PATH/framework ]
|
||||
then
|
||||
cp -r $BUILD_PATH/framework/res/xml $PROJECT_PATH/res
|
||||
cp $BUILD_PATH/framework/assets/www/cordova-$VERSION.js $PROJECT_PATH/assets/www/cordova-$VERSION.js
|
||||
cp $BUILD_PATH/framework/cordova-$VERSION.jar $PROJECT_PATH/libs/cordova-$VERSION.jar
|
||||
else
|
||||
cp -r $BUILD_PATH/xml $PROJECT_PATH/res/xml
|
||||
cp $BUILD_PATH/cordova-$VERSION.js $PROJECT_PATH/assets/www/cordova-$VERSION.js
|
||||
cp $BUILD_PATH/cordova-$VERSION.jar $PROJECT_PATH/libs/cordova-$VERSION.jar
|
||||
fi
|
||||
|
||||
# interpolate the activity name and package
|
||||
cp $BUILD_PATH/bin/templates/project/Activity.java $ACTIVITY_PATH
|
||||
sed -i '' -e "s/__ACTIVITY__/${ACTIVITY}/g" $ACTIVITY_PATH
|
||||
sed -i '' -e "s/__ID__/${PACKAGE}/g" $ACTIVITY_PATH
|
||||
|
||||
cp $BUILD_PATH/bin/templates/project/AndroidManifest.xml $MANIFEST_PATH
|
||||
sed -i '' -e "s/__ACTIVITY__/${ACTIVITY}/g" $MANIFEST_PATH
|
||||
sed -i '' -e "s/__PACKAGE__/${PACKAGE}/g" $MANIFEST_PATH
|
||||
|
||||
# creating cordova folder and copying emulate/debug/log/launch scripts
|
||||
mkdir $PROJECT_PATH/cordova
|
||||
cp $BUILD_PATH/bin/templates/cordova/appinfo.jar $PROJECT_PATH/cordova/appinfo.jar
|
||||
cp $BUILD_PATH/bin/templates/cordova/cordova $PROJECT_PATH/cordova/cordova
|
||||
cp $BUILD_PATH/bin/templates/cordova/debug $PROJECT_PATH/cordova/debug
|
||||
cp $BUILD_PATH/bin/templates/cordova/clean $PROJECT_PATH/cordova/clean
|
||||
cp $BUILD_PATH/bin/templates/cordova/log $PROJECT_PATH/cordova/log
|
||||
cp $BUILD_PATH/bin/templates/cordova/emulate $PROJECT_PATH/cordova/emulate
|
||||
cp $BUILD_PATH/bin/templates/cordova/BOOM $PROJECT_PATH/cordova/BOOM
|
||||
15
bin/create.bat
Normal file
@@ -0,0 +1,15 @@
|
||||
@ECHO OFF
|
||||
IF NOT DEFINED JAVA_HOME GOTO MISSING
|
||||
FOR %%X in (java.exe ant.bat android.bat) do (
|
||||
SET FOUND=%%~$PATH:X
|
||||
IF NOT DEFINED FOUND GOTO MISSING
|
||||
)
|
||||
cscript %~dp0\create.js %*
|
||||
GOTO END
|
||||
:MISSING
|
||||
ECHO Missing one of the following:
|
||||
ECHO JDK: http://java.oracle.com
|
||||
ECHO Android SDK: http://developer.android.com
|
||||
ECHO Apache ant: http://ant.apache.org
|
||||
EXIT /B 1
|
||||
:END
|
||||
188
bin/create.js
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* create a cordova/android project
|
||||
*
|
||||
* USAGE
|
||||
* ./create [path package activity]
|
||||
*/
|
||||
|
||||
var fso = WScript.CreateObject('Scripting.FileSystemObject');
|
||||
|
||||
function read(filename) {
|
||||
var fso=WScript.CreateObject("Scripting.FileSystemObject");
|
||||
var f=fso.OpenTextFile(filename, 1);
|
||||
var s=f.ReadAll();
|
||||
f.Close();
|
||||
return s;
|
||||
}
|
||||
function setTarget() {
|
||||
var targets = shell.Exec('android.bat list targets').StdOut.ReadAll().match(/id:\s\d+/g);
|
||||
return targets[targets.length - 1].replace(/id: /, ""); // TODO: give users the option to set their target
|
||||
}
|
||||
function write(filename, contents) {
|
||||
var fso=WScript.CreateObject("Scripting.FileSystemObject");
|
||||
var f=fso.OpenTextFile(filename, 2, true);
|
||||
f.Write(contents);
|
||||
f.Close();
|
||||
}
|
||||
function replaceInFile(filename, regexp, replacement) {
|
||||
write(filename, read(filename).replace(regexp, replacement));
|
||||
}
|
||||
function exec(command) {
|
||||
var oShell=shell.Exec(command);
|
||||
while (oShell.Status == 0) {
|
||||
WScript.sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
// Cleanup
|
||||
// if(fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.6.jar')) {
|
||||
// fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.6.jar');
|
||||
// fso.DeleteFolder(ROOT + '\\framework\\libs', true);
|
||||
// }
|
||||
if(fso.FileExists(ROOT + '\\framework\\cordova-'+VERSION+'.jar')) {
|
||||
fso.DeleteFile(ROOT + '\\framework\\cordova-'+VERSION+'.jar');
|
||||
}
|
||||
if(fso.FileExists(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js')) {
|
||||
fso.DeleteFile(ROOT + '\\framework\\assets\\www\\cordova-'+VERSION+'.js');
|
||||
}
|
||||
}
|
||||
|
||||
function downloadCommonsCodec() {
|
||||
if (!fso.FileExists(ROOT + '\\framework\\libs\\commons-codec-1.6.jar')) {
|
||||
// We need the .jar
|
||||
var url = 'http://mirror.symnds.com/software/Apache//commons/codec/binaries/commons-codec-1.6-bin.zip';
|
||||
var libsPath = ROOT + '\\framework\\libs';
|
||||
var savePath = libsPath + '\\commons-codec-1.6-bin.zip';
|
||||
if (!fso.FileExists(savePath)) {
|
||||
if(!fso.FolderExists(ROOT + '\\framework\\libs')) {
|
||||
fso.CreateFolder(libsPath);
|
||||
}
|
||||
// We need the zip to get the jar
|
||||
var xhr = WScript.CreateObject('MSXML2.XMLHTTP');
|
||||
xhr.open('GET', url, false);
|
||||
xhr.send();
|
||||
if (xhr.status == 200) {
|
||||
var stream = WScript.CreateObject('ADODB.Stream');
|
||||
stream.Open();
|
||||
stream.Type = 1;
|
||||
stream.Write(xhr.ResponseBody);
|
||||
stream.Position = 0;
|
||||
stream.SaveToFile(savePath);
|
||||
stream.Close();
|
||||
} else {
|
||||
WScript.Echo('Could not retrieve the commons-codec. Please download it yourself and put into the framework/libs directory. This process may fail now. Sorry.');
|
||||
}
|
||||
}
|
||||
var app = WScript.CreateObject('Shell.Application');
|
||||
var source = app.NameSpace(savePath).Items();
|
||||
var target = app.NameSpace(ROOT + '\\framework\\libs');
|
||||
target.CopyHere(source, 256);
|
||||
|
||||
// Move the jar into libs
|
||||
fso.MoveFile(ROOT + '\\framework\\libs\\commons-codec-1.6\\commons-codec-1.6.jar', ROOT + '\\framework\\libs\\commons-codec-1.6.jar');
|
||||
|
||||
// Clean up
|
||||
fso.DeleteFile(ROOT + '\\framework\\libs\\commons-codec-1.6-bin.zip');
|
||||
fso.DeleteFolder(ROOT + '\\framework\\libs\\commons-codec-1.6', true);
|
||||
}
|
||||
}
|
||||
|
||||
var args = WScript.Arguments, PROJECT_PATH="example",
|
||||
PACKAGE="org.apache.cordova.example", ACTIVITY="cordovaExample",
|
||||
shell=WScript.CreateObject("WScript.Shell");
|
||||
|
||||
// working dir
|
||||
var ROOT = WScript.ScriptFullName.split('\\bin\\create.js').join('');
|
||||
|
||||
if (args.Count() == 3) {
|
||||
PROJECT_PATH=args(0);
|
||||
PACKAGE=args(1);
|
||||
ACTIVITY=args(2);
|
||||
}
|
||||
|
||||
if(fso.FolderExists(PROJECT_PATH)) {
|
||||
WScript.Echo("Project already exists!");
|
||||
WScript.Quit(1);
|
||||
}
|
||||
|
||||
var PACKAGE_AS_PATH=PACKAGE.replace(/\./g, '\\');
|
||||
var ACTIVITY_PATH=PROJECT_PATH+'\\src\\'+PACKAGE_AS_PATH+'\\'+ACTIVITY+'.java';
|
||||
var MANIFEST_PATH=PROJECT_PATH+'\\AndroidManifest.xml';
|
||||
var TARGET=setTarget();
|
||||
var VERSION=read(ROOT+'\\VERSION').replace(/\r\n/,'').replace(/\n/,'');
|
||||
// create the project
|
||||
exec('android.bat create project --target '+TARGET+' --path '+PROJECT_PATH+' --package '+PACKAGE+' --activity '+ACTIVITY);
|
||||
|
||||
// build from source. distro should have these files
|
||||
if (!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.jar') &&
|
||||
!fso.FileExists(ROOT+'\\cordova-'+VERSION+'.js')) {
|
||||
// update the cordova framework project to a target that exists on this machine
|
||||
exec('android.bat update project --target '+TARGET+' --path '+ROOT+'\\framework');
|
||||
// pull down commons codec if necessary
|
||||
downloadCommonsCodec();
|
||||
exec('ant.bat -f '+ ROOT +'\\framework\\build.xml jar');
|
||||
}
|
||||
|
||||
// copy in the project template
|
||||
exec('%comspec% /c xcopy '+ ROOT + '\\bin\\templates\\project\\res '+PROJECT_PATH+'\\res\\ /E /Y');
|
||||
exec('%comspec% /c xcopy '+ ROOT + '\\bin\\templates\\project\\assets '+PROJECT_PATH+'\\assets\\ /E /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\project\\AndroidManifest.xml ' + PROJECT_PATH + '\\AndroidManifest.xml /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\project\\Activity.java '+ ACTIVITY_PATH +' /Y');
|
||||
|
||||
// check if we have the source or the distro files
|
||||
if(fso.FolderExists(ROOT + '\\framework')) {
|
||||
exec('%comspec% /c copy '+ROOT+'\\framework\\assets\\www\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\framework\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y');
|
||||
fso.CreateFolder(PROJECT_PATH + '\\res\\xml');
|
||||
exec('%comspec% /c copy '+ROOT+'\\framework\\res\\xml\\cordova.xml ' + PROJECT_PATH + '\\res\\xml\\cordova.xml /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\framework\\res\\xml\\plugins.xml ' + PROJECT_PATH + '\\res\\xml\\plugins.xml /Y');
|
||||
} else {
|
||||
// copy in cordova.js
|
||||
exec('%comspec% /c copy '+ROOT+'\\cordova-'+VERSION+'.js '+PROJECT_PATH+'\\assets\\www\\cordova-'+VERSION+'.js /Y');
|
||||
// copy in cordova.jar
|
||||
exec('%comspec% /c copy '+ROOT+'\\cordova-'+VERSION+'.jar '+PROJECT_PATH+'\\libs\\cordova-'+VERSION+'.jar /Y');
|
||||
// copy in xml
|
||||
fso.CreateFolder(PROJECT_PATH + '\\res\\xml');
|
||||
exec('%comspec% /c copy '+ROOT+'\\xml\\cordova.xml ' + PROJECT_PATH + '\\res\\xml\\cordova.xml /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\xml\\plugins.xml ' + PROJECT_PATH + '\\res\\xml\\plugins.xml /Y');
|
||||
}
|
||||
|
||||
// copy cordova scripts
|
||||
fso.CreateFolder(PROJECT_PATH + '\\cordova');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\appinfo.jar ' + PROJECT_PATH + '\\cordova\\appinfo.jar /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\cordova.js ' + PROJECT_PATH + '\\cordova\\cordova.js /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\cordova.bat ' + PROJECT_PATH + '\\cordova\\cordova.bat /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\clean.bat ' + PROJECT_PATH + '\\cordova\\clean.bat /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\debug.bat ' + PROJECT_PATH + '\\cordova\\debug.bat /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\log.bat ' + PROJECT_PATH + '\\cordova\\log.bat /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\emulate.bat ' + PROJECT_PATH + '\\cordova\\emulate.bat /Y');
|
||||
exec('%comspec% /c copy '+ROOT+'\\bin\\templates\\cordova\\BOOM.bat ' + PROJECT_PATH + '\\cordova\\BOOM.bat /Y');
|
||||
|
||||
// interpolate the activity name and package
|
||||
replaceInFile(ACTIVITY_PATH, /__ACTIVITY__/, ACTIVITY);
|
||||
replaceInFile(ACTIVITY_PATH, /__ID__/, PACKAGE);
|
||||
|
||||
replaceInFile(MANIFEST_PATH, /__ACTIVITY__/, ACTIVITY);
|
||||
replaceInFile(MANIFEST_PATH, /__PACKAGE__/, PACKAGE);
|
||||
|
||||
cleanup();
|
||||
98
bin/create.xml
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project name="cordova" default="create" basedir="../">
|
||||
|
||||
<property name="project.path" value="${basedir}/example"/>
|
||||
<property name="package" value="org.apache.cordova.example"/>
|
||||
<property name="activity" value="cordovaExample"/>
|
||||
|
||||
<target name="create">
|
||||
|
||||
<!-- this stuff is seriously stupid -->
|
||||
<echo file="tmp/package.tmp">package-as-path=${package}</echo>
|
||||
<replace file="tmp/package.tmp" token="." value="\\" />
|
||||
<property file="tmp/package.tmp" />
|
||||
|
||||
<property name="activity.path" value="${project.path}/src/${package-as-path}/${activity}.java" />
|
||||
<property name="manifest.path" value="${project.path}/AndroidManifest.xml" />
|
||||
|
||||
<!-- get the highest target on this machine -->
|
||||
<!-- this stuff is also seriously stupid -->
|
||||
<exec executable="cmd" osfamily="windows" output="tmp/target.list.tmp">
|
||||
<arg line="/c android.bat list targets"/>
|
||||
</exec>
|
||||
<exec executable="android" osfamily="mac" output="tmp/target.list.tmp">
|
||||
<arg line="list targets"/>
|
||||
</exec>
|
||||
<replaceregexp file="tmp/target.list.tmp" match=".*id:\s([0-9]).*" replace="target=\1" flags="s" />
|
||||
<property file="tmp/target.list.tmp" />
|
||||
|
||||
<!-- var VERSION=read('VERSION').replace(/\r\n/,'').replace(/\n/,''); -->
|
||||
<copy file="VERSION" tofile="tmp/VERSION.tmp" overwrite="true" />
|
||||
<replaceregexp file="tmp/VERSION.tmp" match="^" replace="version=" />
|
||||
<replaceregexp file="tmp/VERSION.tmp" match="\r\n" replace="" />
|
||||
<property file="tmp/VERSION.tmp" />
|
||||
|
||||
<!-- clobber any existing example -->
|
||||
|
||||
<!-- create the project -->
|
||||
<exec executable="cmd" osfamily="windows">
|
||||
<arg line="/c android.bat create project --target ${target} --path ${project.path} --package ${package} --activity ${activity}"/>
|
||||
</exec>
|
||||
<exec executable="android" osfamily="mac">
|
||||
<arg line="create project --target ${target} --path ${project.path} --package ${package} --activity ${activity}"/>
|
||||
</exec>
|
||||
|
||||
<!-- update the framework dir -->
|
||||
<exec executable="cmd" osfamily="windows">
|
||||
<arg line="/c android.bat update project --target ${target} --path ${basedir}/framework"/>
|
||||
</exec>
|
||||
<exec executable="android" osfamily="mac">
|
||||
<arg line="update project --target ${target} --path ${basedir}/framework"/>
|
||||
</exec>
|
||||
|
||||
<!-- compile cordova.js and cordova.jar -->
|
||||
<!-- // if you see an error about "Unable to resolve target" then you may need to
|
||||
// update your android tools or install an additional Android platform version -->
|
||||
<ant antfile="${basedir}/framework/build.xml" useNativeBasedir="true" inheritAll="false" />
|
||||
|
||||
<!-- copy in the project template -->
|
||||
<copy todir="${project.path}" overwrite="true">
|
||||
<fileset dir="${basedir}/bin/templates/project"/>
|
||||
</copy>
|
||||
|
||||
<!-- copy in cordova.js -->
|
||||
<copy file="${basedir}/framework/assets/www/cordova-${version}.js" todir="${project.path}/assets/www/" />
|
||||
|
||||
<!-- copy in cordova.jar -->
|
||||
<copy file="${basedir}/framework/cordova-${version}.jar" todir="${project.path}/libs/" />
|
||||
|
||||
<!-- copy in default activity -->
|
||||
<copy file="${basedir}/bin/templates/Activity.java" tofile="${activity.path}" overwrite="true" />
|
||||
|
||||
<!-- interpolate the activity name and package -->
|
||||
<replaceregexp file="${activity.path}" match="__ACTIVITY__" replace="${activity}" />
|
||||
<replaceregexp file="${activity.path}" match="__ID__" replace="${package}" />
|
||||
|
||||
<replaceregexp file="${manifest.path}" match="__ACTIVITY__" replace="${activity}" />
|
||||
<replaceregexp file="${manifest.path}" match="__PACKAGE__" replace="${package}" />
|
||||
</target>
|
||||
</project>
|
||||
22
bin/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "cordova-android-cli",
|
||||
"description": "CLI tooling for the cordova-android project",
|
||||
"version": "0.0.1",
|
||||
"licenses": [{
|
||||
"type": "APL 2.0",
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
||||
}],
|
||||
"main" : "./create",
|
||||
"bin": {
|
||||
"create": "./create",
|
||||
"bench": "./bench",
|
||||
"autotest": "./autotest",
|
||||
"BOOM": "./BOOM",
|
||||
"test": "./test"
|
||||
},
|
||||
"homepage": "http://incubator.apache.org/cordova",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://git-wip-us.apache.org/repos/asf/incubator-cordova-android.git"
|
||||
}
|
||||
}
|
||||
BIN
bin/templates/cordova/ApplicationInfo/ApplicationInfo.class
Normal file
44
bin/templates/cordova/ApplicationInfo/ApplicationInfo.java
Normal file
@@ -0,0 +1,44 @@
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.xml.sax.SAXException;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ApplicationInfo {
|
||||
private static void parseAndroidManifest(String path) {
|
||||
// System.out.println(path);
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
Document dom;
|
||||
try {
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
dom = db.parse(path);
|
||||
|
||||
// getting package information
|
||||
Element manifest = dom.getDocumentElement();
|
||||
String pakkage = manifest.getAttribute("package");
|
||||
|
||||
// getting activity name
|
||||
String activity = ((Element)dom.getElementsByTagName("activity").item(0)).getAttribute("android:name");
|
||||
System.out.println(String.format("%s/.%s", pakkage, activity.replace(".", "")));
|
||||
} catch(ParserConfigurationException pce) {
|
||||
pce.printStackTrace();
|
||||
} catch(SAXException se) {
|
||||
se.printStackTrace();
|
||||
} catch(IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String path;
|
||||
if(args.length > 0) {
|
||||
path = args[0];
|
||||
} else {
|
||||
path = System.getProperty("user.dir") + "/../AndroidManifest.xml";
|
||||
}
|
||||
parseAndroidManifest(path);
|
||||
}
|
||||
}
|
||||
7
bin/templates/cordova/BOOM
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||
|
||||
bash $CORDOVA_PATH/cordova BOOM
|
||||
1
bin/templates/cordova/BOOM.bat
Normal file
@@ -0,0 +1 @@
|
||||
%~dp0\cordova.bat BOOM
|
||||
BIN
bin/templates/cordova/appinfo.jar
Normal file
7
bin/templates/cordova/clean
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||
|
||||
bash $CORDOVA_PATH/cordova clean
|
||||
1
bin/templates/cordova/clean.bat
Normal file
@@ -0,0 +1 @@
|
||||
%~dp0\cordova.bat clean
|
||||
85
bin/templates/cordova/cordova
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_PATH=$( cd "$( dirname "$0" )/.." && pwd )
|
||||
|
||||
function check_devices {
|
||||
local devices=`adb devices | awk '/List of devices attached/ { while(getline > 0) { print }}'`
|
||||
if [ -z "$devices" ] ; then
|
||||
echo "1"
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
||||
function emulate {
|
||||
declare -a avd_list=($(android list avd | grep "Name:" | cut -f 2 -d ":" | xargs))
|
||||
# we need to start adb-server
|
||||
adb start-server 1>/dev/null
|
||||
|
||||
# Do not launch an emulator if there is already one running or if a device is attached
|
||||
if [ $(check_devices) == 0 ] ; then
|
||||
echo "Device attached or emulator already running"
|
||||
return
|
||||
fi
|
||||
|
||||
local avd_id="1000" #FIXME: hopefully user does not have 1000 AVDs
|
||||
# User has no AVDs
|
||||
if [ ${#avd_list[@]} == 0 ]
|
||||
then
|
||||
echo "You don't have any Android Virtual Devices. Please create at least one AVD."
|
||||
echo "android"
|
||||
fi
|
||||
# User has only one AVD
|
||||
if [ ${#avd_list[@]} == 1 ]
|
||||
then
|
||||
emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[0]} 1> /dev/null 2>&1 &
|
||||
# User has more than 1 AVD
|
||||
elif [ ${#avd_list[@]} -gt 1 ]
|
||||
then
|
||||
while [ -z ${avd_list[$avd_id]} ]
|
||||
do
|
||||
echo "Choose from one of the following Android Virtual Devices [0 to $((${#avd_list[@]}-1))]:"
|
||||
for(( i = 0 ; i < ${#avd_list[@]} ; i++ ))
|
||||
do
|
||||
echo "$i) ${avd_list[$i]}"
|
||||
done
|
||||
echo -n "> "
|
||||
read avd_id
|
||||
done
|
||||
emulator -cpu-delay 0 -no-boot-anim -cache /tmp/cache -avd ${avd_list[$avd_id]} 1> /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function clean {
|
||||
ant clean
|
||||
}
|
||||
# has to be used independently and not in conjuction with other commands
|
||||
function log {
|
||||
adb logcat
|
||||
}
|
||||
|
||||
function debug {
|
||||
if [ $(check_devices) == 0 ] ; then
|
||||
ant debug install
|
||||
else
|
||||
ant debug
|
||||
echo "##################################################################"
|
||||
echo "# Plug in your device or launch an emulator with cordova/emulate #"
|
||||
echo "##################################################################"
|
||||
fi
|
||||
}
|
||||
|
||||
function launch {
|
||||
local launch_str=$(java -jar $PROJECT_PATH/cordova/appinfo.jar $PROJECT_PATH/AndroidManifest.xml)
|
||||
adb shell am start -n $launch_str
|
||||
}
|
||||
|
||||
function BOOM {
|
||||
clean && debug && launch
|
||||
}
|
||||
|
||||
# TODO parse arguments
|
||||
(cd $PROJECT_PATH && $1)
|
||||
15
bin/templates/cordova/cordova.bat
Normal file
@@ -0,0 +1,15 @@
|
||||
@ECHO OFF
|
||||
IF NOT DEFINED JAVA_HOME GOTO MISSING
|
||||
FOR %%X in (java.exe ant.bat android.bat) do (
|
||||
SET FOUND=%%~$PATH:X
|
||||
IF NOT DEFINED FOUND GOTO MISSING
|
||||
)
|
||||
cscript %~dp0\cordova.js %*
|
||||
GOTO END
|
||||
:MISSING
|
||||
ECHO Missing one of the following:
|
||||
ECHO JDK: http://java.oracle.com
|
||||
ECHO Android SDK: http://developer.android.com
|
||||
ECHO Apache ant: http://ant.apache.org
|
||||
EXIT /B 1
|
||||
:END
|
||||
104
bin/templates/cordova/cordova.js
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
var ROOT = WScript.ScriptFullName.split('\\cordova\\cordova.js').join(''),
|
||||
shell=WScript.CreateObject("WScript.Shell");
|
||||
|
||||
function exec(command) {
|
||||
var oExec=shell.Exec(command);
|
||||
var output = new String();
|
||||
while(oExec.Status == 0) {
|
||||
if(!oExec.StdOut.AtEndOfStream) {
|
||||
var line = oExec.StdOut.ReadLine();
|
||||
// XXX: Change to verbose mode
|
||||
// WScript.StdOut.WriteLine(line);
|
||||
output += line;
|
||||
}
|
||||
WScript.sleep(100);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function emulator_running() {
|
||||
var local_devices = shell.Exec("%comspec% /c adb devices").StdOut.ReadAll();
|
||||
if(local_devices.match(/emulator/)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function emulate() {
|
||||
// don't run emulator if a device is plugged in or if emulator is already running
|
||||
if(emulator_running()) {
|
||||
WScript.Echo("Device or Emulator already running!");
|
||||
return;
|
||||
}
|
||||
var oExec = shell.Exec("%comspec% /c android.bat list avd");
|
||||
var avd_list = [];
|
||||
var avd_id = -10;
|
||||
while(!oExec.StdOut.AtEndOfStream) {
|
||||
var output = oExec.StdOut.ReadLine();
|
||||
if(output.match(/Name: (.)*/)) {
|
||||
avd_list.push(output.replace(/ *Name:\s/, ""));
|
||||
}
|
||||
}
|
||||
// user has no AVDs
|
||||
if(avd_list.length == 0) {
|
||||
WScript.Echo("You don't have any Android Virtual Devices. Please create at least one AVD.");
|
||||
WScript.Echo("android");
|
||||
WScript.Quit(1);
|
||||
}
|
||||
// user has only one AVD so we launch that one
|
||||
if(avd_list.length == 1) {
|
||||
|
||||
shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\cache -avd "+avd_list[0]);
|
||||
}
|
||||
|
||||
// user has more than one avd so we ask them to choose
|
||||
if(avd_list.length > 1) {
|
||||
while(!avd_list[avd_id]) {
|
||||
WScript.Echo("Choose from one of the following Android Virtual Devices [0 to "+(avd_list.length - 1)+"]:")
|
||||
for(i = 0, j = avd_list.length ; i < j ; i++) {
|
||||
WScript.Echo((i)+") "+avd_list[i]);
|
||||
}
|
||||
WScript.StdOut.Write("> ");
|
||||
avd_id = new Number(WScript.StdIn.ReadLine());
|
||||
}
|
||||
|
||||
shell.Run("emulator -cpu-delay 0 -no-boot-anim -cache %Temp%\\cache -avd "+avd_list[avd_id], 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
function clean() {
|
||||
exec("%comspec% /c ant.bat clean -f "+ROOT+"\\build.xml 2>&1");
|
||||
}
|
||||
|
||||
function debug() {
|
||||
if(emulator_running()) {
|
||||
exec("%comspec% /c ant.bat debug install -f "+ROOT+"\\build.xml 2>&1");
|
||||
} else {
|
||||
exec("%comspec% /c ant.bat debug -f "+ROOT+"\\build.xml 2>&1");
|
||||
WScript.Echo("##################################################################");
|
||||
WScript.Echo("# Plug in your device or launch an emulator with cordova/emulate #");
|
||||
WScript.Echo("##################################################################");
|
||||
}
|
||||
}
|
||||
|
||||
function log() {
|
||||
shell.Run("%comspec% /c adb logcat");
|
||||
}
|
||||
|
||||
function launch() {
|
||||
var launch_str=exec("%comspec% /c java -jar "+ROOT+"\\cordova\\appinfo.jar "+ROOT+"\\AndroidManifest.xml");
|
||||
//WScript.Echo(launch_str);
|
||||
exec("%comspec% /c adb shell am start -n "+launch_str+" 2>&1");
|
||||
}
|
||||
|
||||
function BOOM() {
|
||||
clean();
|
||||
debug();
|
||||
launch();
|
||||
}
|
||||
var args = WScript.Arguments;
|
||||
if(args.count() != 1) {
|
||||
WScript.StdErr.Write("An error has occured!\n");
|
||||
WScript.Quit(1);
|
||||
}
|
||||
eval(args(0)+"()");
|
||||
7
bin/templates/cordova/debug
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||
|
||||
bash $CORDOVA_PATH/cordova debug
|
||||
1
bin/templates/cordova/debug.bat
Normal file
@@ -0,0 +1 @@
|
||||
%~dp0\cordova.bat debug
|
||||
7
bin/templates/cordova/emulate
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd )
|
||||
|
||||
bash $CORDOVA_PATH/cordova emulate
|
||||
1
bin/templates/cordova/emulate.bat
Normal file
@@ -0,0 +1 @@
|
||||
%~dp0\cordova.bat emulate
|
||||
7
bin/templates/cordova/log
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_PATH=$( cd "$( dirname "$0" )/.." && pwd )
|
||||
|
||||
bash $PROJECT_PATH/cordova/cordova log
|
||||
1
bin/templates/cordova/log.bat
Normal file
@@ -0,0 +1 @@
|
||||
%~dp0\cordova.bat log
|
||||
35
bin/templates/project/Activity.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
package __ID__;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class __ACTIVITY__ extends DroidGap
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl("file:///android_asset/www/index.html");
|
||||
}
|
||||
}
|
||||
|
||||
61
bin/templates/project/AndroidManifest.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
|
||||
package="__PACKAGE__" 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" />
|
||||
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:debuggable="true">
|
||||
<activity android:name="__ACTIVITY__" 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>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="5" />
|
||||
</manifest>
|
||||
60
bin/templates/project/assets/www/index.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>PhoneGap</title>
|
||||
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title">
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="main.js"></script>
|
||||
|
||||
</head>
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Welcome to Cordova!</h1>
|
||||
<h2>this file is located at assets/www/index.html</h2>
|
||||
<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>
|
||||
<dl id="accel-data">
|
||||
<dt>X:</dt><dd id="x"> </dd>
|
||||
<dt>Y:</dt><dd id="y"> </dd>
|
||||
<dt>Z:</dt><dd id="z"> </dd>
|
||||
</dl>
|
||||
<a href="#" class="btn large" onclick="toggleAccel();">Toggle Accelerometer</a>
|
||||
<a href="#" class="btn large" onclick="getLocation();">Get Location</a>
|
||||
<a href="tel:411" class="btn large">Call 411</a>
|
||||
<a href="#" class="btn large" onclick="beep();">Beep</a>
|
||||
<a href="#" class="btn large" onclick="vibrate();">Vibrate</a>
|
||||
<a href="#" class="btn large" onclick="show_pic();">Get a Picture</a>
|
||||
<a href="#" class="btn large" onclick="get_contacts();return false;">Get Phone's Contacts</a>
|
||||
<a href="#" class="btn large" onclick="check_network();return false;">Check Network</a>
|
||||
<dl>
|
||||
<dt>Compass Heading:</dt><dd id="h">Off</dd>
|
||||
</dl>
|
||||
<a href="#" class="btn large" onclick="toggleCompass();return false;">Toggle Compass</a>
|
||||
<div id="viewport" class="viewport" style="display: none;">
|
||||
<img style="width:60px;height:60px" id="test_img" src="" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
165
bin/templates/project/assets/www/main.js
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1,4 +1,24 @@
|
||||
body {
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
|
||||
body {
|
||||
background:#222 none repeat scroll 0 0;
|
||||
color:#666;
|
||||
font-family:Helvetica;
|
||||
BIN
bin/templates/project/res/drawable-hdpi/icon.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
bin/templates/project/res/drawable-ldpi/icon.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
bin/templates/project/res/drawable-mdpi/icon.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
bin/templates/project/res/drawable-xhdpi/icon.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
bin/templates/project/res/drawable/icon.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
135
bin/tests/test_create_unix.js
Normal file
@@ -0,0 +1,135 @@
|
||||
var build_path = __dirname + '/../..',
|
||||
project_path = '/tmp/example',
|
||||
package_name = 'org.apache.cordova.example',
|
||||
package_as_path = 'org/apache/cordova/example',
|
||||
project_name = 'cordovaExample';
|
||||
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
util = require('util'),
|
||||
assert = require('assert'),
|
||||
spawn = require('child_process').spawn;
|
||||
|
||||
var version = fs.readFileSync(build_path + '/VERSION').toString().replace('\n', '');
|
||||
|
||||
assert(version !== undefined);
|
||||
assert(version !== '');
|
||||
|
||||
var create_project = spawn(build_path + '/bin/create',
|
||||
[project_path,
|
||||
package_name,
|
||||
project_name]);
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log('Caught exception: ' + err);
|
||||
spawn('rm', ['-rf', project_path], function(code) {
|
||||
if(code != 0) {
|
||||
console.log("Could not delete project directory");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
create_project.on('exit', function(code) {
|
||||
|
||||
assert.equal(code, 0, 'Project did not get created');
|
||||
|
||||
// make sure the project was created
|
||||
path.exists(project_path, function(exists) {
|
||||
assert(exists, 'Project path does not exist');
|
||||
});
|
||||
|
||||
// make sure the build directory was cleaned up
|
||||
// path.exists(build_path + '/framework/libs', function(exists) {
|
||||
// assert(!exists, 'libs directory did not get cleaned up');
|
||||
// });
|
||||
path.exists(build_path + util.format('/framework/assets/cordova-%s.js', version), function(exists) {
|
||||
assert(!exists, 'javascript file did not get cleaned up');
|
||||
});
|
||||
path.exists(build_path + util.format('/framework/cordova-%s.jar', version), function(exists) {
|
||||
assert(!exists, 'jar file did not get cleaned up');
|
||||
});
|
||||
|
||||
// make sure AndroidManifest.xml was added
|
||||
path.exists(util.format('%s/AndroidManifest.xml', project_path), function(exists) {
|
||||
assert(exists, 'AndroidManifest.xml did not get created');
|
||||
// TODO check that the activity name was properly substituted
|
||||
});
|
||||
|
||||
// make sure main Activity was added
|
||||
path.exists(util.format('%s/src/%s/%s.java', project_path, package_as_path, project_name), function(exists) {
|
||||
assert(exists, 'Activity did not get created');
|
||||
// TODO check that package name and activity name were substitued properly
|
||||
});
|
||||
|
||||
// make sure plugins.xml was added
|
||||
path.exists(util.format('%s/res/xml/plugins.xml', project_path), function(exists) {
|
||||
assert(exists, 'plugins.xml did not get created');
|
||||
});
|
||||
|
||||
// make sure cordova.xml was added
|
||||
path.exists(util.format('%s/res/xml/cordova.xml', project_path), function(exists) {
|
||||
assert(exists, 'plugins.xml did not get created');
|
||||
});
|
||||
|
||||
// make sure cordova.jar was added
|
||||
path.exists(util.format('%s/libs/cordova-%s.jar', project_path, version), function(exists) {
|
||||
assert(exists, 'cordova.jar did not get added');
|
||||
});
|
||||
|
||||
// make sure cordova.js was added
|
||||
path.exists(util.format('%s/assets/www/cordova-%s.js', project_path, version), function(exists) {
|
||||
assert(exists, 'cordova.js did not get added');
|
||||
});
|
||||
|
||||
// make sure cordova master script was added
|
||||
path.exists(util.format('%s/cordova/cordova', project_path), function(exists) {
|
||||
assert(exists, 'cordova script did not get added');
|
||||
});
|
||||
|
||||
// make sure debug script was added
|
||||
path.exists(util.format('%s/cordova/debug', project_path), function(exists) {
|
||||
assert(exists, 'debug script did not get added');
|
||||
});
|
||||
|
||||
// make sure BOOM script was added
|
||||
path.exists(util.format('%s/cordova/BOOM', project_path), function(exists) {
|
||||
assert(exists, 'BOOM script did not get added');
|
||||
});
|
||||
|
||||
// make sure log script was added
|
||||
path.exists(util.format('%s/cordova/log', project_path), function(exists) {
|
||||
assert(exists, 'log script did not get added');
|
||||
});
|
||||
|
||||
// make sure clean script was added
|
||||
path.exists(util.format('%s/cordova/clean', project_path), function(exists) {
|
||||
assert(exists, 'clean script did not get added');
|
||||
});
|
||||
|
||||
// make sure emulate script was added
|
||||
path.exists(util.format('%s/cordova/emulate', project_path), function(exists) {
|
||||
assert(exists, 'emulate script did not get added');
|
||||
});
|
||||
|
||||
// make sure appinfo.jar script was added
|
||||
path.exists(util.format('%s/cordova/appinfo.jar', project_path), function(exists) {
|
||||
assert(exists, 'appinfo.jar script did not get added');
|
||||
});
|
||||
|
||||
// check that project compiles && creates a cordovaExample-debug.apk
|
||||
var compile_project = spawn('ant', ['debug'], {cwd: project_path});
|
||||
|
||||
compile_project.on('exit', function(code) {
|
||||
assert.equal(code, 0, 'Cordova Android Project does not compile');
|
||||
// make sure cordovaExample-debug.apk was created
|
||||
path.exists(util.format('%s/bin/%s-debug.apk', project_path, project_name), function(exists) {
|
||||
assert(exists, 'Package did not get created');
|
||||
|
||||
// if project compiles properly just AXE it
|
||||
spawn('rm', ['-rf', project_path], function(code) {
|
||||
assert.equal(code, 0, 'Could not remove project directory');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
143
bin/tests/test_create_win.js
Normal file
@@ -0,0 +1,143 @@
|
||||
var build_path = __dirname + '/../..'
|
||||
project_path = process.env.Temp + '\\example',
|
||||
package_name = 'org.apache.cordova.example',
|
||||
package_as_path = 'org/apache/cordova/example',
|
||||
project_name = 'cordovaExample';
|
||||
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
util = require('util'),
|
||||
assert = require('assert'),
|
||||
exec = require('child_process').exec,
|
||||
spawn = require('child_process').spawn;
|
||||
|
||||
var version = fs.readFileSync(build_path + '/VERSION').toString().replace('\r\n', '');
|
||||
|
||||
assert(version !== undefined);
|
||||
assert(version !== '');
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log('Caught exception: ' + err);
|
||||
exec('rd /s /q ' + project_path);
|
||||
});
|
||||
|
||||
var create_project = spawn('cscript',
|
||||
[build_path + '/bin/create.js',
|
||||
project_path,
|
||||
package_name,
|
||||
project_name]
|
||||
);
|
||||
|
||||
create_project.stderr.on('data', function (data) {
|
||||
console.log('ps stderr: ' + data);
|
||||
});
|
||||
|
||||
create_project.stderr.on('data', function(data) {
|
||||
console.log(data.toString());
|
||||
});
|
||||
|
||||
create_project.stdout.on('data', function(data) {
|
||||
console.log(data.toString());
|
||||
});
|
||||
|
||||
create_project.on('exit', function(code) {
|
||||
assert.equal(code, 0, 'Project did not get created');
|
||||
|
||||
// make sure the project was created
|
||||
path.exists(project_path, function(exists) {
|
||||
assert(exists, 'Project path does not exist');
|
||||
});
|
||||
|
||||
// make sure the build directory was cleaned up
|
||||
// path.exists(build_path + '/framework/libs', function(exists) {
|
||||
// assert(!exists, 'libs directory did not get cleaned up');
|
||||
// });
|
||||
path.exists(build_path + util.format('/framework/assets/cordova-%s.js', version), function(exists) {
|
||||
assert(!exists, 'javascript file did not get cleaned up');
|
||||
});
|
||||
path.exists(build_path + util.format('/framework/cordova-%s.jar', version), function(exists) {
|
||||
assert(!exists, 'jar file did not get cleaned up');
|
||||
});
|
||||
|
||||
// make sure AndroidManifest.xml was added
|
||||
path.exists(util.format('%s/AndroidManifest.xml', project_path), function(exists) {
|
||||
assert(exists, 'AndroidManifest.xml did not get created');
|
||||
// TODO check that the activity name was properly substituted
|
||||
});
|
||||
|
||||
// make sure main Activity was added
|
||||
path.exists(util.format('%s/src/%s/%s.java', project_path, package_as_path, project_name), function(exists) {
|
||||
assert(exists, 'Activity did not get created');
|
||||
// TODO check that package name and activity name were substitued properly
|
||||
});
|
||||
|
||||
// make sure plugins.xml was added
|
||||
path.exists(util.format('%s/res/xml/plugins.xml', project_path), function(exists) {
|
||||
assert(exists, 'plugins.xml did not get created');
|
||||
});
|
||||
|
||||
// make sure cordova.xml was added
|
||||
path.exists(util.format('%s/res/xml/cordova.xml', project_path), function(exists) {
|
||||
assert(exists, 'plugins.xml did not get created');
|
||||
});
|
||||
|
||||
// make sure cordova.jar was added
|
||||
path.exists(util.format('%s/libs/cordova-%s.jar', project_path, version), function(exists) {
|
||||
assert(exists, 'cordova.jar did not get added');
|
||||
});
|
||||
|
||||
// make sure cordova.js was added
|
||||
path.exists(util.format('%s/assets/www/cordova-%s.js', project_path, version), function(exists) {
|
||||
assert(exists, 'cordova.js did not get added');
|
||||
});
|
||||
|
||||
// make sure cordova master script was added
|
||||
path.exists(util.format('%s/cordova/cordova.bat', project_path), function(exists) {
|
||||
assert(exists, 'cordova script did not get added');
|
||||
});
|
||||
|
||||
// make sure debug script was added
|
||||
path.exists(util.format('%s/cordova/debug.bat', project_path), function(exists) {
|
||||
assert(exists, 'debug script did not get added');
|
||||
});
|
||||
|
||||
// make sure BOOM script was added
|
||||
path.exists(util.format('%s/cordova/BOOM.bat', project_path), function(exists) {
|
||||
assert(exists, 'BOOM script did not get added');
|
||||
});
|
||||
|
||||
// make sure log script was added
|
||||
path.exists(util.format('%s/cordova/log.bat', project_path), function(exists) {
|
||||
assert(exists, 'log script did not get added');
|
||||
});
|
||||
|
||||
// make sure clean script was added
|
||||
path.exists(util.format('%s/cordova/clean.bat', project_path), function(exists) {
|
||||
assert(exists, 'clean script did not get added');
|
||||
});
|
||||
|
||||
// make sure emulate script was added
|
||||
path.exists(util.format('%s/cordova/emulate.bat', project_path), function(exists) {
|
||||
assert(exists, 'emulate script did not get added');
|
||||
});
|
||||
|
||||
// make sure appinfo.jar script was added
|
||||
path.exists(util.format('%s/cordova/appinfo.jar', project_path), function(exists) {
|
||||
assert(exists, 'appinfo.jar script did not get added');
|
||||
});
|
||||
|
||||
// check that project compiles && creates a cordovaExample-debug.apk
|
||||
// XXX: !@##!@# WINDOWS
|
||||
exec('ant debug -f ' + project_path + "\\build.xml", function(error, stdout, stderr) {
|
||||
assert(error == null, "Cordova Android Project does not compile");
|
||||
path.exists(util.format('%s/bin/%s-debug.apk', project_path, project_name),
|
||||
function(exists) {
|
||||
assert(exists, 'Package did not get created');
|
||||
// if project compiles properly just AXE it
|
||||
exec('rd /s /q ' + project_path);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
179
droidgap
@@ -1,179 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
require 'fileutils'
|
||||
|
||||
# ./droidgap /Users/brianleroux/Code/android-sdk-mac MyApp com.westcoastlogic example /Users/brianleroux/Desktop/MyApp
|
||||
class Build
|
||||
attr_reader :android_sdk_path, :name, :pkg, :www, :path
|
||||
|
||||
def initialize(*a)
|
||||
@android_sdk_path, @name, @pkg, @www, @path = a
|
||||
@android_dir = File.expand_path(File.dirname(__FILE__))
|
||||
@framework_dir = File.join(@android_dir, "framework")
|
||||
end
|
||||
|
||||
# runs the build script
|
||||
def run
|
||||
build_jar
|
||||
create_android
|
||||
include_www
|
||||
generate_manifest
|
||||
copy_libs
|
||||
add_name_to_strings
|
||||
write_java
|
||||
puts "Complete!"
|
||||
end
|
||||
|
||||
# removes local.properties and recreates based on android_sdk_path
|
||||
# then generates framework/phonegap.jar
|
||||
def build_jar
|
||||
puts "Building the JAR..."
|
||||
%w(local.properties phonegap.js phonegap.jar).each do |f|
|
||||
FileUtils.rm File.join(@framework_dir, f) if File.exists? File.join(@framework_dir, f)
|
||||
end
|
||||
open(File.join(@framework_dir, "local.properties"), 'w') do |f|
|
||||
f.puts "sdk.dir=#{ @android_sdk_path }"
|
||||
end
|
||||
Dir.chdir(@framework_dir)
|
||||
`ant jar`
|
||||
Dir.chdir(@android_dir)
|
||||
end
|
||||
|
||||
# runs android create project
|
||||
# TODO need to allow more flexible SDK targetting
|
||||
# TODO validate Android SDK
|
||||
# TODO fix 'android' shell call so that it works on Windows. Can't prepend android command with path to it.
|
||||
def create_android
|
||||
android_exec = File.join(@android_sdk_path, "tools", "android");
|
||||
target_id = 5
|
||||
puts "Creating Android project for target level #{ target_id }"
|
||||
`android create project -t #{ target_id } -k #{ @pkg } -a #{ @name } -n #{ @name } -p #{ @path }`
|
||||
end
|
||||
|
||||
def include_www
|
||||
puts "Adding www folder to project..."
|
||||
|
||||
FileUtils.mkdir_p File.join(@path, "assets", "www")
|
||||
FileUtils.cp_r File.join(@www, "."), File.join(@path, "assets", "www")
|
||||
end
|
||||
|
||||
# creates an AndroidManifest.xml for the project
|
||||
def generate_manifest
|
||||
puts "Generating manifest..."
|
||||
manifest = ""
|
||||
open(File.join(@framework_dir, "AndroidManifest.xml"), 'r') do |old|
|
||||
manifest = old.read
|
||||
manifest.gsub! 'android:versionCode="5"', 'android:versionCode="1"'
|
||||
manifest.gsub! 'package="com.phonegap"', "package=\"#{ @pkg }\""
|
||||
manifest.gsub! 'android:name=".StandAlone"', "android:name=\".#{ @name }\""
|
||||
manifest.gsub! 'android:minSdkVersion="5"', 'android:minSdkVersion="3"'
|
||||
end
|
||||
open(File.join(@path, "AndroidManifest.xml"), 'w') { |x| x.puts manifest }
|
||||
end
|
||||
|
||||
# copies stuff from framework into the project
|
||||
# TODO need to allow for www import inc icon
|
||||
def copy_libs
|
||||
puts "Copying over libraries and assets and creating phonegap.js..."
|
||||
|
||||
framework_res_dir = File.join(@framework_dir, "res")
|
||||
app_res_dir = File.join(@path, "res")
|
||||
|
||||
FileUtils.mkdir_p File.join(@path, "libs")
|
||||
FileUtils.cp File.join(@framework_dir, "phonegap.jar"), File.join(@path, "libs")
|
||||
|
||||
FileUtils.mkdir_p File.join(app_res_dir, "values")
|
||||
FileUtils.cp File.join(framework_res_dir, "values","strings.xml"), File.join(app_res_dir, "values", "strings.xml")
|
||||
|
||||
FileUtils.mkdir_p File.join(app_res_dir, "layout")
|
||||
%w(main.xml preview.xml).each do |f|
|
||||
FileUtils.cp File.join(framework_res_dir, "layout", f), File.join(app_res_dir, "layout", f)
|
||||
end
|
||||
|
||||
%w(drawable-hdpi drawable-ldpi drawable-mdpi).each do |e|
|
||||
FileUtils.mkdir_p File.join(app_res_dir, e)
|
||||
FileUtils.cp File.join(framework_res_dir, "drawable", "icon.png"), File.join(app_res_dir, e, "icon.png")
|
||||
end
|
||||
|
||||
# concat JS and put into www folder.
|
||||
js_dir = File.join(@framework_dir, "assets", "js")
|
||||
|
||||
phonegapjs = IO.read(File.join(js_dir, 'phonegap.js.base'))
|
||||
|
||||
Dir.new(js_dir).entries.each do |script|
|
||||
next if script[0].chr == "." or script == "phonegap.js.base"
|
||||
phonegapjs << IO.read(File.join(js_dir, script))
|
||||
phonegapjs << "\n\n"
|
||||
end
|
||||
|
||||
File.open(File.join(@path, "assets", "www", "phonegap.js"), 'w') {|f| f.write(phonegapjs) }
|
||||
end
|
||||
|
||||
# puts app name in strings
|
||||
def add_name_to_strings
|
||||
puts "Adding some application name to strings.xml..."
|
||||
x = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
||||
<resources>
|
||||
<string name=\"app_name\">#{ @name }</string>
|
||||
<string name=\"go\">Snap</string>
|
||||
</resources>
|
||||
"
|
||||
open(File.join(@path, "res", "values", "strings.xml"), 'w') do |f|
|
||||
f.puts x.gsub(' ','')
|
||||
end
|
||||
end
|
||||
|
||||
# this is so fucking unholy yet oddly beautiful
|
||||
# not sure if I should thank Ruby or apologize for this abusive use of string interpolation
|
||||
def write_java
|
||||
puts "Writing application Java code..."
|
||||
j = "
|
||||
package #{ @pkg };
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import com.phonegap.*;
|
||||
|
||||
public class #{ @name } extends DroidGap
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
super.loadUrl(\"file:///android_asset/www/index.html\");
|
||||
}
|
||||
}
|
||||
"
|
||||
|
||||
code_dir = File.join(@path, "src", @pkg.gsub('.', File::SEPARATOR))
|
||||
|
||||
FileUtils.mkdir_p(code_dir)
|
||||
open(File.join(code_dir, "#{@name}.java"),'w') { |f| f.puts j.gsub(' ','') }
|
||||
end
|
||||
#
|
||||
end
|
||||
|
||||
|
||||
if ARGV.length == 5
|
||||
Build.new(*ARGV).run
|
||||
else
|
||||
puts <<-EOF
|
||||
|
||||
DroidGap: PhoneGap/Android Project Generator
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Creates a fresh app for hybrid mobile web hacking. Delicious robot!
|
||||
|
||||
Usage:
|
||||
|
||||
./droidgap <android_sdk_path> <name> <package_name> <www> <path>
|
||||
|
||||
Params:
|
||||
|
||||
android_sdk_path ... The path to your Android SDK install.
|
||||
name ............... The name of your application.
|
||||
package_name ....... The name of your package (For example: com.nitobi.demo)
|
||||
www ................ The path to your www folder. (Wherein your HTML, CSS and JS app is.)
|
||||
path ............... The path to generate the Android application.
|
||||
|
||||
EOF
|
||||
end
|
||||
@@ -1,147 +0,0 @@
|
||||
<!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>PhoneGap</title>
|
||||
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
var deviceInfo = function(){
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
console.log("Height:" + window.innerHeight);
|
||||
console.log("Width:" + window.innerWidth);
|
||||
}
|
||||
|
||||
var getLocation = function() {
|
||||
var suc = function(p){
|
||||
alert(p.coords.latitude + " " + p.coords.longitude);
|
||||
};
|
||||
var fail = function(){};
|
||||
navigator.geolocation.getCurrentPosition(suc,fail);
|
||||
}
|
||||
|
||||
var beep = function(){
|
||||
navigator.notification.beep(2);
|
||||
}
|
||||
|
||||
var vibrate = function(){
|
||||
navigator.notification.vibrate(0);
|
||||
}
|
||||
|
||||
var getContact = function(){
|
||||
var suc = function(c){ alert("Contact 4: " + c.contacts[3].name); };
|
||||
var fail = function(){};
|
||||
navigator.ContactManager.get(suc, fail);
|
||||
}
|
||||
|
||||
var watchAccel = function() {
|
||||
var suc = function(a){
|
||||
document.getElementById('x').innerHTML = roundNumber(a.x);
|
||||
document.getElementById('y').innerHTML = roundNumber(a.y);
|
||||
document.getElementById('z').innerHTML = roundNumber(a.z);
|
||||
};
|
||||
var fail = function(){};
|
||||
var opt = {};
|
||||
opt.frequency = 100;
|
||||
timer = navigator.accelerometer.watchAcceleration(suc,fail,opt);
|
||||
}
|
||||
|
||||
function roundNumber(num) {
|
||||
var dec = 3;
|
||||
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
|
||||
return result;
|
||||
}
|
||||
|
||||
var preventBehavior = function(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
function show_pic()
|
||||
{
|
||||
var viewport = document.getElementById('viewport');
|
||||
viewport.style.display = "";
|
||||
navigator.camera.getPicture(dump_pic, fail, { quality: 50 });
|
||||
}
|
||||
|
||||
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 close()
|
||||
{
|
||||
var viewport = document.getElementById('viewport');
|
||||
viewport.style.position = "relative";
|
||||
viewport.style.display = "none";
|
||||
}
|
||||
|
||||
function fail(fail)
|
||||
{
|
||||
alert(fail);
|
||||
}
|
||||
|
||||
// This is just to do this.
|
||||
function readFile()
|
||||
{
|
||||
navigator.file.read('/sdcard/phonegap.txt', fail , fail);
|
||||
}
|
||||
|
||||
function writeFile()
|
||||
{
|
||||
navigator.file.write('foo.txt', "This is a test of writing to a file", fail, fail);
|
||||
}
|
||||
|
||||
function get_contacts()
|
||||
{
|
||||
navigator.ContactManager.getAllContacts(count_contacts, fail, null);
|
||||
}
|
||||
|
||||
function count_contacts(contacts)
|
||||
{
|
||||
alert(contacts.length);
|
||||
}
|
||||
|
||||
function init(){
|
||||
document.addEventListener("touchmove", preventBehavior, false);
|
||||
document.addEventListener("deviceReady", deviceInfo, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Welcome to PhoneGap!</h1>
|
||||
<h2>this file is located at assets/index.html</h2>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span></h4>
|
||||
<h4>Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span></h4>
|
||||
</div>
|
||||
<dl id="accel-data">
|
||||
<dt>X:</dt><dd id="x"> </dd>
|
||||
<dt>Y:</dt><dd id="y"> </dd>
|
||||
<dt>Z:</dt><dd id="z"> </dd>
|
||||
</dl>
|
||||
<a href="#" class="btn large" onclick="watchAccel();">Watch Accelerometer</a>
|
||||
<a href="#" class="btn large" onclick="getLocation();">Get Location</a>
|
||||
<a href="tel://411" class="btn large">Call 411</a>
|
||||
<a href="#" class="btn large" onclick="beep();">Beep</a>
|
||||
<a href="#" class="btn large" onclick="vibrate();">Vibrate</a>
|
||||
<a href="#" class="btn large" onclick="show_pic();">Get a Picture</a>
|
||||
<a href="#" class="btn large" onclick="get_contacts();">Get phone's contacts</a>
|
||||
<div id="viewport" class="viewport" style="display: none;">
|
||||
<img style="width:60px;height:60px" id="test_img" src="" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1188
example/phonegap.js
@@ -3,6 +3,6 @@
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="lib" path="libs/commons-codec-1.3.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry kind="lib" path="libs/commons-codec-1.6.jar"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>PhoneGap</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>
|
||||
<name>Cordova</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>
|
||||
|
||||
65
framework/AndroidManifest.xml
Normal file → Executable file
@@ -1,43 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.phonegap" android:versionName="1.1" android:versionCode="5">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
|
||||
package="org.apache.cordova" android:versionName="1.1" android:versionCode="5">
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:resizeable="true"
|
||||
android:anyDensity="true"
|
||||
/>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:resizeable="true"
|
||||
android:anyDensity="true"
|
||||
/>
|
||||
<!-- android:xlargeScreens="true" screen supported only after Android-9 -->
|
||||
|
||||
<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.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<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.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=".StandAlone"
|
||||
android:debuggable="true">
|
||||
<activity android:name=".StandAlone" android:windowSoftInputMode="adjustPan"
|
||||
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="com.phonegap.CameraPreview"
|
||||
android:label="@string/app_name" android:screenOrientation="landscape"
|
||||
<activity android:name="org.apache.cordova.DroidGap" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<action android:name="android.intent.action.PICK" />
|
||||
<intent-filter>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="2" />
|
||||
|
||||
</manifest>
|
||||
<uses-sdk android:minSdkVersion="2" />
|
||||
</manifest>
|
||||
|
||||
34
framework/ant.properties
Normal file
@@ -0,0 +1,34 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked in Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
function Acceleration(x, y, z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.timestamp = new Date().getTime();
|
||||
this.win = null;
|
||||
this.fail = null;
|
||||
}
|
||||
|
||||
var accelListeners = [];
|
||||
|
||||
/**
|
||||
* This class provides access to device accelerometer data.
|
||||
* @constructor
|
||||
*/
|
||||
function Accelerometer() {
|
||||
/**
|
||||
* The last known acceleration.
|
||||
*/
|
||||
this.lastAcceleration = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asynchronously aquires the current acceleration.
|
||||
* @param {Function} successCallback The function to call when the acceleration
|
||||
* data is available
|
||||
* @param {Function} errorCallback The function to call when there is an error
|
||||
* getting the acceleration data.
|
||||
* @param {AccelerationOptions} options The options for getting the accelerometer data
|
||||
* such as timeout.
|
||||
*/
|
||||
Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) {
|
||||
// If the acceleration is available then call success
|
||||
// If the acceleration is not available then call error
|
||||
|
||||
// Created for iPhone, Iphone passes back _accel obj litteral
|
||||
if (typeof successCallback == "function") {
|
||||
if(this.lastAcceleration)
|
||||
successCallback(accel);
|
||||
else
|
||||
{
|
||||
watchAcceleration(this.gotCurrentAcceleration, this.fail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Accelerometer.prototype.gotAccel = function(key, x, y, z)
|
||||
{
|
||||
console.log('we won');
|
||||
var a = new Acceleration(x,y,z);
|
||||
a.x = x;
|
||||
a.y = y;
|
||||
a.x = z;
|
||||
a.win = accelListeners[key].win;
|
||||
a.fail = accelListeners[key].fail;
|
||||
this.timestamp = new Date().getTime();
|
||||
this.lastAcceleration = a;
|
||||
accelListeners[key] = a;
|
||||
if (typeof a.win == "function") {
|
||||
a.win(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Asynchronously aquires the acceleration repeatedly at a given interval.
|
||||
* @param {Function} successCallback The function to call each time the acceleration
|
||||
* data is available
|
||||
* @param {Function} errorCallback The function to call when there is an error
|
||||
* getting the acceleration data.
|
||||
* @param {AccelerationOptions} options The options for getting the accelerometer data
|
||||
* such as timeout.
|
||||
*/
|
||||
|
||||
Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) {
|
||||
// TODO: add the interval id to a list so we can clear all watches
|
||||
var frequency = (options != undefined)? options.frequency : 10000;
|
||||
var accel = Acceleration(0,0,0);
|
||||
accel.win = successCallback;
|
||||
accel.fail = errorCallback;
|
||||
accel.opts = options;
|
||||
var key = accelListeners.push( accel ) - 1;
|
||||
Accel.start(frequency, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the specified accelerometer watch.
|
||||
* @param {String} watchId The ID of the watch returned from #watchAcceleration.
|
||||
*/
|
||||
Accelerometer.prototype.clearWatch = function(watchId) {
|
||||
Accel.stop(watchId);
|
||||
}
|
||||
|
||||
Accelerometer.prototype.epicFail = function(watchId, message) {
|
||||
accelWatcher[key].fail();
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer();
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* This class provides access to the device camera.
|
||||
* @constructor
|
||||
*/
|
||||
function Camera() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Function} successCallback
|
||||
* @param {Function} errorCallback
|
||||
* @param {Object} options
|
||||
*/
|
||||
Camera.prototype.getPicture = function(successCallback, errorCallback, options) {
|
||||
|
||||
this.winCallback = successCallback;
|
||||
this.failCallback = errorCallback;
|
||||
if (options.quality)
|
||||
{
|
||||
GapCam.takePicture(options.quality);
|
||||
}
|
||||
else
|
||||
{
|
||||
GapCam.takePicture(80);
|
||||
}
|
||||
}
|
||||
|
||||
Camera.prototype.win = function(picture)
|
||||
{
|
||||
this.winCallback(picture);
|
||||
}
|
||||
|
||||
Camera.prototype.fail = function(err)
|
||||
{
|
||||
this.failCallback(err);
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof navigator.camera == "undefined") navigator.camera = new Camera();
|
||||
});
|
||||
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* This class provides access to device Compass data.
|
||||
* @constructor
|
||||
*/
|
||||
function Compass() {
|
||||
/**
|
||||
* The last known Compass position.
|
||||
*/
|
||||
this.lastHeading = null;
|
||||
this.lastError = null;
|
||||
this.callbacks = {
|
||||
onHeadingChanged: [],
|
||||
onError: []
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously aquires the current heading.
|
||||
* @param {Function} successCallback The function to call when the heading
|
||||
* data is available
|
||||
* @param {Function} errorCallback The function to call when there is an error
|
||||
* getting the heading data.
|
||||
* @param {PositionOptions} options The options for getting the heading data
|
||||
* such as timeout.
|
||||
*/
|
||||
Compass.prototype.getCurrentHeading = function(successCallback, errorCallback, options) {
|
||||
if (this.lastHeading == null) {
|
||||
this.start(options);
|
||||
}
|
||||
else
|
||||
if (typeof successCallback == "function") {
|
||||
successCallback(this.lastHeading);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously aquires the heading repeatedly at a given interval.
|
||||
* @param {Function} successCallback The function to call each time the heading
|
||||
* data is available
|
||||
* @param {Function} errorCallback The function to call when there is an error
|
||||
* getting the heading data.
|
||||
* @param {HeadingOptions} options The options for getting the heading data
|
||||
* such as timeout and the frequency of the watch.
|
||||
*/
|
||||
Compass.prototype.watchHeading= function(successCallback, errorCallback, options) {
|
||||
// Invoke the appropriate callback with a new Position object every time the implementation
|
||||
// determines that the position of the hosting device has changed.
|
||||
|
||||
this.getCurrentHeading(successCallback, errorCallback, options);
|
||||
var frequency = 100;
|
||||
if (typeof(options) == 'object' && options.frequency)
|
||||
frequency = options.frequency;
|
||||
|
||||
var self = this;
|
||||
return setInterval(function() {
|
||||
self.getCurrentHeading(successCallback, errorCallback, options);
|
||||
}, frequency);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clears the specified heading watch.
|
||||
* @param {String} watchId The ID of the watch returned from #watchHeading.
|
||||
*/
|
||||
Compass.prototype.clearWatch = function(watchId) {
|
||||
clearInterval(watchId);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Called by the geolocation framework when the current heading is found.
|
||||
* @param {HeadingOptions} position The current heading.
|
||||
*/
|
||||
Compass.prototype.setHeading = function(heading) {
|
||||
this.lastHeading = heading;
|
||||
for (var i = 0; i < this.callbacks.onHeadingChanged.length; i++) {
|
||||
var f = this.callbacks.onHeadingChanged.shift();
|
||||
f(heading);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Called by the geolocation framework when an error occurs while looking up the current position.
|
||||
* @param {String} message The text of the error message.
|
||||
*/
|
||||
Compass.prototype.setError = function(message) {
|
||||
this.lastError = message;
|
||||
for (var i = 0; i < this.callbacks.onError.length; i++) {
|
||||
var f = this.callbacks.onError.shift();
|
||||
f(message);
|
||||
}
|
||||
};
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof navigator.compass == "undefined") navigator.compass = new Compass();
|
||||
});
|
||||
@@ -1,81 +0,0 @@
|
||||
var Contact = function(){
|
||||
this.name = new ContactName();
|
||||
this.emails = [];
|
||||
this.phones = [];
|
||||
}
|
||||
|
||||
var ContactName = function()
|
||||
{
|
||||
this.formatted = "";
|
||||
this.familyName = "";
|
||||
this.givenName = "";
|
||||
this.additionalNames = [];
|
||||
this.prefixes = [];
|
||||
this.suffixes = [];
|
||||
}
|
||||
|
||||
|
||||
var ContactEmail = function()
|
||||
{
|
||||
this.types = [];
|
||||
this.address = "";
|
||||
}
|
||||
|
||||
var ContactPhoneNumber = function()
|
||||
{
|
||||
this.types = [];
|
||||
this.number = "";
|
||||
}
|
||||
|
||||
|
||||
var Contacts = function()
|
||||
{
|
||||
this.records = [];
|
||||
}
|
||||
|
||||
Contacts.prototype.find = function(obj, win, fail)
|
||||
{
|
||||
if(obj.name != null)
|
||||
{
|
||||
// Build up the search term that we'll use in SQL, based on the structure/contents of the contact object passed into find.
|
||||
var searchTerm = '';
|
||||
if (obj.name.givenName && obj.name.givenName.length > 0) {
|
||||
searchTerm = obj.name.givenName.split(' ').join('%');
|
||||
}
|
||||
if (obj.name.familyName && obj.name.familyName.length > 0) {
|
||||
searchTerm += obj.name.familyName.split(' ').join('%');
|
||||
}
|
||||
if (!obj.name.familyName && !obj.name.givenName && obj.name.formatted) {
|
||||
searchTerm = obj.name.formatted;
|
||||
}
|
||||
ContactHook.search(searchTerm, "", "");
|
||||
}
|
||||
this.win = win;
|
||||
this.fail = fail;
|
||||
}
|
||||
|
||||
Contacts.prototype.droidFoundContact = function(name, npa, email)
|
||||
{
|
||||
var contact = new Contact();
|
||||
contact.name = new ContactName();
|
||||
contact.name.formatted = name;
|
||||
contact.name.givenName = name;
|
||||
var mail = new ContactEmail();
|
||||
mail.types.push("home");
|
||||
mail.address = email;
|
||||
contact.emails.push(mail);
|
||||
phone = new ContactPhoneNumber();
|
||||
phone.types.push("home");
|
||||
phone.number = npa;
|
||||
contact.phones.push(phone);
|
||||
this.records.push(contact);
|
||||
}
|
||||
|
||||
Contacts.prototype.droidDone = function()
|
||||
{
|
||||
this.win(this.records);
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if(typeof navigator.contacts == "undefined") navigator.contacts = new Contacts();
|
||||
});
|
||||
5758
framework/assets/js/cordova.android.js
Normal file
@@ -1,33 +0,0 @@
|
||||
var Crypto = function()
|
||||
{
|
||||
}
|
||||
|
||||
Crypto.prototype.encrypt = function(seed, string, callback)
|
||||
{
|
||||
GapCrypto.encrypt(seed, string);
|
||||
this.encryptWin = callback;
|
||||
}
|
||||
|
||||
Crypto.prototype.decrypt = function(seed, string, callback)
|
||||
{
|
||||
GapCrypto.decrypt(seed, string);
|
||||
this.decryptWin = callback;
|
||||
}
|
||||
|
||||
Crypto.prototype.gotCryptedString = function(string)
|
||||
{
|
||||
this.encryptWin(string);
|
||||
}
|
||||
|
||||
Crypto.prototype.getPlainString = function(string)
|
||||
{
|
||||
this.decryptWin(string);
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof navigator.Crypto == "undefined")
|
||||
{
|
||||
navigator.Crypto = new Crypto();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
|
||||
* phone, etc.
|
||||
* @constructor
|
||||
*/
|
||||
function Device() {
|
||||
this.available = PhoneGap.available;
|
||||
this.platform = null;
|
||||
this.version = null;
|
||||
this.name = null;
|
||||
this.gap = null;
|
||||
this.uuid = null;
|
||||
try {
|
||||
if (window.DroidGap) {
|
||||
this.available = true;
|
||||
this.uuid = window.DroidGap.getUuid();
|
||||
this.version = window.DroidGap.getOSVersion();
|
||||
this.gapVersion = window.DroidGap.getVersion();
|
||||
this.platform = window.DroidGap.getPlatform();
|
||||
this.name = window.DroidGap.getProductName();
|
||||
this.line1Number = window.DroidGap.getLine1Number();
|
||||
this.deviceId = window.DroidGap.getDeviceId();
|
||||
this.simSerialNumber = window.DroidGap.getSimSerialNumber();
|
||||
this.subscriberId = window.DroidGap.getSubscriberId();
|
||||
}
|
||||
} catch(e) {
|
||||
this.available = false;
|
||||
}
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
navigator.device = window.device = new Device();
|
||||
});
|
||||
@@ -1,226 +0,0 @@
|
||||
|
||||
|
||||
|
||||
PhoneGap.addConstructor(function() { if (typeof navigator.fileMgr == "undefined") navigator.fileMgr = new FileMgr();});
|
||||
|
||||
|
||||
/**
|
||||
* This class provides iPhone read and write access to the mobile device file system.
|
||||
* Based loosely on http://www.w3.org/TR/2009/WD-FileAPI-20091117/#dfn-empty
|
||||
*/
|
||||
function FileMgr()
|
||||
{
|
||||
this.fileWriters = {}; // empty maps
|
||||
this.fileReaders = {};
|
||||
|
||||
this.docsFolderPath = "../../Documents";
|
||||
this.tempFolderPath = "../../tmp";
|
||||
this.freeDiskSpace = -1;
|
||||
this.getFileBasePaths();
|
||||
}
|
||||
|
||||
// private, called from Native Code
|
||||
FileMgr.prototype._setPaths = function(docs,temp)
|
||||
{
|
||||
this.docsFolderPath = docs;
|
||||
this.tempFolderPath = temp;
|
||||
}
|
||||
|
||||
// private, called from Native Code
|
||||
FileMgr.prototype._setFreeDiskSpace = function(val)
|
||||
{
|
||||
this.freeDiskSpace = val;
|
||||
}
|
||||
|
||||
|
||||
// FileWriters add/remove
|
||||
// called internally by writers
|
||||
FileMgr.prototype.addFileWriter = function(filePath,fileWriter)
|
||||
{
|
||||
this.fileWriters[filePath] = fileWriter;
|
||||
}
|
||||
|
||||
FileMgr.prototype.removeFileWriter = function(filePath)
|
||||
{
|
||||
this.fileWriters[filePath] = null;
|
||||
}
|
||||
|
||||
// File readers add/remove
|
||||
// called internally by readers
|
||||
FileMgr.prototype.addFileReader = function(filePath,fileReader)
|
||||
{
|
||||
this.fileReaders[filePath] = fileReader;
|
||||
}
|
||||
|
||||
FileMgr.prototype.removeFileReader = function(filePath)
|
||||
{
|
||||
this.fileReaders[filePath] = null;
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
*
|
||||
* private reader callback delegation
|
||||
* called from native code
|
||||
*/
|
||||
FileMgr.prototype.reader_onloadstart = function(filePath,result)
|
||||
{
|
||||
this.fileReaders[filePath].onloadstart(result);
|
||||
}
|
||||
|
||||
FileMgr.prototype.reader_onprogress = function(filePath,result)
|
||||
{
|
||||
this.fileReaders[filePath].onprogress(result);
|
||||
}
|
||||
|
||||
FileMgr.prototype.reader_onload = function(filePath,result)
|
||||
{
|
||||
this.fileReaders[filePath].result = unescape(result);
|
||||
this.fileReaders[filePath].onload(this.fileReaders[filePath].result);
|
||||
}
|
||||
|
||||
FileMgr.prototype.reader_onerror = function(filePath,err)
|
||||
{
|
||||
this.fileReaders[filePath].result = err;
|
||||
this.fileReaders[filePath].onerror(err);
|
||||
}
|
||||
|
||||
FileMgr.prototype.reader_onloadend = function(filePath,result)
|
||||
{
|
||||
this.fileReaders[filePath].onloadend(result);
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
*
|
||||
* private writer callback delegation
|
||||
* called from native code
|
||||
*/
|
||||
FileMgr.prototype.writer_onerror = function(filePath,err)
|
||||
{
|
||||
this.fileWriters[filePath].onerror(err);
|
||||
}
|
||||
|
||||
FileMgr.prototype.writer_oncomplete = function(filePath,result)
|
||||
{
|
||||
this.fileWriters[filePath].oncomplete(result); // result contains bytes written
|
||||
}
|
||||
|
||||
|
||||
FileMgr.prototype.getFileBasePaths = function()
|
||||
{
|
||||
//PhoneGap.exec("File.getFileBasePaths");
|
||||
}
|
||||
|
||||
FileMgr.prototype.testFileExists = function(fileName, successCallback, errorCallback)
|
||||
{
|
||||
var test = FileUtil.testFileExists(fileName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
FileMgr.prototype.testDirectoryExists = function(dirName, successCallback, errorCallback)
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
var test = FileUtil.testDirectoryExists(dirName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
FileMgr.prototype.createDirectory = function(dirName, successCallback, errorCallback)
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
var test = FileUtils.createDirectory(dirName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
FileMgr.prototype.deleteDirectory = function(dirName, successCallback, errorCallback)
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
var test = FileUtils.deleteDirectory(dirName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
FileMgr.prototype.deleteFile = function(fileName, successCallback, errorCallback)
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
FileUtils.deleteFile(fileName);
|
||||
test ? successCallback() : errorCallback();
|
||||
}
|
||||
|
||||
FileMgr.prototype.getFreeDiskSpace = function(successCallback, errorCallback)
|
||||
{
|
||||
if(this.freeDiskSpace > 0)
|
||||
{
|
||||
return this.freeDiskSpace;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
this.freeDiskSpace = FileUtils.getFreeDiskSpace();
|
||||
(this.freeDiskSpace > 0) ? successCallback() : errorCallback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// File Reader
|
||||
|
||||
|
||||
function FileReader()
|
||||
{
|
||||
this.fileName = "";
|
||||
this.result = null;
|
||||
this.onloadstart = null;
|
||||
this.onprogress = null;
|
||||
this.onload = null;
|
||||
this.onerror = null;
|
||||
this.onloadend = null;
|
||||
}
|
||||
|
||||
|
||||
FileReader.prototype.abort = function()
|
||||
{
|
||||
// Not Implemented
|
||||
}
|
||||
|
||||
FileReader.prototype.readAsText = function(file)
|
||||
{
|
||||
if(this.fileName && this.fileName.length > 0)
|
||||
{
|
||||
navigator.fileMgr.removeFileReader(this.fileName,this);
|
||||
}
|
||||
this.fileName = file;
|
||||
navigator.fileMgr.addFileReader(this.fileName,this);
|
||||
|
||||
return FileUtil.read(this.fileName);
|
||||
}
|
||||
|
||||
// File Writer
|
||||
|
||||
function FileWriter()
|
||||
{
|
||||
this.fileName = "";
|
||||
this.result = null;
|
||||
this.readyState = 0; // EMPTY
|
||||
this.result = null;
|
||||
this.onerror = null;
|
||||
this.oncomplete = null;
|
||||
}
|
||||
|
||||
FileWriter.prototype.writeAsText = function(file,text,bAppend)
|
||||
{
|
||||
if(this.fileName && this.fileName.length > 0)
|
||||
{
|
||||
navigator.fileMgr.removeFileWriter(this.fileName,this);
|
||||
}
|
||||
this.fileName = file;
|
||||
if(bAppend != true)
|
||||
{
|
||||
bAppend = false; // for null values
|
||||
}
|
||||
navigator.fileMgr.addFileWriter(file,this);
|
||||
this.readyState = 0; // EMPTY
|
||||
var call = FileUtil.write(file, text, bAppend);
|
||||
this.result = null;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/**
|
||||
* This class provides access to device GPS data.
|
||||
* @constructor
|
||||
*/
|
||||
function Geolocation() {
|
||||
/**
|
||||
* The last known GPS position.
|
||||
*/
|
||||
this.lastPosition = null;
|
||||
this.lastError = null;
|
||||
this.listeners = null;
|
||||
};
|
||||
|
||||
var geoListeners = [];
|
||||
|
||||
Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options)
|
||||
{
|
||||
var position = Geo.getCurrentLocation();
|
||||
this.global_success = successCallback;
|
||||
this.fail = errorCallback;
|
||||
}
|
||||
|
||||
// Run the global callback
|
||||
Geolocation.prototype.gotCurrentPosition = function(lat, lng, alt, altacc, head, vel, stamp)
|
||||
{
|
||||
if (lat == "undefined" || lng == "undefined")
|
||||
{
|
||||
this.fail();
|
||||
}
|
||||
else
|
||||
{
|
||||
coords = new Coordinates(lat, lng, alt, altacc, head, vel);
|
||||
loc = new Position(coords, stamp);
|
||||
this.lastPosition = loc;
|
||||
this.global_success(loc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This turns on the GeoLocator class, which has two listeners.
|
||||
* The listeners have their own timeouts, and run independently of this process
|
||||
* In this case, we return the key to the watch hash
|
||||
*/
|
||||
|
||||
Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options)
|
||||
{
|
||||
var frequency = (options != undefined)? options.frequency : 10000;
|
||||
|
||||
var key = geoListeners.push( {"success" : successCallback, "fail" : errorCallback }) - 1;
|
||||
|
||||
// TO-DO: Get the names of the method and pass them as strings to the Java.
|
||||
return Geo.start(frequency, key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve and stop this listener from listening to the GPS
|
||||
*
|
||||
*/
|
||||
Geolocation.prototype.success = function(key, lat, lng, alt, altacc, head, vel, stamp)
|
||||
{
|
||||
var coords = new Coordinates(lat, lng, alt, altacc, head, vel);
|
||||
var loc = new Position(coords, stamp);
|
||||
geoListeners[key].success(loc);
|
||||
}
|
||||
|
||||
Geolocation.prototype.fail = function(key)
|
||||
{
|
||||
geoListeners[key].fail();
|
||||
}
|
||||
|
||||
Geolocation.prototype.clearWatch = function(watchId)
|
||||
{
|
||||
Geo.stop(watchId);
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
// Taken from Jesse's geo fix (similar problem) in PhoneGap iPhone. Go figure, same browser!
|
||||
function __proxyObj(origObj, proxyObj, funkList) {
|
||||
for (var v in funkList) {
|
||||
origObj[funkList[v]] = proxyObj[funkList[v]];
|
||||
}
|
||||
}
|
||||
// In case a native geolocation object exists, proxy the native one over to a diff object so that we can overwrite the native implementation.
|
||||
if (typeof navigator.geolocation != 'undefined') {
|
||||
navigator._geo = new Geolocation();
|
||||
__proxyObj(navigator.geolocation, navigator._geo, ["setLocation", "getCurrentPosition", "watchPosition", "clearWatch", "setError", "start", "stop", "gotCurrentPosition"]);
|
||||
} else {
|
||||
navigator.geolocation = new Geolocation();
|
||||
}
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
function KeyEvent()
|
||||
{
|
||||
}
|
||||
|
||||
KeyEvent.prototype.menuTrigger = function()
|
||||
{
|
||||
var e = document.createEvent('Events');
|
||||
e.initEvent('menuKeyDown');
|
||||
document.dispatchEvent(e);
|
||||
}
|
||||
|
||||
KeyEvent.prototype.searchTrigger= function()
|
||||
{
|
||||
var e = document.createEvent('Events');
|
||||
e.initEvent('searchKeyDown');
|
||||
document.dispatchEvent(e);
|
||||
}
|
||||
|
||||
if (document.keyEvent == null || typeof document.keyEvent == 'undefined')
|
||||
{
|
||||
window.keyEvent = document.keyEvent = new KeyEvent();
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* This class provides access to the device media, interfaces to both sound and video
|
||||
* @constructor
|
||||
*/
|
||||
function Media(src, successCallback, errorCallback) {
|
||||
this.src = src;
|
||||
this.successCallback = successCallback;
|
||||
this.errorCallback = errorCallback;
|
||||
}
|
||||
|
||||
Media.prototype.record = function() {
|
||||
}
|
||||
|
||||
Media.prototype.play = function() {
|
||||
}
|
||||
|
||||
Media.prototype.pause = function() {
|
||||
}
|
||||
|
||||
Media.prototype.stop = function() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class contains information about any Media errors.
|
||||
* @constructor
|
||||
*/
|
||||
function MediaError() {
|
||||
this.code = null,
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
MediaError.MEDIA_ERR_ABORTED = 1;
|
||||
MediaError.MEDIA_ERR_NETWORK = 2;
|
||||
MediaError.MEDIA_ERR_DECODE = 3;
|
||||
MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
|
||||
|
||||
|
||||
//if (typeof navigator.audio == "undefined") navigator.audio = new Media(src);
|
||||
|
||||
/**
|
||||
* This class provides access to the device media, interfaces to both sound and video
|
||||
* @constructor
|
||||
*/
|
||||
|
||||
Media.prototype.play = function() {
|
||||
DroidGap.startPlayingAudio(this.src);
|
||||
}
|
||||
|
||||
Media.prototype.stop = function() {
|
||||
DroidGap.stopPlayingAudio();
|
||||
}
|
||||
|
||||
Media.prototype.startRecord = function() {
|
||||
DroidGap.startRecordingAudio(this.src);
|
||||
}
|
||||
|
||||
Media.prototype.stopRecordingAudio = function() {
|
||||
DroidGap.stopRecordingAudio();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/**
|
||||
* This class contains information about any NetworkStatus.
|
||||
* @constructor
|
||||
*/
|
||||
function NetworkStatus() {
|
||||
this.code = null;
|
||||
this.message = "";
|
||||
}
|
||||
NetworkStatus.NOT_REACHABLE = 0;
|
||||
NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK = 1;
|
||||
NetworkStatus.REACHABLE_VIA_WIFI_NETWORK = 2;
|
||||
/**
|
||||
* This class provides access to device Network data (reachability).
|
||||
* @constructor
|
||||
*/
|
||||
function Network() {
|
||||
/**
|
||||
* The last known Network status.
|
||||
* { hostName: string, ipAddress: string,
|
||||
remoteHostStatus: int(0/1/2), internetConnectionStatus: int(0/1/2), localWiFiConnectionStatus: int (0/2) }
|
||||
*/
|
||||
this.lastReachability = null;
|
||||
};
|
||||
/**
|
||||
* Called by the geolocation framework when the reachability status has changed.
|
||||
* @param {Reachibility} reachability The current reachability status.
|
||||
*/
|
||||
Network.prototype.updateReachability = function(reachability) {
|
||||
this.lastReachability = reachability;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param {Object} uri
|
||||
* @param {Function} win
|
||||
* @param {Object} options (isIpAddress:boolean)
|
||||
*/
|
||||
Network.prototype.isReachable = function(uri, win, options)
|
||||
{
|
||||
var status = new NetworkStatus();
|
||||
if(NetworkManager.isReachable(uri))
|
||||
{
|
||||
if (NetworkManager.isWifiActive()) {
|
||||
status.code = NetworkStatus.REACHABLE_VIA_WIFI_NETWORK;
|
||||
} else {
|
||||
status.code = NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK;
|
||||
}
|
||||
} else {
|
||||
status.code = NetworkStatus.NOT_REACHABLE;
|
||||
}
|
||||
win(status);
|
||||
};
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof navigator.network == "undefined") navigator.network = new Network();
|
||||
});
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* This class provides access to notifications on the device.
|
||||
*/
|
||||
function Notification() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a native alert dialog, with a customizable title and button text.
|
||||
* @param {String} message Message to print in the body of the alert
|
||||
* @param {String} [title="Alert"] Title of the alert dialog (default: Alert)
|
||||
* @param {String} [buttonLabel="OK"] Label of the close button (default: OK)
|
||||
*/
|
||||
Notification.prototype.alert = function(message, title, buttonLabel) {
|
||||
// Default is to use a browser alert; this will use "index.html" as the title though
|
||||
alert(message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Start spinning the activity indicator on the statusbar
|
||||
*/
|
||||
Notification.prototype.activityStart = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Stop spinning the activity indicator on the statusbar, if it's currently spinning
|
||||
*/
|
||||
Notification.prototype.activityStop = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Causes the device to blink a status LED.
|
||||
* @param {Integer} count The number of blinks.
|
||||
* @param {String} colour The colour of the light.
|
||||
*/
|
||||
Notification.prototype.blink = function(count, colour) {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Causes the device to vibrate.
|
||||
* @param {Integer} mills The number of milliseconds to vibrate for.
|
||||
*/
|
||||
Notification.prototype.vibrate = function(mills) {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Causes the device to beep.
|
||||
* @param {Integer} count The number of beeps.
|
||||
* @param {Integer} volume The volume of the beep.
|
||||
*/
|
||||
Notification.prototype.beep = function(count, volume) {
|
||||
|
||||
};
|
||||
|
||||
// TODO: of course on Blackberry and Android there notifications in the UI as well
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof navigator.notification == "undefined") navigator.notification = new Notification();
|
||||
});
|
||||
|
||||
Notification.prototype.vibrate = function(mills)
|
||||
{
|
||||
DroidGap.vibrate(mills);
|
||||
}
|
||||
|
||||
/*
|
||||
* On the Android, we don't beep, we notify you with your
|
||||
* notification! We shouldn't keep hammering on this, and should
|
||||
* review what we want beep to do.
|
||||
*/
|
||||
|
||||
Notification.prototype.beep = function(count, volume)
|
||||
{
|
||||
DroidGap.beep(count);
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
if (typeof(DeviceInfo) != 'object')
|
||||
DeviceInfo = {};
|
||||
|
||||
/**
|
||||
* This represents the PhoneGap API itself, and provides a global namespace for accessing
|
||||
* information about the state of PhoneGap.
|
||||
* @class
|
||||
*/
|
||||
PhoneGap = {
|
||||
queue: {
|
||||
ready: true,
|
||||
commands: [],
|
||||
timer: null
|
||||
},
|
||||
_constructors: []
|
||||
};
|
||||
|
||||
/**
|
||||
* Boolean flag indicating if the PhoneGap API is available and initialized.
|
||||
*/ // TODO: Remove this, it is unused here ... -jm
|
||||
PhoneGap.available = DeviceInfo.uuid != undefined;
|
||||
|
||||
/**
|
||||
* Add an initialization function to a queue that ensures it will run and initialize
|
||||
* application constructors only once PhoneGap has been initialized.
|
||||
* @param {Function} func The function callback you want run once PhoneGap is initialized
|
||||
*/
|
||||
PhoneGap.addConstructor = function(func) {
|
||||
var state = document.readyState;
|
||||
if ( state == 'loaded' || state == 'complete' )
|
||||
{
|
||||
func();
|
||||
}
|
||||
else
|
||||
{
|
||||
PhoneGap._constructors.push(func);
|
||||
}
|
||||
};
|
||||
|
||||
(function()
|
||||
{
|
||||
var timer = setInterval(function()
|
||||
{
|
||||
|
||||
var state = document.readyState;
|
||||
|
||||
if ( state == 'loaded' || state == 'complete' )
|
||||
{
|
||||
clearInterval(timer); // stop looking
|
||||
// run our constructors list
|
||||
while (PhoneGap._constructors.length > 0)
|
||||
{
|
||||
var constructor = PhoneGap._constructors.shift();
|
||||
try
|
||||
{
|
||||
constructor();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
if (typeof(debug['log']) == 'function')
|
||||
{
|
||||
debug.log("Failed to run constructor: " + debug.processMessage(e));
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("Failed to run constructor: " + e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
// all constructors run, now fire the deviceready event
|
||||
var e = document.createEvent('Events');
|
||||
e.initEvent('deviceready');
|
||||
document.dispatchEvent(e);
|
||||
}
|
||||
}, 5);
|
||||
})();
|
||||
|
||||
|
||||
/**
|
||||
* Execute a PhoneGap command in a queued fashion, to ensure commands do not
|
||||
* execute with any race conditions, and only run when PhoneGap is ready to
|
||||
* recieve them.
|
||||
* @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method"
|
||||
* @param {String[]} [args] Zero or more arguments to pass to the method
|
||||
*/
|
||||
PhoneGap.exec = function() {
|
||||
PhoneGap.queue.commands.push(arguments);
|
||||
if (PhoneGap.queue.timer == null)
|
||||
PhoneGap.queue.timer = setInterval(PhoneGap.run_command, 10);
|
||||
};
|
||||
|
||||
/**
|
||||
* Internal function used to dispatch the request to PhoneGap. It processes the
|
||||
* command queue and executes the next command on the list. If one of the
|
||||
* arguments is a JavaScript object, it will be passed on the QueryString of the
|
||||
* url, which will be turned into a dictionary on the other end.
|
||||
* @private
|
||||
*/
|
||||
PhoneGap.run_command = function() {
|
||||
if (!PhoneGap.available || !PhoneGap.queue.ready)
|
||||
return;
|
||||
|
||||
PhoneGap.queue.ready = false;
|
||||
|
||||
var args = PhoneGap.queue.commands.shift();
|
||||
if (PhoneGap.queue.commands.length == 0) {
|
||||
clearInterval(PhoneGap.queue.timer);
|
||||
PhoneGap.queue.timer = null;
|
||||
}
|
||||
|
||||
var uri = [];
|
||||
var dict = null;
|
||||
for (var i = 1; i < args.length; i++) {
|
||||
var arg = args[i];
|
||||
if (arg == undefined || arg == null)
|
||||
arg = '';
|
||||
if (typeof(arg) == 'object')
|
||||
dict = arg;
|
||||
else
|
||||
uri.push(encodeURIComponent(arg));
|
||||
}
|
||||
var url = "gap://" + args[0] + "/" + uri.join("/");
|
||||
if (dict != null) {
|
||||
var query_args = [];
|
||||
for (var name in dict) {
|
||||
if (typeof(name) != 'string')
|
||||
continue;
|
||||
query_args.push(encodeURIComponent(name) + "=" + encodeURIComponent(dict[name]));
|
||||
}
|
||||
if (query_args.length > 0)
|
||||
url += "?" + query_args.join("&");
|
||||
}
|
||||
document.location = url;
|
||||
|
||||
};
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* This class contains position information.
|
||||
* @param {Object} lat
|
||||
* @param {Object} lng
|
||||
* @param {Object} acc
|
||||
* @param {Object} alt
|
||||
* @param {Object} altacc
|
||||
* @param {Object} head
|
||||
* @param {Object} vel
|
||||
* @constructor
|
||||
*/
|
||||
function Position(coords, timestamp) {
|
||||
this.coords = coords;
|
||||
this.timestamp = new Date().getTime();
|
||||
}
|
||||
|
||||
function Coordinates(lat, lng, alt, acc, head, vel) {
|
||||
/**
|
||||
* The latitude of the position.
|
||||
*/
|
||||
this.latitude = lat;
|
||||
/**
|
||||
* The longitude of the position,
|
||||
*/
|
||||
this.longitude = lng;
|
||||
/**
|
||||
* The accuracy of the position.
|
||||
*/
|
||||
this.accuracy = acc;
|
||||
/**
|
||||
* The altitude of the position.
|
||||
*/
|
||||
this.altitude = alt;
|
||||
/**
|
||||
* The direction the device is moving at the position.
|
||||
*/
|
||||
this.heading = head;
|
||||
/**
|
||||
* The velocity with which the device is moving at the position.
|
||||
*/
|
||||
this.speed = vel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class specifies the options for requesting position data.
|
||||
* @constructor
|
||||
*/
|
||||
function PositionOptions() {
|
||||
/**
|
||||
* Specifies the desired position accuracy.
|
||||
*/
|
||||
this.enableHighAccuracy = true;
|
||||
/**
|
||||
* The timeout after which if position data cannot be obtained the errorCallback
|
||||
* is called.
|
||||
*/
|
||||
this.timeout = 10000;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class contains information about any GSP errors.
|
||||
* @constructor
|
||||
*/
|
||||
function PositionError() {
|
||||
this.code = null;
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
PositionError.UNKNOWN_ERROR = 0;
|
||||
PositionError.PERMISSION_DENIED = 1;
|
||||
PositionError.POSITION_UNAVAILABLE = 2;
|
||||
PositionError.TIMEOUT = 3;
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* This is purely for the Android 1.5/1.6 HTML 5 Storage
|
||||
* I was hoping that Android 2.0 would deprecate this, but given the fact that
|
||||
* most manufacturers ship with Android 1.5 and do not do OTA Updates, this is required
|
||||
*/
|
||||
|
||||
var DroidDB = function()
|
||||
{
|
||||
this.txQueue = [];
|
||||
}
|
||||
|
||||
DroidDB.prototype.addResult = function(rawdata, tx_id)
|
||||
{
|
||||
eval("var data = " + rawdata);
|
||||
var tx = this.txQueue[tx_id];
|
||||
tx.resultSet.push(data);
|
||||
}
|
||||
|
||||
DroidDB.prototype.completeQuery = function(tx_id)
|
||||
{
|
||||
var tx = this.txQueue[tx_id];
|
||||
var r = new result();
|
||||
r.rows.resultSet = tx.resultSet;
|
||||
r.rows.length = tx.resultSet.length;
|
||||
tx.win(r);
|
||||
}
|
||||
|
||||
DroidDB.prototype.fail = function(reason, tx_id)
|
||||
{
|
||||
var tx = this.txQueue[tx_id];
|
||||
tx.fail(reason);
|
||||
}
|
||||
|
||||
var DatabaseShell = function()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DatabaseShell.prototype.transaction = function(process)
|
||||
{
|
||||
tx = new Tx();
|
||||
process(tx);
|
||||
}
|
||||
|
||||
var Tx = function()
|
||||
{
|
||||
droiddb.txQueue.push(this);
|
||||
this.id = droiddb.txQueue.length - 1;
|
||||
this.resultSet = [];
|
||||
}
|
||||
|
||||
Tx.prototype.executeSql = function(query, params, win, fail)
|
||||
{
|
||||
droidStorage.executeSql(query, params, this.id);
|
||||
tx.win = win;
|
||||
tx.fail = fail;
|
||||
}
|
||||
|
||||
var result = function()
|
||||
{
|
||||
this.rows = new Rows();
|
||||
}
|
||||
|
||||
var Rows = function()
|
||||
{
|
||||
this.resultSet = [];
|
||||
this.length = 0;
|
||||
}
|
||||
|
||||
Rows.prototype.item = function(row_id)
|
||||
{
|
||||
return this.resultSet[id];
|
||||
}
|
||||
|
||||
var dbSetup = function(name, version, display_name, size)
|
||||
{
|
||||
droidStorage.openDatabase(name, version, display_name, size)
|
||||
db_object = new DatabaseShell();
|
||||
return db_object;
|
||||
}
|
||||
|
||||
PhoneGap.addConstructor(function() {
|
||||
if (typeof window.openDatabase == "undefined")
|
||||
{
|
||||
navigator.openDatabase = window.openDatabase = dbSetup;
|
||||
window.droiddb = new DroidDB();
|
||||
}
|
||||
});
|
||||
|
||||
27
framework/assets/www/index.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script src="cordova-1.9.0.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,85 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="PhoneGap" default="help">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<project name="Cordova" default="jar">
|
||||
|
||||
<!-- LOAD VERSION -->
|
||||
<loadfile property="version" srcFile="../VERSION">
|
||||
<filterchain>
|
||||
<striplinebreaks/>
|
||||
</filterchain>
|
||||
</loadfile>
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked in in Version
|
||||
Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<loadproperties srcFile="local.properties" />
|
||||
|
||||
<!-- The build.properties file can be created by you and is never touched
|
||||
by the 'android' tool. This is the place to change some of the default property values
|
||||
used by the Ant rules.
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
application.package
|
||||
the name of your application package as defined in the manifest. Used by the
|
||||
'uninstall' rule.
|
||||
source.dir
|
||||
the name of the source directory. Default is 'src'.
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
the name of the output directory. Default is 'bin'.
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
Properties related to the SDK location or the project target should be updated
|
||||
using the 'android' tool with the 'update' action.
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
This file is an integral part of the build system for your application and
|
||||
should be checked in in Version Control Systems.
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="build.properties" />
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The default.properties file is created and updated by the 'android' tool, as well
|
||||
as ADT.
|
||||
This file is an integral part of the build system for your application and
|
||||
should be checked in in Version Control Systems. -->
|
||||
<property file="default.properties" />
|
||||
<!-- We need to setup the double quote. -->
|
||||
<property name="dblQuote">"</property>
|
||||
|
||||
<!-- Custom Android task to deal with the project target, and import the proper rules.
|
||||
This requires ant 1.6.0 or above. -->
|
||||
<path id="android.antlibs">
|
||||
<pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
|
||||
<pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
|
||||
<pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
|
||||
<pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
|
||||
<pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!-- version-tag: custom -->
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
<target name="-pre-build">
|
||||
</target>
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
/* This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
<!-- Combine JavaScript files into one cordova-uncompressed.js file. -->
|
||||
<target name="build-javascript" depends="clean">
|
||||
|
||||
<!-- Clean up existing files -->
|
||||
<!--<delete file="assets/www/cordova_${version}.js"/>-->
|
||||
|
||||
<!-- Create uncompressed JS file -->
|
||||
<concat destfile="assets/www/cordova-${version}.js">
|
||||
<filelist dir="assets/js" files="cordova.android.js"/>
|
||||
</concat>
|
||||
|
||||
<!-- update project files to reference cordova-x.x.x.min.js -->
|
||||
<replaceregexp match="cordova(.*)\.js" replace="cordova-${version}.js" byline="true">
|
||||
<fileset file="assets/www/index.html" />
|
||||
<fileset file="../bin/templates/project/assets/www/index.html" />
|
||||
</replaceregexp>
|
||||
|
||||
<!-- This is sketchy, but it works, ${dblQuote} does not -->
|
||||
<replaceregexp match="cordovaVersion = [\u0022].*[\u0022];" replace='cordovaVersion = ${dblQuote}${version}${dblQuote};' byline="true">
|
||||
<fileset file="src/org/apache/cordova/Device.java" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
|
||||
<!-- Build Cordova jar file that includes all native code, and Cordova JS file
|
||||
that includes all JavaScript code.
|
||||
-->
|
||||
<target name="jar" depends="build-javascript, -compile">
|
||||
<jar jarfile="cordova-${version}.jar" basedir="bin/classes" excludes="org/apache/cordova/R.class,org/apache/cordova/R$*.class"/>
|
||||
</target>
|
||||
|
||||
<!-- tests for Java files -->
|
||||
<property name="test.dir" location="test/org/apache/cordova" />
|
||||
|
||||
<path id="test.classpath">
|
||||
<!-- requires both junit and cordova -->
|
||||
<pathelement location="libs/junit-4.10.jar" />
|
||||
<pathelement location="cordova-${version}.jar" />
|
||||
<pathelement location="${test.dir}" />
|
||||
</path>
|
||||
|
||||
<taskdef name="setup"
|
||||
classname="com.android.ant.SetupTask"
|
||||
classpathref="android.antlibs" />
|
||||
|
||||
<!-- Execute the Android Setup task that will setup some properties specific to the target,
|
||||
and import the build rules files.
|
||||
|
||||
The rules file is imported from
|
||||
<SDK>/platforms/<target_platform>/templates/android_rules.xml
|
||||
|
||||
To customize some build steps for your project:
|
||||
- copy the content of the main node <project> from android_rules.xml
|
||||
- paste it in this build.xml below the <setup /> task.
|
||||
- disable the import by changing the setup task below to <setup import="false" />
|
||||
|
||||
This will ensure that the properties are setup correctly but that your customized
|
||||
build steps are used.
|
||||
-->
|
||||
<setup />
|
||||
|
||||
<target name="move_files">
|
||||
<concat destfile="../example/phonegap.js">
|
||||
<fileset dir="assets/js" includes="phonegap.js.base" />
|
||||
<fileset dir="assets/js" includes="*.js" />
|
||||
</concat>
|
||||
<target name="compile-test">
|
||||
<javac srcdir="${test.dir}" >
|
||||
<classpath refid="test.classpath" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="move_files, compile">
|
||||
<jar jarfile="phonegap.jar" basedir="bin/classes" excludes="**/R*.class" />
|
||||
<target name="test" depends="jar, compile-test">
|
||||
<junit showoutput="true">
|
||||
<classpath refid="test.classpath" />
|
||||
<formatter type="brief" usefile="false" />
|
||||
<batchtest fork="yes">
|
||||
<fileset dir="${test.dir}">
|
||||
<include name="*Test.java" />
|
||||
<include name="**/*Test.java" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="phonegap_debug" depends="move_files, debug">
|
||||
<target name="cordova_debug" depends="build-javascript, debug">
|
||||
</target>
|
||||
|
||||
<target name="phonegap_release" depends="move_files, release">
|
||||
<target name="cordova_release" depends="build-javascript, release">
|
||||
</target>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# 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,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
@@ -10,5 +10,5 @@
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-14
|
||||
apk-configurations=
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="PhoneGap/PhoneGap.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/PhoneGap/export-phonegap.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
|
||||
<sealing sealJar="false">
|
||||
<packagesToSeal/>
|
||||
<packagesToUnSeal/>
|
||||
</sealing>
|
||||
</manifest>
|
||||
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
|
||||
<javaElement handleIdentifier="=PhoneGap/src"/>
|
||||
<javaElement handleIdentifier="=PhoneGap/gen"/>
|
||||
</selectedElements>
|
||||
</jardesc>
|
||||
@@ -1,29 +0,0 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package com.phonegap;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int appView=0x7f050000;
|
||||
public static final int go=0x7f050002;
|
||||
public static final int surface=0x7f050001;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int main=0x7f030000;
|
||||
public static final int preview=0x7f030001;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040000;
|
||||
public static final int go=0x7f040001;
|
||||
}
|
||||
}
|
||||
15
framework/project.properties
Normal file
@@ -0,0 +1,15 @@
|
||||
# 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.
|
||||
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=Google Inc.:Google APIs:15
|
||||
apk-configurations=
|
||||
renderscript.opt.level=O0
|
||||
BIN
framework/res/drawable-hdpi/icon.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
framework/res/drawable-ldpi/icon.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
framework/res/drawable-mdpi/icon.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
framework/res/drawable/splash.png
Executable file
|
After Width: | Height: | Size: 92 KiB |
@@ -1,11 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
>
|
||||
<WebView android:id="@+id/appView"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
/>
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:orientation="horizontal">
|
||||
<SurfaceView android:id="@+id/surface"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||
android:layout_weight="1">
|
||||
</SurfaceView>
|
||||
<Button
|
||||
android:id="@+id/go"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
android:text="@string/go"
|
||||
android:minWidth="50dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginRight="5dip"
|
||||
android:layout_marginTop="5dip"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,5 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<resources>
|
||||
<string name="app_name">PhoneGap</string>
|
||||
<string name="app_name">Cordova</string>
|
||||
<string name="go">Snap</string>
|
||||
</resources>
|
||||
|
||||
37
framework/res/xml/cordova.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<cordova>
|
||||
<!--
|
||||
access elements control the Android whitelist.
|
||||
Domains are assumed blocked unless set otherwise
|
||||
-->
|
||||
|
||||
<access origin="http://127.0.0.1*"/> <!-- allow local pages -->
|
||||
|
||||
<!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
|
||||
<!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
|
||||
<!-- <access origin=".*"/> Allow all domains, suggested development use only -->
|
||||
|
||||
<log level="DEBUG"/>
|
||||
<preference name="useBrowserHistory" value="false" />
|
||||
</cordova>
|
||||
|
||||
|
||||
|
||||
38
framework/res/xml/plugins.xml
Executable file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<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="NetworkStatus" 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"/>
|
||||
<plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
|
||||
</plugins>
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class AccelBroker {
|
||||
private WebView mAppView;
|
||||
private Context mCtx;
|
||||
private HashMap<String, AccelListener> accelListeners;
|
||||
|
||||
public AccelBroker(WebView view, Context ctx)
|
||||
{
|
||||
mCtx = ctx;
|
||||
mAppView = view;
|
||||
accelListeners = new HashMap<String, AccelListener>();
|
||||
}
|
||||
|
||||
public String start(int freq, String key)
|
||||
{
|
||||
AccelListener listener = new AccelListener(key, freq, mCtx, mAppView);
|
||||
listener.start(freq);
|
||||
accelListeners.put(key, listener);
|
||||
return key;
|
||||
}
|
||||
|
||||
public void stop(String key)
|
||||
{
|
||||
AccelListener acc = accelListeners.get(key);
|
||||
acc.stop();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class AccelListener implements SensorEventListener{
|
||||
|
||||
WebView mAppView;
|
||||
Context mCtx;
|
||||
String mKey;
|
||||
Sensor mSensor;
|
||||
int mTime = 10000;
|
||||
boolean started = false;
|
||||
|
||||
private SensorManager sensorManager;
|
||||
|
||||
private long lastUpdate = -1;
|
||||
|
||||
public AccelListener(String key, int freq, Context ctx, WebView appView)
|
||||
{
|
||||
mCtx = ctx;
|
||||
mAppView = appView;
|
||||
mKey = key;
|
||||
mTime = freq;
|
||||
sensorManager = (SensorManager) mCtx.getSystemService(Context.SENSOR_SERVICE);
|
||||
|
||||
}
|
||||
|
||||
public void start(int time)
|
||||
{
|
||||
mTime = time;
|
||||
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ACCELEROMETER);
|
||||
if (list.size() > 0)
|
||||
{
|
||||
this.mSensor = list.get(0);
|
||||
this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_FASTEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
mAppView.loadUrl("javascript:navigator.accelerometer.epicFail(" + mKey + ", 'Failed to start')");
|
||||
}
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
if(started)
|
||||
sensorManager.unregisterListener(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER)
|
||||
return;
|
||||
long curTime = System.currentTimeMillis();
|
||||
if (lastUpdate == -1 || (curTime - lastUpdate) > mTime) {
|
||||
lastUpdate = curTime;
|
||||
|
||||
float x = event.values[0];
|
||||
float y = event.values[1];
|
||||
float z = event.values[2];
|
||||
//mAppView.loadUrl("javascript:gotAccel(" + x + ", " + y + "," + z + " )");
|
||||
mAppView.loadUrl("javascript:navigator.accelerometer.gotAccel(" + mKey + "," + x + "," + y + "," + z + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaPlayer;
|
||||
import android.media.MediaPlayer.OnErrorListener;
|
||||
import android.media.MediaRecorder;
|
||||
import android.media.MediaPlayer.OnBufferingUpdateListener;
|
||||
import android.media.MediaPlayer.OnCompletionListener;
|
||||
import android.media.MediaPlayer.OnPreparedListener;
|
||||
import android.util.Log;
|
||||
|
||||
public class AudioHandler implements OnCompletionListener, OnPreparedListener, OnErrorListener {
|
||||
private MediaRecorder recorder;
|
||||
private boolean isRecording = false;
|
||||
MediaPlayer mPlayer;
|
||||
private boolean isPlaying = false;
|
||||
private String recording;
|
||||
private String saveFile;
|
||||
private Context mCtx;
|
||||
|
||||
public AudioHandler(String file, Context ctx) {
|
||||
this.recording = file;
|
||||
this.mCtx = ctx;
|
||||
}
|
||||
|
||||
protected void startRecording(String file){
|
||||
if (!isRecording){
|
||||
saveFile=file;
|
||||
recorder = new MediaRecorder();
|
||||
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
|
||||
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
|
||||
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
|
||||
recorder.setOutputFile(this.recording);
|
||||
try {
|
||||
recorder.prepare();
|
||||
} catch (IllegalStateException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
isRecording = true;
|
||||
recorder.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void moveFile(String file) {
|
||||
/* this is a hack to save the file as the specified name */
|
||||
File f = new File (this.recording);
|
||||
f.renameTo(new File("/sdcard" + file));
|
||||
}
|
||||
|
||||
protected void stopRecording(){
|
||||
try{
|
||||
if((recorder != null)&&(isRecording))
|
||||
{
|
||||
isRecording = false;
|
||||
recorder.stop();
|
||||
recorder.release();
|
||||
}
|
||||
moveFile(saveFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void startPlaying(String file) {
|
||||
if (isPlaying==false) {
|
||||
try {
|
||||
mPlayer = new MediaPlayer();
|
||||
isPlaying=true;
|
||||
Log.d("Audio startPlaying", "audio: " + file);
|
||||
if (isStreaming(file))
|
||||
{
|
||||
Log.d("AudioStartPlaying", "Streaming");
|
||||
// Streaming prepare async
|
||||
mPlayer.setDataSource(file);
|
||||
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
mPlayer.prepareAsync();
|
||||
} else {
|
||||
Log.d("AudioStartPlaying", "File");
|
||||
// Not streaming prepare synchronous, abstract base directory
|
||||
mPlayer.setDataSource("/sdcard/" + file);
|
||||
mPlayer.prepare();
|
||||
}
|
||||
mPlayer.setOnPreparedListener(this);
|
||||
} catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stopPlaying() {
|
||||
if (isPlaying) {
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
isPlaying=false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onCompletion(MediaPlayer mPlayer) {
|
||||
mPlayer.stop();
|
||||
mPlayer.release();
|
||||
isPlaying=false;
|
||||
}
|
||||
|
||||
protected long getCurrentPosition() {
|
||||
if (isPlaying)
|
||||
{
|
||||
return(mPlayer.getCurrentPosition());
|
||||
} else { return(-1); }
|
||||
}
|
||||
|
||||
private boolean isStreaming(String file)
|
||||
{
|
||||
if (file.contains("http://")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected long getDuration(String file) {
|
||||
long duration = -2;
|
||||
if (!isPlaying & !isStreaming(file)) {
|
||||
try {
|
||||
mPlayer = new MediaPlayer();
|
||||
mPlayer.setDataSource("/sdcard/" + file);
|
||||
mPlayer.prepare();
|
||||
duration = mPlayer.getDuration();
|
||||
mPlayer.release();
|
||||
} catch (Exception e) { e.printStackTrace(); return(-3); }
|
||||
} else
|
||||
if (isPlaying & !isStreaming(file)) {
|
||||
duration = mPlayer.getDuration();
|
||||
} else
|
||||
if (isPlaying & isStreaming(file)) {
|
||||
try {
|
||||
duration = mPlayer.getDuration();
|
||||
} catch (Exception e) { e.printStackTrace(); return(-4); }
|
||||
}else { return -1; }
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void onPrepared(MediaPlayer mPlayer) {
|
||||
if (isPlaying) {
|
||||
mPlayer.setOnCompletionListener(this);
|
||||
mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener()
|
||||
{
|
||||
public void onBufferingUpdate(MediaPlayer mPlayer, int percent)
|
||||
{
|
||||
/* TODO: call back, e.g. update outer progress bar */
|
||||
Log.d("AudioOnBufferingUpdate", "percent: " + percent);
|
||||
}
|
||||
});
|
||||
mPlayer.start();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) {
|
||||
Log.e("AUDIO onError", "error " + arg1 + " " + arg2);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setAudioOutputDevice(int output){
|
||||
// Changes the default audio output device to speaker or earpiece
|
||||
AudioManager audiMgr = (AudioManager) mCtx.getSystemService(Context.AUDIO_SERVICE);
|
||||
if (output == (2))
|
||||
audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
|
||||
else if (output == (1)){
|
||||
audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
|
||||
}else
|
||||
Log.e("AudioHandler setAudioOutputDevice", " unknown output device");
|
||||
}
|
||||
|
||||
protected int getAudioOutputDevice(){
|
||||
AudioManager audiMgr = (AudioManager) mCtx.getSystemService(Context.AUDIO_SERVICE);
|
||||
if (audiMgr.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_EARPIECE)
|
||||
return 1;
|
||||
else if (audiMgr.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_SPEAKER)
|
||||
return 2;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import android.webkit.WebView;
|
||||
|
||||
|
||||
public class CameraLauncher {
|
||||
|
||||
private WebView mAppView;
|
||||
private DroidGap mGap;
|
||||
int quality;
|
||||
|
||||
CameraLauncher(WebView view, DroidGap gap)
|
||||
{
|
||||
mAppView = view;
|
||||
mGap = gap;
|
||||
}
|
||||
|
||||
public void takePicture(int quality)
|
||||
{
|
||||
mGap.startCamera(quality);
|
||||
}
|
||||
|
||||
/* Return Base64 Encoded String to Javascript */
|
||||
public void processPicture( String js_out )
|
||||
{
|
||||
mAppView.loadUrl("javascript:navigator.camera.win('" + js_out + "');");
|
||||
}
|
||||
|
||||
public void failPicture(String err)
|
||||
{
|
||||
mAppView.loadUrl("javascript:navigator.camera.fail('" + err + "');");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Bitmap.CompressFormat;
|
||||
import android.hardware.Camera;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
public class CameraPreview extends Activity implements SurfaceHolder.Callback{
|
||||
|
||||
private static final String TAG = "PhoneGapCamera";
|
||||
private SurfaceView mSurfaceView;
|
||||
private SurfaceHolder mSurfaceHolder;
|
||||
|
||||
private RelativeLayout root;
|
||||
|
||||
Camera mCamera;
|
||||
boolean mPreviewRunning = false;
|
||||
|
||||
int quality;
|
||||
Intent mIntent;
|
||||
|
||||
public void onCreate(Bundle icicle)
|
||||
{
|
||||
super.onCreate(icicle);
|
||||
|
||||
Log.e(TAG, "onCreate");
|
||||
|
||||
getWindow().setFormat(PixelFormat.TRANSLUCENT);
|
||||
|
||||
RelativeLayout.LayoutParams containerParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT);
|
||||
LinearLayout.LayoutParams surfaceParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT, 0.0F);
|
||||
RelativeLayout.LayoutParams buttonParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
root = new RelativeLayout(this);
|
||||
root.setLayoutParams(containerParams);
|
||||
|
||||
mSurfaceView = new SurfaceView(this);
|
||||
mSurfaceView.setLayoutParams(surfaceParams);
|
||||
root.addView(mSurfaceView);
|
||||
|
||||
Button stopButton = new Button(this);
|
||||
stopButton.setText("click");
|
||||
buttonParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
buttonParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
|
||||
buttonParams.rightMargin = 5;
|
||||
buttonParams.topMargin = 5;
|
||||
|
||||
stopButton.setLayoutParams(buttonParams);
|
||||
root.addView(stopButton);
|
||||
|
||||
setContentView(root);
|
||||
|
||||
mSurfaceHolder = mSurfaceView.getHolder();
|
||||
mSurfaceHolder.addCallback(this);
|
||||
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||
mIntent = this.getIntent();
|
||||
|
||||
quality = mIntent.getIntExtra("quality", 100);
|
||||
|
||||
|
||||
stopButton.setOnClickListener(mSnapListener);
|
||||
}
|
||||
|
||||
private OnClickListener mSnapListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mCamera.takePicture(null, null, mPictureCallback);
|
||||
}
|
||||
};
|
||||
|
||||
public boolean onCreateOptionsMenu(android.view.Menu menu) {
|
||||
MenuItem item = menu.add(0, 0, 0, "goto gallery");
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Uri target = Uri.parse("content://media/external/images/media");
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, target);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(Bundle savedInstanceState)
|
||||
{
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
/*
|
||||
* We got the data, send it back to PhoneGap to be handled and processed.
|
||||
*
|
||||
*/
|
||||
|
||||
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
|
||||
public void onPictureTaken(byte[] data, Camera c) {
|
||||
Log.e(TAG, "PICTURE CALLBACK: data.length = " + data.length);
|
||||
storeAndExit(data);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* We can't just store and exit, because Android freezes up when we try to cram a picture across a process in a Bundle.
|
||||
* We HAVE to compress this data and send back the compressed data
|
||||
*/
|
||||
public void storeAndExit(byte[] data)
|
||||
{
|
||||
ByteArrayOutputStream jpeg_data = new ByteArrayOutputStream();
|
||||
Bitmap myMap = BitmapFactory.decodeByteArray(data, 0, data.length);
|
||||
try {
|
||||
if (myMap.compress(CompressFormat.JPEG, quality, jpeg_data))
|
||||
{
|
||||
byte[] code = jpeg_data.toByteArray();
|
||||
byte[] output = Base64.encodeBase64(code);
|
||||
String js_out = new String(output);
|
||||
mIntent.putExtra("picture", js_out);
|
||||
setResult(RESULT_OK, mIntent);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
//Do shit here
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_CAMERA || keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_SEARCH) {
|
||||
mCamera.takePicture(null, null, mPictureCallback);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void onResume()
|
||||
{
|
||||
Log.e(TAG, "onResume");
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
protected void onSaveInstanceState(Bundle outState)
|
||||
{
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
protected void onStop()
|
||||
{
|
||||
Log.e(TAG, "onStop");
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public void surfaceCreated(SurfaceHolder holder)
|
||||
{
|
||||
Log.e(TAG, "surfaceCreated");
|
||||
mCamera = Camera.open();
|
||||
//mCamera.startPreview();
|
||||
}
|
||||
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h)
|
||||
{
|
||||
Log.e(TAG, "surfaceChanged");
|
||||
|
||||
// XXX stopPreview() will crash if preview is not running
|
||||
if (mPreviewRunning) {
|
||||
mCamera.stopPreview();
|
||||
}
|
||||
|
||||
Camera.Parameters p = mCamera.getParameters();
|
||||
p.setPreviewSize(w, h);
|
||||
mCamera.setParameters(p);
|
||||
try {
|
||||
mCamera.setPreviewDisplay(holder);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
mCamera.startPreview();
|
||||
mPreviewRunning = true;
|
||||
}
|
||||
|
||||
public void surfaceDestroyed(SurfaceHolder holder)
|
||||
{
|
||||
Log.e(TAG, "surfaceDestroyed");
|
||||
mCamera.stopPreview();
|
||||
mPreviewRunning = false;
|
||||
mCamera.release();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class CompassListener implements SensorEventListener{
|
||||
WebView mAppView;
|
||||
Context mCtx;
|
||||
Sensor mSensor;
|
||||
|
||||
private SensorManager sensorManager;
|
||||
|
||||
CompassListener(Context ctx, WebView appView)
|
||||
{
|
||||
mCtx = ctx;
|
||||
mAppView = appView;
|
||||
sensorManager = (SensorManager) mCtx.getSystemService(Context.SENSOR_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
public void start()
|
||||
{
|
||||
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_ORIENTATION);
|
||||
if (list.size() > 0)
|
||||
{
|
||||
this.mSensor = list.get(0);
|
||||
this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
this.sensorManager.unregisterListener(this);
|
||||
}
|
||||
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
// We only care about the orientation as far as it refers to Magnetic North
|
||||
float heading = event.values[0];
|
||||
mAppView.loadUrl("javascript:navigator.compass.setHeading(" + heading + ")");
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import android.provider.Contacts.ContactMethods;
|
||||
import android.provider.Contacts.People;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.net.Uri;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ContactManager {
|
||||
|
||||
public class ContactTriplet
|
||||
{
|
||||
public String name = "";
|
||||
public String email = "";
|
||||
public String phone = "";
|
||||
}
|
||||
|
||||
private static final String LOG_TAG = "Contact Query";
|
||||
Activity mApp;
|
||||
WebView mView;
|
||||
Uri mPeople = android.provider.Contacts.People.CONTENT_URI;
|
||||
Uri mPhone = android.provider.Contacts.Phones.CONTENT_URI;
|
||||
Uri mEmail = android.provider.Contacts.ContactMethods.CONTENT_URI;
|
||||
|
||||
ContactManager(Activity app, WebView view)
|
||||
{
|
||||
mApp = app;
|
||||
mView = view;
|
||||
}
|
||||
|
||||
// This is to add backwards compatibility to the OLD Contacts API\
|
||||
public void getContactsAndSendBack()
|
||||
{
|
||||
String[] projection = new String[] {
|
||||
People._ID,
|
||||
People.NAME,
|
||||
People.NUMBER,
|
||||
People.PRIMARY_EMAIL_ID
|
||||
};
|
||||
|
||||
try{
|
||||
Cursor myCursor = mApp.managedQuery(mPeople, projection,
|
||||
null, null , People.NAME + " ASC");
|
||||
processResults(myCursor, true);
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
Log.d(LOG_TAG, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void search(String name, String npa, String email)
|
||||
{
|
||||
|
||||
if (email.length() > 0)
|
||||
searchByEmail(email);
|
||||
else
|
||||
searchPeople(name, npa);
|
||||
}
|
||||
|
||||
private void searchByEmail(String email)
|
||||
{
|
||||
String[] projection = new String[] {
|
||||
ContactMethods._ID,
|
||||
ContactMethods.DATA,
|
||||
ContactMethods.KIND,
|
||||
ContactMethods.PERSON_ID
|
||||
};
|
||||
String[] variables = new String[] {
|
||||
email
|
||||
};
|
||||
|
||||
try{
|
||||
Cursor myCursor = mApp.managedQuery(mEmail, projection,
|
||||
"contact_methods." + ContactMethods.DATA + " = ?" + "AND contact_methods.kind = 1", variables , ContactMethods.DATA + " ASC");
|
||||
getMethodData(myCursor);
|
||||
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
Log.d(LOG_TAG, ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void searchPeople(String name, String number)
|
||||
{
|
||||
String conditions = "";
|
||||
|
||||
if (name.length() == 0)
|
||||
{
|
||||
name = "%";
|
||||
conditions += People.NAME + " LIKE ? AND ";
|
||||
}
|
||||
else
|
||||
{
|
||||
conditions += People.NAME + " = ? AND ";
|
||||
}
|
||||
|
||||
if (number.length() == 0)
|
||||
number = "%";
|
||||
else
|
||||
{
|
||||
number = number.replace('+', '%');
|
||||
number = number.replace('.', '%');
|
||||
number = number.replace('-', '%');
|
||||
}
|
||||
|
||||
conditions += People.NUMBER + " LIKE ? ";
|
||||
|
||||
String[] projection = new String[] {
|
||||
People._ID,
|
||||
People.NAME,
|
||||
People.NUMBER,
|
||||
People.PRIMARY_EMAIL_ID
|
||||
};
|
||||
|
||||
String[] variables = new String[] {
|
||||
name, number
|
||||
};
|
||||
|
||||
try{
|
||||
Cursor myCursor = mApp.managedQuery(mPeople, projection,
|
||||
conditions, variables , People.NAME + " ASC");
|
||||
processResults(myCursor, false);
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
Log.d(LOG_TAG, ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processResults(Cursor cur, boolean all){
|
||||
|
||||
if (cur.moveToFirst()) {
|
||||
|
||||
String name;
|
||||
String phoneNumber;
|
||||
String email_id;
|
||||
String email;
|
||||
|
||||
int nameColumn = cur.getColumnIndex(People.NAME);
|
||||
int phoneColumn = cur.getColumnIndex(People.NUMBER);
|
||||
int emailIdColumn = cur.getColumnIndex(People.PRIMARY_EMAIL_ID);
|
||||
|
||||
do {
|
||||
// Get the field values
|
||||
name = cur.getString(nameColumn);
|
||||
phoneNumber = cur.getString(phoneColumn);
|
||||
email_id = cur.getString(emailIdColumn);
|
||||
if (email_id != null && email_id.length() > 0)
|
||||
email = getEmail(email_id);
|
||||
else
|
||||
email = "";
|
||||
|
||||
// Code for backwards compatibility with the OLD Contacts API
|
||||
if (all)
|
||||
mView.loadUrl("javascript:navigator.ContactManager.droidAddContact('" + name + "','" + phoneNumber + "','" + email +"')");
|
||||
else
|
||||
mView.loadUrl("javascript:navigator.contacts.droidFoundContact('" + name + "','" + phoneNumber + "','" + email +"')");
|
||||
|
||||
} while (cur.moveToNext());
|
||||
if (all)
|
||||
mView.loadUrl("javascript:navigator.ContactManager.droidDone()");
|
||||
else
|
||||
mView.loadUrl("javascript:navigator.contacts.droidDone();");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(all)
|
||||
mView.loadUrl("javascript:navigator.ContactManager.fail()");
|
||||
else
|
||||
mView.loadUrl("javascript:navigator.contacts.fail('None found!')");
|
||||
}
|
||||
}
|
||||
|
||||
private void getMethodData(Cursor cur)
|
||||
{
|
||||
ContactTriplet data = new ContactTriplet();
|
||||
String id;
|
||||
String email;
|
||||
|
||||
if (cur.moveToFirst()) {
|
||||
|
||||
int idColumn = cur.getColumnIndex(ContactMethods._ID);
|
||||
int emailColumn = cur.getColumnIndex(ContactMethods.DATA);
|
||||
do {
|
||||
// Get the field values
|
||||
id = cur.getString(idColumn);
|
||||
email = cur.getString(emailColumn);
|
||||
|
||||
data = getContactData(id);
|
||||
if(data != null)
|
||||
{
|
||||
data.email = email;
|
||||
mView.loadUrl("javascript:navigator.Contacts.droidFoundContact('" + data.name + "','" + data.phone + "','" + data.email +"')");
|
||||
}
|
||||
} while (cur.moveToNext());
|
||||
mView.loadUrl("javascript:navigator.contacts.droidDoneContacts();");
|
||||
}
|
||||
}
|
||||
|
||||
private ContactTriplet getContactData(String id) {
|
||||
ContactTriplet data = null;
|
||||
String[] projection = new String[] {
|
||||
People._ID,
|
||||
People.NAME,
|
||||
People.NUMBER,
|
||||
People.PRIMARY_EMAIL_ID
|
||||
};
|
||||
|
||||
String[] variables = new String[] {
|
||||
id
|
||||
};
|
||||
|
||||
try{
|
||||
Cursor myCursor = mApp.managedQuery(mPeople, projection,
|
||||
People.PRIMARY_EMAIL_ID + " = ?", variables , People.NAME + " ASC");
|
||||
data = getTriplet(myCursor);
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
Log.d(LOG_TAG, ex.getMessage());
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private ContactTriplet getTriplet(Cursor cur) {
|
||||
ContactTriplet data = new ContactTriplet();
|
||||
if (cur.moveToFirst()) {
|
||||
|
||||
int nameColumn = cur.getColumnIndex(People.NAME);
|
||||
int numberColumn = cur.getColumnIndex(People.NUMBER);
|
||||
do {
|
||||
|
||||
data.name = cur.getString(nameColumn);
|
||||
data.phone = cur.getString(numberColumn);
|
||||
|
||||
} while (cur.moveToNext());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private String getEmailColumnData(Cursor cur)
|
||||
{
|
||||
String email = "";
|
||||
if (cur != null && cur.moveToFirst()) {
|
||||
int emailColumn = cur.getColumnIndex(ContactMethods.DATA);
|
||||
do {
|
||||
// Get the field values
|
||||
email = cur.getString(emailColumn);
|
||||
} while (cur.moveToNext());
|
||||
}
|
||||
return email;
|
||||
}
|
||||
|
||||
private String getEmail(String id)
|
||||
{
|
||||
String email = "";
|
||||
String[] projection = new String[] {
|
||||
ContactMethods._ID,
|
||||
ContactMethods.DATA,
|
||||
ContactMethods.KIND
|
||||
};
|
||||
String[] variables = new String[] {
|
||||
id
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
Cursor myCursor = mApp.managedQuery(mEmail, projection,
|
||||
"contact_methods." + ContactMethods._ID + " = ?" + " AND contact_methods.kind = 1", variables , ContactMethods.DATA + " ASC");
|
||||
email = getEmailColumnData(myCursor);
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
Log.d(LOG_TAG, ex.getMessage());
|
||||
}
|
||||
|
||||
return email;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class CryptoHandler {
|
||||
|
||||
WebView mView;
|
||||
|
||||
CryptoHandler(WebView view)
|
||||
{
|
||||
mView = view;
|
||||
}
|
||||
|
||||
public void encrypt(String pass, String text)
|
||||
{
|
||||
try {
|
||||
String encrypted = SimpleCrypto.encrypt(pass,text);
|
||||
mView.loadUrl("javascript:Crypto.gotCryptedString('" + text + "')");
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void decrypt(String pass, String text)
|
||||
{
|
||||
try {
|
||||
String decrypted = SimpleCrypto.decrypt(pass,text);
|
||||
mView.loadUrl("javascript:Crypto.gotPlainString('" + text + "')");
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.os.StatFs;
|
||||
import android.util.Log;
|
||||
|
||||
public class DirectoryManager {
|
||||
|
||||
protected boolean testFileExists (String name){
|
||||
boolean status;
|
||||
if ((testSaveLocationExists())&&(!name.equals(""))){
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
File newPath = constructFilePaths(path.toString(), name);
|
||||
status = newPath.exists();
|
||||
}else{
|
||||
status = false;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
protected long getFreeDiskSpace(){
|
||||
/*
|
||||
* gets the available SD card free space or returns -1 if the SD card is not mounted.
|
||||
*/
|
||||
String status = Environment.getExternalStorageState();
|
||||
long freeSpace = 0;
|
||||
if (status.equals(Environment.MEDIA_MOUNTED)) {
|
||||
try {
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
StatFs stat = new StatFs(path.getPath());
|
||||
long blockSize = stat.getBlockSize();
|
||||
long availableBlocks = stat.getAvailableBlocks();
|
||||
freeSpace = availableBlocks*blockSize/1024;
|
||||
} catch (Exception e) {e.printStackTrace(); }
|
||||
} else { return -1; }
|
||||
return (freeSpace);
|
||||
}
|
||||
|
||||
protected boolean createDirectory(String directoryName){
|
||||
boolean status;
|
||||
if ((testSaveLocationExists())&&(!directoryName.equals(""))){
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
File newPath = constructFilePaths(path.toString(), directoryName);
|
||||
status = newPath.mkdir();
|
||||
status = true;
|
||||
}else
|
||||
status = false;
|
||||
return status;
|
||||
}
|
||||
|
||||
protected boolean testSaveLocationExists(){
|
||||
String sDCardStatus = Environment.getExternalStorageState();
|
||||
boolean status;
|
||||
if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)){
|
||||
status = true;
|
||||
}else
|
||||
status = false;
|
||||
return status;
|
||||
}
|
||||
|
||||
protected boolean deleteDirectory(String fileName){
|
||||
boolean status;
|
||||
SecurityManager checker = new SecurityManager();
|
||||
|
||||
if ((testSaveLocationExists())&&(!fileName.equals(""))){
|
||||
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
File newPath = constructFilePaths(path.toString(), fileName);
|
||||
checker.checkDelete(newPath.toString());
|
||||
if(newPath.isDirectory()){
|
||||
String[] listfile = newPath.list();
|
||||
// delete all files within the specified directory and then delete the directory
|
||||
try{
|
||||
for (int i=0; i < listfile.length; i++){
|
||||
File deletedFile = new File (newPath.toString()+"/"+listfile[i].toString());
|
||||
deletedFile.delete();
|
||||
}
|
||||
newPath.delete();
|
||||
Log.i("DirectoryManager deleteDirectory", fileName);
|
||||
status = true;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
status = false;
|
||||
}
|
||||
|
||||
}else
|
||||
status = false;
|
||||
}else
|
||||
status = false;
|
||||
return status;
|
||||
}
|
||||
|
||||
protected boolean deleteFile(String fileName){
|
||||
boolean status;
|
||||
SecurityManager checker = new SecurityManager();
|
||||
|
||||
if ((testSaveLocationExists())&&(!fileName.equals(""))){
|
||||
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
File newPath = constructFilePaths(path.toString(), fileName);
|
||||
checker.checkDelete(newPath.toString());
|
||||
if (newPath.isFile()){
|
||||
try {
|
||||
Log.i("DirectoryManager deleteFile", fileName);
|
||||
newPath.delete();
|
||||
status = true;
|
||||
}catch (SecurityException se){
|
||||
se.printStackTrace();
|
||||
status = false;
|
||||
}
|
||||
}else
|
||||
status = false;
|
||||
}else
|
||||
status = false;
|
||||
return status;
|
||||
}
|
||||
|
||||
private File constructFilePaths (String file1, String file2){
|
||||
File newPath;
|
||||
newPath = new File(file1+"/"+file2);
|
||||
return newPath;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,374 +0,0 @@
|
||||
package com.phonegap;
|
||||
/* License (MIT)
|
||||
* Copyright (c) 2008 Nitobi
|
||||
* website: http://phonegap.com
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* Software), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JsResult;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebStorage;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||
import android.widget.LinearLayout;
|
||||
import android.os.Build.*;
|
||||
|
||||
public class DroidGap extends Activity {
|
||||
|
||||
private static final String LOG_TAG = "DroidGap";
|
||||
protected WebView appView;
|
||||
private LinearLayout root;
|
||||
|
||||
private PhoneGap gap;
|
||||
private GeoBroker geo;
|
||||
private AccelBroker accel;
|
||||
private CameraLauncher launcher;
|
||||
private ContactManager mContacts;
|
||||
private FileUtils fs;
|
||||
private NetworkManager netMan;
|
||||
private CompassListener mCompass;
|
||||
private Storage cupcakeStorage;
|
||||
private CryptoHandler crypto;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||
// This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket!
|
||||
|
||||
LinearLayout.LayoutParams containerParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT, 0.0F);
|
||||
|
||||
LinearLayout.LayoutParams webviewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT, 1.0F);
|
||||
|
||||
root = new LinearLayout(this);
|
||||
root.setOrientation(LinearLayout.VERTICAL);
|
||||
root.setBackgroundColor(Color.BLACK);
|
||||
root.setLayoutParams(containerParams);
|
||||
|
||||
appView = new WebView(this);
|
||||
appView.setLayoutParams(webviewParams);
|
||||
|
||||
WebViewReflect.checkCompatibility();
|
||||
|
||||
if (android.os.Build.VERSION.RELEASE.startsWith("2."))
|
||||
appView.setWebChromeClient(new EclairClient(this));
|
||||
else
|
||||
{
|
||||
appView.setWebChromeClient(new GapClient(this));
|
||||
}
|
||||
|
||||
appView.setWebViewClient(new GapViewClient(this));
|
||||
|
||||
appView.setInitialScale(100);
|
||||
appView.setVerticalScrollBarEnabled(false);
|
||||
|
||||
WebSettings settings = appView.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||
settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
|
||||
|
||||
Package pack = this.getClass().getPackage();
|
||||
String appPackage = pack.getName();
|
||||
|
||||
WebViewReflect.setStorage(settings, true, "/data/data/" + appPackage + "/app_database/");
|
||||
|
||||
// Turn on DOM storage!
|
||||
WebViewReflect.setDomStorage(settings);
|
||||
// Turn off native geolocation object in browser - we use our own :)
|
||||
WebViewReflect.setGeolocationEnabled(settings, false);
|
||||
/* Bind the appView object to the gap class methods */
|
||||
bindBrowser(appView);
|
||||
if(cupcakeStorage != null)
|
||||
cupcakeStorage.setStorage(appPackage);
|
||||
|
||||
root.addView(appView);
|
||||
|
||||
setContentView(root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
//don't reload the current page when the orientation is changed
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
private void bindBrowser(WebView appView)
|
||||
{
|
||||
gap = new PhoneGap(this, appView);
|
||||
geo = new GeoBroker(appView, this);
|
||||
accel = new AccelBroker(appView, this);
|
||||
launcher = new CameraLauncher(appView, this);
|
||||
mContacts = new ContactManager(this, appView);
|
||||
fs = new FileUtils(appView);
|
||||
netMan = new NetworkManager(this, appView);
|
||||
mCompass = new CompassListener(this, appView);
|
||||
crypto = new CryptoHandler(appView);
|
||||
|
||||
// This creates the new javascript interfaces for PhoneGap
|
||||
appView.addJavascriptInterface(gap, "DroidGap");
|
||||
appView.addJavascriptInterface(geo, "Geo");
|
||||
appView.addJavascriptInterface(accel, "Accel");
|
||||
appView.addJavascriptInterface(launcher, "GapCam");
|
||||
appView.addJavascriptInterface(mContacts, "ContactHook");
|
||||
appView.addJavascriptInterface(fs, "FileUtil");
|
||||
appView.addJavascriptInterface(netMan, "NetworkManager");
|
||||
appView.addJavascriptInterface(mCompass, "CompassHook");
|
||||
appView.addJavascriptInterface(crypto, "GapCrypto");
|
||||
|
||||
|
||||
if (android.os.Build.VERSION.RELEASE.startsWith("1."))
|
||||
{
|
||||
cupcakeStorage = new Storage(appView);
|
||||
appView.addJavascriptInterface(cupcakeStorage, "droidStorage");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void loadUrl(String url)
|
||||
{
|
||||
appView.loadUrl(url);
|
||||
}
|
||||
|
||||
public class GapViewClient extends WebViewClient {
|
||||
|
||||
Context mCtx;
|
||||
|
||||
public GapViewClient(Context ctx)
|
||||
{
|
||||
mCtx = ctx;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see android.webkit.WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView, java.lang.String)
|
||||
*
|
||||
* Note: Since we override it to make sure that we are using PhoneGap and not some other bullshit
|
||||
* viewer that may or may not exist, we need to make sure that http:// and tel:// still work.
|
||||
*
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
// TODO: See about using a switch statement
|
||||
if (url.startsWith("http://"))
|
||||
{
|
||||
Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
startActivity(browse);
|
||||
return true;
|
||||
}
|
||||
else if(url.startsWith("tel://"))
|
||||
{
|
||||
Intent dial = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
|
||||
startActivity(dial);
|
||||
return true;
|
||||
}
|
||||
else if(url.startsWith("sms:"))
|
||||
{
|
||||
Uri smsUri = Uri.parse(url);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, smsUri);
|
||||
intent.setType("vnd.android-dir/mms-sms");
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
view.loadUrl(url);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides a hook for calling "alert" from javascript. Useful for
|
||||
* debugging your javascript.
|
||||
*/
|
||||
public class GapClient extends WebChromeClient {
|
||||
|
||||
Context mCtx;
|
||||
public GapClient(Context ctx)
|
||||
{
|
||||
mCtx = ctx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
|
||||
Log.d(LOG_TAG, message);
|
||||
// This shows the dialog box. This can be commented out for dev
|
||||
AlertDialog.Builder alertBldr = new AlertDialog.Builder(mCtx);
|
||||
GapOKDialog okHook = new GapOKDialog();
|
||||
GapCancelDialog cancelHook = new GapCancelDialog();
|
||||
alertBldr.setMessage(message);
|
||||
alertBldr.setTitle("Alert");
|
||||
alertBldr.setCancelable(true);
|
||||
alertBldr.setPositiveButton("OK", okHook);
|
||||
alertBldr.setNegativeButton("Cancel", cancelHook);
|
||||
alertBldr.show();
|
||||
result.confirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the Code for the OK Button
|
||||
*/
|
||||
|
||||
public class GapOKDialog implements DialogInterface.OnClickListener {
|
||||
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class GapCancelDialog implements DialogInterface.OnClickListener {
|
||||
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// TODO Auto-generated method stub
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public final class EclairClient extends GapClient
|
||||
{
|
||||
private String TAG = "PhoneGapLog";
|
||||
private long MAX_QUOTA = 100 * 1024 * 1024;
|
||||
|
||||
public EclairClient(Context ctx) {
|
||||
super(ctx);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
|
||||
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
|
||||
{
|
||||
Log.d(TAG, "event raised onExceededDatabaseQuota estimatedSize: " + Long.toString(estimatedSize) + " currentQuota: " + Long.toString(currentQuota) + " totalUsedQuota: " + Long.toString(totalUsedQuota));
|
||||
|
||||
if( estimatedSize < MAX_QUOTA)
|
||||
{
|
||||
//increase for 1Mb
|
||||
long newQuota = currentQuota + 1024*1024;
|
||||
Log.d(TAG, "calling quotaUpdater.updateQuota newQuota: " + Long.toString(newQuota) );
|
||||
quotaUpdater.updateQuota(newQuota);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the quota to whatever it is and force an error
|
||||
// TODO: get docs on how to handle this properly
|
||||
quotaUpdater.updateQuota(currentQuota);
|
||||
}
|
||||
}
|
||||
|
||||
// This is a test of console.log, because we don't have this in Android 2.01
|
||||
public void addMessageToConsole(String message, int lineNumber, String sourceID)
|
||||
{
|
||||
Log.d(TAG, sourceID + ": Line " + Integer.toString(lineNumber) + " : " + message);
|
||||
}
|
||||
|
||||
// console.log in api level 7: http://developer.android.com/guide/developing/debug-tasks.html
|
||||
public void onConsoleMessage(String message, int lineNumber, String sourceID)
|
||||
{
|
||||
Log.d(TAG, sourceID + ": Line " + Integer.toString(lineNumber) + " : " + message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
String testUrl = appView.getUrl();
|
||||
appView.goBack();
|
||||
if(appView.getUrl() == testUrl)
|
||||
{
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU)
|
||||
{
|
||||
appView.loadUrl("javascript:keyEvent.menuTrigger()");
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_SEARCH)
|
||||
{
|
||||
appView.loadUrl("javascript:keyEvent.searchTrigger()");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is required to start the camera activity! It has to come from the previous activity
|
||||
public void startCamera(int quality)
|
||||
{
|
||||
Intent i = new Intent(this, CameraPreview.class);
|
||||
i.setAction("android.intent.action.PICK");
|
||||
i.putExtra("quality", quality);
|
||||
startActivityForResult(i, 0);
|
||||
}
|
||||
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent)
|
||||
{
|
||||
String data;
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
if (resultCode == RESULT_OK)
|
||||
{
|
||||
data = intent.getStringExtra("picture");
|
||||
// Send the graphic back to the class that needs it
|
||||
launcher.processPicture(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
launcher.failPicture("Did not complete!");
|
||||
}
|
||||
}
|
||||
|
||||
public WebView getView()
|
||||
{
|
||||
return this.appView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
|
||||
WebView mView;
|
||||
DirectoryManager fileManager;
|
||||
FileReader f_in;
|
||||
FileWriter f_out;
|
||||
|
||||
FileUtils(WebView view)
|
||||
{
|
||||
mView = view;
|
||||
}
|
||||
|
||||
public int testSaveLocationExists(){
|
||||
if (fileManager.testSaveLocationExists())
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public long getFreeDiskSpace(){
|
||||
long freeDiskSpace=fileManager.getFreeDiskSpace();
|
||||
return freeDiskSpace;
|
||||
}
|
||||
|
||||
public int testFileExists(String file){
|
||||
if (fileManager.testFileExists(file))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int testDirectoryExists(String file){
|
||||
if (fileManager.testFileExists(file))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a specific directory.
|
||||
* Everyting in side the directory would be gone.
|
||||
* TODO: JavaScript Call backs for success and error handling
|
||||
*/
|
||||
public int deleteDirectory (String dir){
|
||||
if (fileManager.deleteDirectory(dir))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a specific file.
|
||||
* TODO: JavaScript Call backs for success and error handling
|
||||
*/
|
||||
public int deleteFile (String file){
|
||||
if (fileManager.deleteFile(file))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new directory.
|
||||
* TODO: JavaScript Call backs for success and error handling
|
||||
*/
|
||||
public int createDirectory(String dir){
|
||||
if (fileManager.createDirectory(dir))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
public String read(String filename)
|
||||
{
|
||||
String data = "";
|
||||
String output = "";
|
||||
try {
|
||||
FileInputStream fstream = new FileInputStream(filename);
|
||||
DataInputStream in = new DataInputStream(fstream);
|
||||
while (in.available() !=0)
|
||||
{
|
||||
data += in.readLine();
|
||||
}
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
data = "FAIL: File not found";
|
||||
} catch (IOException e) {
|
||||
data = "FAIL: IO ERROR";
|
||||
}
|
||||
|
||||
//mView.loadUrl("javascript:navigator.FileReader.hasRead('" + data + "')");
|
||||
return data;
|
||||
}
|
||||
|
||||
public int write(String filename, String data, boolean append)
|
||||
{
|
||||
String FilePath= filename;
|
||||
try {
|
||||
byte [] rawData = data.getBytes();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(rawData);
|
||||
FileOutputStream out= new FileOutputStream(FilePath, append);
|
||||
byte buff[] = new byte[rawData.length];
|
||||
in.read(buff, 0, buff.length);
|
||||
out.write(buff, 0, rawData.length);
|
||||
out.flush();
|
||||
out.close();
|
||||
//mView.loadUrl("javascript:navigator.FileReader.onsuccess('File written')");
|
||||
} catch (Exception e) {
|
||||
//mView.loadUrl("javascript:navigator.FileReader.onerror('Fail')");
|
||||
// So, do we just return -1 at this point!
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.webkit.WebView;
|
||||
|
||||
/*
|
||||
* This class is the interface to the Geolocation. It's bound to the geo object.
|
||||
*
|
||||
* This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener
|
||||
*/
|
||||
|
||||
public class GeoBroker {
|
||||
private WebView mAppView;
|
||||
private Context mCtx;
|
||||
private HashMap<String, GeoListener> geoListeners;
|
||||
|
||||
public GeoBroker(WebView view, Context ctx)
|
||||
{
|
||||
mCtx = ctx;
|
||||
mAppView = view;
|
||||
geoListeners = new HashMap<String, GeoListener>();
|
||||
}
|
||||
|
||||
public void getCurrentLocation()
|
||||
{
|
||||
GeoListener listener = new GeoListener("global", mCtx, 10000, mAppView);
|
||||
Location loc = listener.getCurrentLocation();
|
||||
String params = loc.getLatitude() + "," + loc.getLongitude() + ", " + loc.getAltitude() + "," + loc.getAccuracy() + "," + loc.getBearing();
|
||||
params += "," + loc.getSpeed() + "," + loc.getTime();
|
||||
mAppView.loadUrl("javascript:navigator.geolocation.gotCurrentPosition(" + params + ")");
|
||||
listener.stop();
|
||||
}
|
||||
|
||||
public String start(int freq, String key)
|
||||
{
|
||||
GeoListener listener = new GeoListener(key, mCtx, freq, mAppView);
|
||||
geoListeners.put(key, listener);
|
||||
return key;
|
||||
}
|
||||
|
||||
public void stop(String key)
|
||||
{
|
||||
GeoListener geo = geoListeners.get(key);
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class GeoListener {
|
||||
String id;
|
||||
String successCallback;
|
||||
String failCallback;
|
||||
GpsListener mGps;
|
||||
NetworkListener mNetwork;
|
||||
LocationManager mLocMan;
|
||||
Context mCtx;
|
||||
private WebView mAppView;
|
||||
|
||||
int interval;
|
||||
|
||||
GeoListener(String i, Context ctx, int time, WebView appView)
|
||||
{
|
||||
id = i;
|
||||
interval = time;
|
||||
mCtx = ctx;
|
||||
mGps = null;
|
||||
mNetwork = null;
|
||||
mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
if (mLocMan.getProvider(LocationManager.GPS_PROVIDER) != null)
|
||||
mGps = new GpsListener(mCtx, interval, this);
|
||||
if (mLocMan.getProvider(LocationManager.NETWORK_PROVIDER) != null)
|
||||
mNetwork = new NetworkListener(mCtx, interval, this);
|
||||
mAppView = appView;
|
||||
}
|
||||
|
||||
void success(Location loc)
|
||||
{
|
||||
/*
|
||||
* We only need to figure out what we do when we succeed!
|
||||
*/
|
||||
|
||||
String params;
|
||||
/*
|
||||
* Build the giant string to send back to Javascript!
|
||||
*/
|
||||
params = loc.getLatitude() + "," + loc.getLongitude() + ", " + loc.getAltitude() + "," + loc.getAccuracy() + "," + loc.getBearing();
|
||||
params += "," + loc.getSpeed() + "," + loc.getTime();
|
||||
if(id != "global")
|
||||
{
|
||||
mAppView.loadUrl("javascript:navigator._geo.success(" + id + "," + params + ")");
|
||||
}
|
||||
}
|
||||
|
||||
void fail()
|
||||
{
|
||||
// Do we need to know why? How would we handle this?
|
||||
if (id != "global") {
|
||||
mAppView.loadUrl("javascript:navigator._geo.fail(" + id + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
mAppView.loadUrl("javascript:navigator._geo.fail()");
|
||||
}
|
||||
}
|
||||
|
||||
// This stops the listener
|
||||
void stop()
|
||||
{
|
||||
if(mGps != null)
|
||||
mGps.stop();
|
||||
if(mNetwork != null)
|
||||
mNetwork.stop();
|
||||
}
|
||||
|
||||
public Location getCurrentLocation() {
|
||||
Location loc = null;
|
||||
if (mGps != null)
|
||||
loc = mGps.getLocation();
|
||||
if (loc == null && mNetwork != null)
|
||||
loc = mNetwork.getLocation();
|
||||
if(loc == null)
|
||||
loc = new Location(LocationManager.NETWORK_PROVIDER);
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.phonegap;
|
||||
/* License (MIT)
|
||||
* Copyright (c) 2008 Nitobi
|
||||
* website: http://phonegap.com
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* “Software”), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.location.LocationListener;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
public class GpsListener implements LocationListener {
|
||||
|
||||
private Context mCtx;
|
||||
private Location cLoc;
|
||||
private LocationManager mLocMan;
|
||||
private static final String LOG_TAG = "PhoneGap";
|
||||
private GeoListener owner;
|
||||
private boolean hasData = false;
|
||||
|
||||
public GpsListener(Context ctx, int interval, GeoListener m)
|
||||
{
|
||||
owner = m;
|
||||
mCtx = ctx;
|
||||
mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE);
|
||||
mLocMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, interval, 0, this);
|
||||
cLoc = mLocMan.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
cLoc = mLocMan.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
hasData = true;
|
||||
return cLoc;
|
||||
}
|
||||
|
||||
public void onProviderDisabled(String provider) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d(LOG_TAG, "The provider " + provider + " is disabled");
|
||||
owner.fail();
|
||||
}
|
||||
|
||||
public void onProviderEnabled(String provider) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d(LOG_TAG, "The provider "+ provider + " is enabled");
|
||||
}
|
||||
|
||||
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d(LOG_TAG, "The status of the provider " + provider + " has changed");
|
||||
if(status == 0)
|
||||
{
|
||||
Log.d(LOG_TAG, provider + " is OUT OF SERVICE");
|
||||
owner.fail();
|
||||
}
|
||||
else if(status == 1)
|
||||
{
|
||||
Log.d(LOG_TAG, provider + " is TEMPORARILY_UNAVAILABLE");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(LOG_TAG, provider + " is Available");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onLocationChanged(Location location) {
|
||||
Log.d(LOG_TAG, "The location has been updated!");
|
||||
owner.success(location);
|
||||
}
|
||||
|
||||
public boolean hasLocation() {
|
||||
return hasData;
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
mLocMan.removeUpdates(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
|
||||
public class HttpHandler {
|
||||
|
||||
protected Boolean get(String url, String file)
|
||||
{
|
||||
HttpEntity entity = getHttpEntity(url);
|
||||
try {
|
||||
writeToDisk(entity, file);
|
||||
} catch (Exception e) { e.printStackTrace(); return false; }
|
||||
try {
|
||||
entity.consumeContent();
|
||||
} catch (Exception e) { e.printStackTrace(); return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
private HttpEntity getHttpEntity(String url)
|
||||
/**
|
||||
* get the http entity at a given url
|
||||
*/
|
||||
{
|
||||
HttpEntity entity=null;
|
||||
try {
|
||||
DefaultHttpClient httpclient = new DefaultHttpClient();
|
||||
HttpGet httpget = new HttpGet(url);
|
||||
HttpResponse response = httpclient.execute(httpget);
|
||||
entity = response.getEntity();
|
||||
} catch (Exception e) { e.printStackTrace(); return null; }
|
||||
return entity;
|
||||
}
|
||||
|
||||
private void writeToDisk(HttpEntity entity, String file) throws EOFException
|
||||
/**
|
||||
* writes a HTTP entity to the specified filename and location on disk
|
||||
*/
|
||||
{
|
||||
int i=0;
|
||||
String FilePath="/sdcard/" + file;
|
||||
try {
|
||||
InputStream in = entity.getContent();
|
||||
byte buff[] = new byte[1024];
|
||||
FileOutputStream out=
|
||||
new FileOutputStream(FilePath);
|
||||
do {
|
||||
int numread = in.read(buff);
|
||||
if (numread <= 0)
|
||||
break;
|
||||
out.write(buff, 0, numread);
|
||||
System.out.println("numread" + numread);
|
||||
i++;
|
||||
} while (true);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) { e.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.phonegap;
|
||||
/* License (MIT)
|
||||
* Copyright (c) 2008 Nitobi
|
||||
* website: http://phonegap.com
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* “Software”), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.location.LocationListener;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
public class NetworkListener implements LocationListener {
|
||||
|
||||
private Context mCtx;
|
||||
private Location cLoc;
|
||||
private LocationManager mLocMan;
|
||||
private static final String LOG_TAG = "PhoneGap";
|
||||
GeoListener owner;
|
||||
|
||||
public NetworkListener(Context ctx, int interval, GeoListener m)
|
||||
{
|
||||
owner = m;
|
||||
mCtx = ctx;
|
||||
mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE);
|
||||
mLocMan.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, interval, 0, this);
|
||||
cLoc = mLocMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
cLoc = mLocMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
return cLoc;
|
||||
}
|
||||
|
||||
public void onProviderDisabled(String provider) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d(LOG_TAG, "The provider " + provider + " is disabled");
|
||||
}
|
||||
|
||||
|
||||
public void onProviderEnabled(String provider) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d(LOG_TAG, "The provider "+ provider + " is enabled");
|
||||
}
|
||||
|
||||
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.d(LOG_TAG, "The status of the provider " + provider + " has changed");
|
||||
if(status == 0)
|
||||
{
|
||||
Log.d(LOG_TAG, provider + " is OUT OF SERVICE");
|
||||
}
|
||||
else if(status == 1)
|
||||
{
|
||||
Log.d(LOG_TAG, provider + " is TEMPORARILY_UNAVAILABLE");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d(LOG_TAG, provider + " is Available");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The GPS is the primary form of Geolocation in PhoneGap. Only fire the success variables if the GPS is down
|
||||
* for some reason
|
||||
*/
|
||||
public void onLocationChanged(Location location) {
|
||||
Log.d(LOG_TAG, "The location has been updated!");
|
||||
if (!owner.mGps.hasLocation())
|
||||
{
|
||||
owner.success(location);
|
||||
}
|
||||
cLoc = location;
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
mLocMan.removeUpdates(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.*;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class NetworkManager {
|
||||
|
||||
Context mCtx;
|
||||
WebView mView;
|
||||
ConnectivityManager sockMan;
|
||||
|
||||
NetworkManager(Context ctx, WebView view)
|
||||
{
|
||||
mCtx = ctx;
|
||||
mView = view;
|
||||
sockMan = (ConnectivityManager) mCtx.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
}
|
||||
|
||||
public boolean isAvailable()
|
||||
{
|
||||
NetworkInfo info = sockMan.getActiveNetworkInfo();
|
||||
boolean conn = false;
|
||||
if(info != null)
|
||||
conn = info.isConnected();
|
||||
return conn;
|
||||
}
|
||||
|
||||
public boolean isWifiActive()
|
||||
{
|
||||
NetworkInfo info = sockMan.getActiveNetworkInfo();
|
||||
if(info != null)
|
||||
{
|
||||
String type = info.getTypeName();
|
||||
return type.equals("WIFI");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isReachable(String uri)
|
||||
{
|
||||
if (uri.indexOf("http://") == -1)
|
||||
uri = "http://" + uri;
|
||||
boolean reached = isAvailable();
|
||||
try {
|
||||
DefaultHttpClient httpclient = new DefaultHttpClient();
|
||||
HttpGet httpget = new HttpGet(uri);
|
||||
httpclient.execute(httpget);
|
||||
} catch (Exception e) {
|
||||
reached = false;
|
||||
}
|
||||
return reached;
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
package com.phonegap;
|
||||
/* License (MIT)
|
||||
* Copyright (c) 2008 Nitobi
|
||||
* website: http://phonegap.com
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* Software), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import java.util.TimeZone;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.IntentFilter;
|
||||
import android.hardware.SensorManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.webkit.WebView;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
|
||||
public class PhoneGap{
|
||||
|
||||
private static final String LOG_TAG = "PhoneGap";
|
||||
/*
|
||||
* UUID, version and availability
|
||||
*/
|
||||
public boolean droid = true;
|
||||
public static String version = "0.9.99999";
|
||||
public static String platform = "Android";
|
||||
public static String uuid;
|
||||
private Context mCtx;
|
||||
private WebView mAppView;
|
||||
AudioHandler audio;
|
||||
|
||||
public PhoneGap(Context ctx, WebView appView) {
|
||||
this.mCtx = ctx;
|
||||
this.mAppView = appView;
|
||||
audio = new AudioHandler("/sdcard/tmprecording.mp3", ctx);
|
||||
uuid = getUuid();
|
||||
}
|
||||
|
||||
public void beep(long pattern)
|
||||
{
|
||||
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
Ringtone notification = RingtoneManager.getRingtone(mCtx, ringtone);
|
||||
for (long i = 0; i < pattern; ++i)
|
||||
{
|
||||
notification.play();
|
||||
}
|
||||
}
|
||||
|
||||
public void vibrate(long pattern){
|
||||
// Start the vibration, 0 defaults to half a second.
|
||||
if (pattern == 0)
|
||||
pattern = 500;
|
||||
Vibrator vibrator = (Vibrator) mCtx.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(pattern);
|
||||
}
|
||||
|
||||
public String getPlatform()
|
||||
{
|
||||
return this.platform;
|
||||
}
|
||||
|
||||
public String getUuid()
|
||||
{
|
||||
//TelephonyManager operator = (TelephonyManager) mCtx.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
//String uuid = operator.getDeviceId();
|
||||
String uuid = Settings.Secure.getString(mCtx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public String getLine1Number(){
|
||||
TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return operator.getLine1Number();
|
||||
}
|
||||
public String getDeviceId(){
|
||||
TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return operator.getDeviceId();
|
||||
}
|
||||
public String getSimSerialNumber(){
|
||||
TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return operator.getSimSerialNumber();
|
||||
}
|
||||
public String getSubscriberId(){
|
||||
TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return operator.getSubscriberId();
|
||||
}
|
||||
|
||||
public String getModel()
|
||||
{
|
||||
String model = android.os.Build.MODEL;
|
||||
return model;
|
||||
}
|
||||
public String getProductName()
|
||||
{
|
||||
String productname = android.os.Build.PRODUCT;
|
||||
return productname;
|
||||
}
|
||||
public String getOSVersion()
|
||||
{
|
||||
String osversion = android.os.Build.VERSION.RELEASE;
|
||||
return osversion;
|
||||
}
|
||||
public String getSDKVersion()
|
||||
{
|
||||
String sdkversion = android.os.Build.VERSION.SDK;
|
||||
return sdkversion;
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public void httpGet(String url, String file)
|
||||
/**
|
||||
* grabs a file from specified url and saves it to a name and location
|
||||
* the base directory /sdcard is abstracted so that paths may be the same from one mobile OS to another
|
||||
* TODO: JavaScript call backs and error handling
|
||||
*/
|
||||
{
|
||||
HttpHandler http = new HttpHandler();
|
||||
http.get(url, file);
|
||||
}
|
||||
|
||||
/**
|
||||
* AUDIO
|
||||
* TODO: Basic functions done but needs more work on error handling and call backs, remove record hack
|
||||
*/
|
||||
|
||||
public void startRecordingAudio(String file)
|
||||
{
|
||||
/* for this to work the recording needs to be specified in the constructor,
|
||||
* a hack to get around this, I'm moving the recording after it's complete
|
||||
*/
|
||||
audio.startRecording(file);
|
||||
}
|
||||
|
||||
public void stopRecordingAudio()
|
||||
{
|
||||
audio.stopRecording();
|
||||
}
|
||||
|
||||
public void startPlayingAudio(String file)
|
||||
{
|
||||
audio.startPlaying(file);
|
||||
}
|
||||
|
||||
public void stopPlayingAudio()
|
||||
{
|
||||
audio.stopPlaying();
|
||||
}
|
||||
|
||||
public long getCurrentPositionAudio()
|
||||
{
|
||||
System.out.println(audio.getCurrentPosition());
|
||||
return(audio.getCurrentPosition());
|
||||
}
|
||||
|
||||
public long getDurationAudio(String file)
|
||||
{
|
||||
System.out.println(audio.getDuration(file));
|
||||
return(audio.getDuration(file));
|
||||
}
|
||||
|
||||
public void setAudioOutputDevice(int output){
|
||||
audio.setAudioOutputDevice(output);
|
||||
}
|
||||
|
||||
public int getAudioOutputDevice(){
|
||||
return audio.getAudioOutputDevice();
|
||||
}
|
||||
|
||||
public String getTimeZoneID() {
|
||||
TimeZone tz = TimeZone.getDefault();
|
||||
return(tz.getID());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Code originally found on Android Snippets
|
||||
* Contributed to snippets Ferenc Hechler
|
||||
* Copyright (c) 2009 Ferenc Hechler
|
||||
*/
|
||||
|
||||
package com.phonegap;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
public class SimpleCrypto {
|
||||
|
||||
public static String encrypt(String seed, String cleartext) throws Exception {
|
||||
byte[] rawKey = getRawKey(seed.getBytes());
|
||||
byte[] result = encrypt(rawKey, cleartext.getBytes());
|
||||
return toHex(result);
|
||||
}
|
||||
|
||||
public static String decrypt(String seed, String encrypted) throws Exception {
|
||||
byte [] rawKey = getRawKey(seed.getBytes());
|
||||
byte [] enc = toByte(encrypted);
|
||||
byte [] result = decrypt(rawKey, enc);
|
||||
return new String(result);
|
||||
}
|
||||
|
||||
public static byte[] getRawKey(byte [] seed) throws Exception {
|
||||
KeyGenerator kgen = KeyGenerator.getInstance("AES");
|
||||
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
|
||||
sr.setSeed(seed);
|
||||
kgen.init(128, sr);
|
||||
SecretKey skey = kgen.generateKey();
|
||||
byte[] raw = skey.getEncoded();
|
||||
return raw;
|
||||
}
|
||||
|
||||
private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception {
|
||||
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
|
||||
byte[] encrypted = cipher.doFinal(clear);
|
||||
return encrypted;
|
||||
}
|
||||
|
||||
private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception {
|
||||
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES");
|
||||
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
|
||||
byte[] decrypted = cipher.doFinal(encrypted);
|
||||
return decrypted;
|
||||
}
|
||||
|
||||
public static String toHex(String txt)
|
||||
{
|
||||
return toHex(txt.getBytes());
|
||||
}
|
||||
|
||||
public static String fromHex(String hex)
|
||||
{
|
||||
return new String(toByte(hex));
|
||||
}
|
||||
|
||||
public static byte[] toByte(String hexString) {
|
||||
int len = hexString.length()/2;
|
||||
byte[] result = new byte[len];
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
result[i] = Integer.valueOf(hexString.substring(2*i, 2*i+2), 16).byteValue();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String toHex(byte[] buf) {
|
||||
if (buf == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
StringBuffer result = new StringBuffer(2*buf.length);
|
||||
for (int i = 0; i < buf.length; i++)
|
||||
{
|
||||
appendHex(result, buf[i]);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private final static String HEX = "01234567890ABCDEF";
|
||||
|
||||
private static void appendHex(StringBuffer sb, byte b)
|
||||
{
|
||||
sb.append(HEX.charAt((b>>4)&0x0f)).append(HEX.charAt(b&0x0f));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class StandAlone extends DroidGap {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
super.loadUrl("file:///android_asset/www/index.html");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.*;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class Storage {
|
||||
|
||||
private static final String LOG_TAG = "SQLite Storage:";
|
||||
SQLiteDatabase myDb;
|
||||
String path;
|
||||
String txid = "";
|
||||
WebView appView;
|
||||
Context mCtx;
|
||||
|
||||
Storage(WebView view)
|
||||
{
|
||||
appView = view;
|
||||
}
|
||||
|
||||
public void setStorage(String appPackage)
|
||||
{
|
||||
path = "/data/data/" + appPackage + "/databases/";
|
||||
}
|
||||
|
||||
public void openDatabase(String db, String version, String display_name, long size)
|
||||
{
|
||||
if (path != null)
|
||||
{
|
||||
path += db + ".db";
|
||||
myDb = SQLiteDatabase.openOrCreateDatabase(path, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void executeSql(String query, String[] params, String tx_id)
|
||||
{
|
||||
try{
|
||||
txid = tx_id;
|
||||
Cursor myCursor = myDb.rawQuery(query, params);
|
||||
processResults(myCursor);
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
Log.d(LOG_TAG, ex.getMessage());
|
||||
txid = "";
|
||||
appView.loadUrl("droiddb.fail(" + ex.getMessage() + "," + txid + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public void processResults(Cursor cur)
|
||||
{
|
||||
String key = "";
|
||||
String value = "";
|
||||
String resultString = "";
|
||||
if (cur.moveToFirst()) {
|
||||
int colCount = cur.getColumnCount();
|
||||
do {
|
||||
resultString = "{";
|
||||
for(int i = 0; i < colCount; ++i)
|
||||
{
|
||||
key = cur.getColumnName(i);
|
||||
value = cur.getString(i);
|
||||
resultString += " \"" + key + "\" : \"" + value + "\"";
|
||||
if (i != (colCount - 1))
|
||||
resultString += ",";
|
||||
}
|
||||
resultString += "}";
|
||||
appView.loadUrl("javascript:droiddb.addResult('" + resultString + "', " + txid + ")");
|
||||
} while (cur.moveToNext());
|
||||
appView.loadUrl("javascript:droiddb.completeQuery(" + txid + ")");
|
||||
txid = "";
|
||||
myDb.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.phonegap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.content.Context;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class TempListener implements SensorEventListener {
|
||||
WebView mAppView;
|
||||
Context mCtx;
|
||||
Sensor mSensor;
|
||||
|
||||
private SensorManager sensorManager;
|
||||
|
||||
TempListener(Context ctx, WebView appView)
|
||||
{
|
||||
mCtx = ctx;
|
||||
mAppView = appView;
|
||||
sensorManager = (SensorManager) mCtx.getSystemService(Context.SENSOR_SERVICE);
|
||||
}
|
||||
|
||||
public void start()
|
||||
{
|
||||
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_TEMPERATURE);
|
||||
if (list.size() > 0)
|
||||
{
|
||||
this.mSensor = list.get(0);
|
||||
this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
this.sensorManager.unregisterListener(this);
|
||||
}
|
||||
|
||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
// We want to know what temp this is.
|
||||
float temp = event.values[0];
|
||||
mAppView.loadUrl("javascript:gotTemp(" + temp + ")");
|
||||
}
|
||||
|
||||
}
|
||||