rhodes 3.2.1 → 3.2.2.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. data/CHANGELOG +7 -0
  2. data/Manifest.txt +36 -0
  3. data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +24 -3
  4. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/CaptureActivity.java +11 -280
  5. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/camera/CameraManager.java +11 -4
  6. data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +2 -1
  7. data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +36 -0
  8. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.h +25 -0
  9. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +195 -0
  10. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.h +59 -0
  11. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +346 -0
  12. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.h +7 -0
  13. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.mm +58 -0
  14. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactoryRegister.mm +18 -0
  15. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.h +16 -0
  16. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.mm +32 -0
  17. data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +9 -2
  18. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h +45 -0
  19. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +7 -1
  20. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +21 -4
  21. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +32 -2
  22. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +1 -0
  23. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +26 -5
  24. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +1 -0
  25. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +2 -3
  26. data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/libzbar.a +0 -0
  27. data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode.i +3 -2
  28. data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +7 -4
  29. data/lib/extensions/barcode/ext/barcode/shared/src/zbar.c +2 -2
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +1 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +7 -2
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraOldService.java +5 -1
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +8 -1
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraService.java +4 -2
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +11 -6
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +21 -13
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +33 -11
  38. data/platform/android/build/android.rake +63 -1
  39. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  40. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -0
  41. data/platform/iphone/icon.png +0 -0
  42. data/platform/iphone/rbuild/iphone.rake +6 -4
  43. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
  44. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +4 -1
  45. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +4 -0
  46. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +4 -0
  47. data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
  48. data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.dll +0 -0
  49. data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
  50. data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
  51. data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Scripting.dll +0 -0
  52. data/res/generators/rhogen.rb +191 -0
  53. data/res/generators/templates/extension/app/MontanaTest/controller.rb +20 -0
  54. data/res/generators/templates/extension/app/MontanaTest/index.erb +17 -0
  55. data/res/generators/templates/extension/extensions/montana/ext.yml +4 -0
  56. data/res/generators/templates/extension/extensions/montana/ext/build +17 -0
  57. data/res/generators/templates/extension/extensions/montana/ext/build.bat +36 -0
  58. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/Rakefile +77 -0
  59. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/ext_build.files +1 -0
  60. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/jni/src/montana.cpp +28 -0
  61. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/src/com/montana/Montana.java +10 -0
  62. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Montana.files +1 -0
  63. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Rakefile +97 -0
  64. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/montana.jdp +48 -0
  65. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/src/com/montana/Montana.java +118 -0
  66. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.h +4 -0
  67. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.m +24 -0
  68. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj +300 -0
  69. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana_Prefix.pch +7 -0
  70. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile +74 -0
  71. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.vcproj +331 -0
  72. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile +62 -0
  73. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.cpp +40 -0
  74. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.h +2 -0
  75. data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana.i +15 -0
  76. data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c +2287 -0
  77. data/res/generators/templates/extension/extensions/montana/ext/montana/shared/src/montana.c +20 -0
  78. data/res/generators/templates/extension/extensions/montana/montana.rb +13 -0
  79. data/spec/framework_spec/build.yml +1 -1
  80. data/spec/phone_spec/build.yml +1 -1
  81. data/version +1 -1
  82. metadata +42 -5
@@ -316,6 +316,7 @@ public:
316
316
  }
317
317
 
318
318
  /// retrieve the string name for any addon.
319
+ /// @deprecated in 0.11
319
320
  const std::string get_addon_name () const
320
321
  {
321
322
  return(zbar_get_addon_name(_type));
@@ -518,9 +519,7 @@ inline const SymbolIterator SymbolSet::symbol_end () const {
518
519
  static inline std::ostream& operator<< (std::ostream& out,
519
520
  const Symbol& sym)
520
521
  {
521
- out << sym.get_type_name()
522
- << sym.get_addon_name()
523
- << ":" << sym.get_data();
522
+ out << sym.get_type_name() << ":" << sym.get_data();
524
523
  return(out);
525
524
  }
526
525
 
@@ -1,8 +1,9 @@
1
1
  /* barcode.i */
2
2
  %module Barcode
3
3
  %{
4
+ #include "ruby/ext/rho/rhoruby.h"
4
5
  extern const char* rho_barcode_barcode_recognize(const char* filename);
5
- extern void rho_barcode_take_barcode(const char* callback);
6
+ extern void rho_barcode_take_barcode(const char* callback, VALUE options);
6
7
 
7
8
  #define barcode_recognize rho_barcode_barcode_recognize
8
9
  #define take_barcode rho_barcode_take_barcode
@@ -10,4 +11,4 @@ extern void rho_barcode_take_barcode(const char* callback);
10
11
  %}
11
12
 
12
13
  extern const char* barcode_recognize(const char* filename);
13
- extern void take_barcode(const char* callback);
14
+ extern void take_barcode(const char* callback, VALUE options);
@@ -1814,8 +1814,9 @@ static VALUE mBarcode;
1814
1814
  #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1815
1815
 
1816
1816
 
1817
+ #include "ruby/ext/rho/rhoruby.h"
1817
1818
  extern const char* rho_barcode_barcode_recognize(const char* filename);
1818
- extern void rho_barcode_take_barcode(const char* callback);
1819
+ extern void rho_barcode_take_barcode(const char* callback, VALUE options);
1819
1820
 
1820
1821
  #define barcode_recognize rho_barcode_barcode_recognize
1821
1822
  #define take_barcode rho_barcode_take_barcode
@@ -1929,19 +1930,21 @@ fail:
1929
1930
  SWIGINTERN VALUE
1930
1931
  _wrap_take_barcode(int argc, VALUE *argv, VALUE self) {
1931
1932
  char *arg1 = (char *) 0 ;
1933
+ VALUE arg2 = (VALUE) 0 ;
1932
1934
  int res1 ;
1933
1935
  char *buf1 = 0 ;
1934
1936
  int alloc1 = 0 ;
1935
1937
 
1936
- if ((argc < 1) || (argc > 1)) {
1937
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
1938
+ if ((argc < 2) || (argc > 2)) {
1939
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
1938
1940
  }
1939
1941
  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
1940
1942
  if (!SWIG_IsOK(res1)) {
1941
1943
  SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","take_barcode", 1, argv[0] ));
1942
1944
  }
1943
1945
  arg1 = (char *)(buf1);
1944
- take_barcode((char const *)arg1);
1946
+ arg2 = argv[1];
1947
+ take_barcode((char const *)arg1,arg2);
1945
1948
  if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
1946
1949
  return Qnil;
1947
1950
  fail:
@@ -8,11 +8,11 @@
8
8
 
9
9
  #include "../zbar/zbar/include/zbar.h"
10
10
 
11
-
11
+ #include "ruby/ext/rho/rhoruby.h"
12
12
 
13
13
  static char strbuf[1024];
14
14
 
15
- void rho_barcode_take_barcode(const char* callback) {
15
+ void rho_barcode_take_barcode(const char* callback, VALUE options) {
16
16
 
17
17
  }
18
18
 
@@ -1286,7 +1286,7 @@ public class RhodesService extends Service {
1286
1286
 
1287
1287
  private void restartGeoLocationIfNeeded() {
1288
1288
  if (mNeedGeoLocationRestart) {
1289
- GeoLocation.isKnownPosition();
1289
+ GeoLocation.restart();
1290
1290
  mNeedGeoLocationRestart = false;
1291
1291
  }
1292
1292
  }
@@ -148,5 +148,10 @@ class CameraNewService implements CameraService {
148
148
  return new Size(neww, newh);
149
149
  }
150
150
 
151
-
152
- }
151
+ public boolean isAutoFocusSupported(android.hardware.Camera camera) {
152
+ String focus_mode = camera.getParameters().getFocusMode();
153
+ boolean auto_focus_supported = (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
154
+ return auto_focus_supported;
155
+ }
156
+
157
+ }
@@ -45,5 +45,9 @@ class CameraOldService implements CameraService {
45
45
  return null;
46
46
  }
47
47
 
48
+ public boolean isAutoFocusSupported(android.hardware.Camera camera) {
49
+ return false;
50
+ }
51
+
48
52
 
49
- }
53
+ }
@@ -137,4 +137,11 @@ class CameraSemiService implements CameraService {
137
137
  return new Size(neww, newh);
138
138
  }
139
139
 
140
- }
140
+ public boolean isAutoFocusSupported(android.hardware.Camera camera) {
141
+ String focus_mode = camera.getParameters().getFocusMode();
142
+ boolean auto_focus_supported = (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focus_mode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
143
+ return auto_focus_supported;
144
+ }
145
+
146
+
147
+ }
@@ -27,7 +27,7 @@
27
27
  package com.rhomobile.rhodes.camera;
28
28
 
29
29
 
30
- interface CameraService {
30
+ public interface CameraService {
31
31
 
32
32
  public class Size {
33
33
  public Size(int w, int h) {
@@ -45,5 +45,7 @@ interface CameraService {
45
45
  Size getClosestPictureSize(android.hardware.Camera camera, int w, int h);
46
46
 
47
47
  Size getClosestPreviewSize(android.hardware.Camera camera, int w, int h);
48
+
49
+ boolean isAutoFocusSupported(android.hardware.Camera camera);
48
50
 
49
- }
51
+ }
@@ -63,7 +63,7 @@ public class ImageCapture extends BaseActivity implements SurfaceHolder.Callback
63
63
  private static final String TAG = "ImageCapture";
64
64
 
65
65
  private String callbackUrl;
66
- private Camera camera;
66
+ private android.hardware.Camera camera;
67
67
  private boolean isPreviewRunning = false;
68
68
  private SimpleDateFormat timeStampFormat = new SimpleDateFormat("yyyyMMddHHmmssSS");
69
69
 
@@ -270,11 +270,16 @@ public class ImageCapture extends BaseActivity implements SurfaceHolder.Callback
270
270
  //this only from API v.5 and higher
271
271
  //String focus_mode = camera.getParameters().getFocusMode();
272
272
  //if ((focus_mode != Camera.Parameters.FOCUS_MODE_FIXED) && (focus_mode != Camera.Parameters.FOCUS_MODE_INFINITY)) {
273
- camera.autoFocus(new Camera.AutoFocusCallback() {
274
- public void onAutoFocus(boolean success, Camera camera) {
275
- takePicture();
276
- }
277
- });
273
+ if (com.rhomobile.rhodes.camera.Camera.getCameraService().isAutoFocusSupported(camera)) {
274
+ camera.autoFocus(new Camera.AutoFocusCallback() {
275
+ public void onAutoFocus(boolean success, Camera camera) {
276
+ takePicture();
277
+ }
278
+ });
279
+ }
280
+ else {
281
+ takePicture();
282
+ }
278
283
  //}
279
284
  }
280
285
 
@@ -64,10 +64,6 @@ public class GeoLocation {
64
64
  return 30000; // 30 sec
65
65
  }
66
66
 
67
- private static void reportFail(String name, Exception e) {
68
- Logger.E(TAG, "Call of \"" + name + "\" failed: " + e.getMessage());
69
- }
70
-
71
67
  private static void checkState() throws IllegalAccessException {
72
68
  if (!Capabilities.GPS_ENABLED)
73
69
  throw new IllegalAccessException("Capability GPS disabled");
@@ -117,10 +113,22 @@ public class GeoLocation {
117
113
  }
118
114
  }
119
115
  catch (Exception e) {
120
- reportFail("stop", e);
116
+ Logger.E(TAG, e);
121
117
  }
122
118
  }
123
-
119
+
120
+ public static void restart() {
121
+ try {
122
+ checkState();
123
+ Logger.T(TAG, "restart");
124
+ if (updatePeriod != -1)
125
+ getImpl().setTimeout(getUpdatePeriod());
126
+ }
127
+ catch (Exception e) {
128
+ Logger.E(TAG, e);
129
+ }
130
+ }
131
+
124
132
  public static boolean isAvailable() {
125
133
  Logger.T(TAG, "isAvailable...");
126
134
  try {
@@ -133,7 +141,7 @@ public class GeoLocation {
133
141
  return result;
134
142
  }
135
143
  catch (Exception e) {
136
- reportFail("isAvailable", e);
144
+ Logger.E(TAG, e);
137
145
  }
138
146
  return false;
139
147
  }
@@ -145,7 +153,7 @@ public class GeoLocation {
145
153
  return getImpl().getLatitude();
146
154
  }
147
155
  catch (Exception e) {
148
- reportFail("getLatitude", e);
156
+ Logger.E(TAG, e);
149
157
  }
150
158
  return 0.0;
151
159
  }
@@ -157,7 +165,7 @@ public class GeoLocation {
157
165
  return getImpl().getLongitude();
158
166
  }
159
167
  catch (Exception e) {
160
- reportFail("getLongitude", e);
168
+ Logger.E(TAG, e);
161
169
  }
162
170
  return 0.0;
163
171
  }
@@ -169,7 +177,7 @@ public class GeoLocation {
169
177
  return getImpl().getAccuracy();
170
178
  }
171
179
  catch (Exception e) {
172
- reportFail("getAccuracy", e);
180
+ Logger.E(TAG, e);
173
181
  }
174
182
  return 0;
175
183
  }
@@ -181,7 +189,7 @@ public class GeoLocation {
181
189
  return getImpl().isKnownPosition();
182
190
  }
183
191
  catch (Exception e) {
184
- reportFail("isKnownPosition", e);
192
+ Logger.E(TAG, e);
185
193
  }
186
194
  return false;
187
195
  }
@@ -196,10 +204,10 @@ public class GeoLocation {
196
204
  checkState();
197
205
  Logger.T(TAG, "setTimeout: " + nsec + "s");
198
206
  updatePeriod = nsec * 1000;
199
- getImpl().setTimeout(updatePeriod);
207
+ getImpl().setTimeout(getUpdatePeriod());
200
208
  }
201
209
  catch (Exception e) {
202
- reportFail("setTimeout", e);
210
+ Logger.E(TAG, e);
203
211
  }
204
212
  }
205
213
 
@@ -48,10 +48,13 @@ public class GeoLocationImpl {
48
48
 
49
49
  private LocationManager locationManager = null;
50
50
  private volatile Location lastLocation;
51
+
52
+ // These two values should be equal in most cases but explicit request to GeoLocation without call to setTimeout
51
53
  private long invalidateLocationPeriod;
52
54
  private volatile long pingTimeout = Long.MAX_VALUE;
53
55
 
54
56
  private List<RhoLocationListener> mListeners = new LinkedList<RhoLocationListener>();
57
+ private List<RhoLocationListener> mSwitchedOffListeners = new LinkedList<RhoLocationListener>();
55
58
 
56
59
  public class RhoLocationListener implements LocationListener {
57
60
  private String providerName;
@@ -106,11 +109,11 @@ public class GeoLocationImpl {
106
109
  if((System.currentTimeMillis() - time) > invalidateLocationPeriod) {
107
110
  message.append(" time is very old: ").append(location.getTime());
108
111
  message.append(". Current time: ").append(System.currentTimeMillis());
109
- message.append(". Inactivity timeout: ").append(invalidateLocationPeriod).append(".");
112
+ message.append(". Invalitate period: ").append(invalidateLocationPeriod).append(".");
110
113
  } else {
111
114
  message.append(" time os ok: ").append(location.getTime());
112
115
  message.append(". Current time: ").append(System.currentTimeMillis());
113
- message.append(". Inactivity timeout: ").append(invalidateLocationPeriod).append(".");
116
+ message.append(". Invalidate period: ").append(invalidateLocationPeriod).append(".");
114
117
  onLocationChanged(location);
115
118
  }
116
119
  Logger.T(TAG, message.toString());
@@ -151,7 +154,7 @@ public class GeoLocationImpl {
151
154
  if (pingTimeout < 0)
152
155
  break;
153
156
  try {
154
- long curTimeout = errorTimeout(pingTimeout);
157
+ final long curTimeout = errorTimeout(pingTimeout);
155
158
  Logger.T(TAG, "\"watchdog\" thread waits (" + curTimeout + "ms)...");
156
159
  Thread.sleep(curTimeout);
157
160
  }
@@ -183,7 +186,7 @@ public class GeoLocationImpl {
183
186
  });
184
187
 
185
188
  // Sleep greater then ping time to do not interfere with real location updates
186
- private static long errorTimeout(long time) { return time * 5; }
189
+ private static long errorTimeout(long time) { return (time == Long.MAX_VALUE) ? time : (time * 5); }
187
190
 
188
191
  private static native void geoCallback();
189
192
  private static native void geoCallbackError();
@@ -209,7 +212,7 @@ public class GeoLocationImpl {
209
212
  continue;
210
213
 
211
214
  RhoLocationListener listener = new RhoLocationListener(provider, locationManager);
212
- mListeners.add(listener);
215
+ mSwitchedOffListeners.add(listener);
213
216
  }
214
217
  }
215
218
 
@@ -217,10 +220,18 @@ public class GeoLocationImpl {
217
220
  private void registerListeners() {
218
221
  Iterator<RhoLocationListener> it;
219
222
  synchronized (mListeners) {
220
- it = mListeners.iterator();
223
+ it = mSwitchedOffListeners.iterator();
221
224
  while (it.hasNext()) {
222
- it.next().register(pingTimeout);
225
+ RhoLocationListener listener = it.next();
226
+
227
+ Logger.T(TAG, "Registering location listener: " + listener.getProviderName());
228
+
229
+ listener.register(pingTimeout);
230
+ mListeners.add(listener);
223
231
  }
232
+ mSwitchedOffListeners.removeAll(mListeners);
233
+
234
+ Logger.T(TAG, "Count of switched off listeners: " + mSwitchedOffListeners.size());
224
235
  }
225
236
  // Request last location after every listener has registered
226
237
  // because last location from GPS will force other listeners to unregister
@@ -237,8 +248,14 @@ public class GeoLocationImpl {
237
248
  RhoLocationListener listener = it.next();
238
249
  if ((skipProvider != null) && listener.getProviderName().equals(skipProvider))
239
250
  continue;
251
+
252
+ Logger.T(TAG, "Unregistering location listener: " + listener.getProviderName());
253
+
240
254
  listener.unregister();
255
+ it.remove();
256
+ mSwitchedOffListeners.add(listener);
241
257
  }
258
+ Logger.T(TAG, "Count of switched off listeners: " + mSwitchedOffListeners.size());
242
259
  }
243
260
  }
244
261
 
@@ -406,10 +423,15 @@ public class GeoLocationImpl {
406
423
  }
407
424
 
408
425
  synchronized void setTimeout(long msec) {
409
- pingTimeout = msec;
410
- thWatchdog.interrupt();
411
- registerListeners();// do reregister for new timeout
412
- Logger.T(TAG, "Set new ping timeout: " + pingTimeout + "ms");
426
+ if (pingTimeout != msec) {
427
+ pingTimeout = msec;
428
+ thWatchdog.interrupt();
429
+ registerListeners();// do reregister for new timeout
430
+ Logger.T(TAG, "Set new ping timeout: " + pingTimeout + "ms");
431
+ } else {
432
+ // Just renew timer in case same value
433
+ thWatchdog.interrupt();
434
+ }
413
435
 
414
436
  }
415
437
  }
@@ -33,7 +33,21 @@ USE_OWN_STLPORT = false
33
33
 
34
34
  ANDROID_API_LEVEL_TO_MARKET_VERSION = {}
35
35
  ANDROID_MARKET_VERSION_TO_API_LEVEL = {}
36
- {2 => "1.1", 3 => "1.5", 4 => "1.6", 5 => "2.0", 6 => "2.0.1", 7 => "2.1", 8 => "2.2", 9 => "2.3.1", 10 => "2.3.3", 11 => "3.0", 12 => "3.1", 13 => "3.2" }.each do |k,v|
36
+ {
37
+ 2 => "1.1",
38
+ 3 => "1.5",
39
+ 4 => "1.6",
40
+ 5 => "2.0",
41
+ 6 => "2.0.1",
42
+ 7 => "2.1",
43
+ 8 => "2.2",
44
+ 9 => "2.3.1",
45
+ 10 => "2.3.3",
46
+ 11 => "3.0",
47
+ 12 => "3.1",
48
+ 13 => "3.2",
49
+ 14 => "4.0"
50
+ }.each do |k,v|
37
51
  ANDROID_API_LEVEL_TO_MARKET_VERSION[k] = v
38
52
  ANDROID_MARKET_VERSION_TO_API_LEVEL[v] = k
39
53
  end
@@ -245,10 +259,58 @@ def set_app_name_android(newname)
245
259
 
246
260
  manifest.elements.each('uses-permission') { |e| manifest.delete e }
247
261
 
262
+
263
+ uses_camera = false
264
+ uses_autofocus = false
265
+ uses_front = false
266
+ uses_flash = false
267
+
268
+ manifest.elements.each('uses-feature') do |e|
269
+ uname = e.attribute("name", "android").to_s
270
+ if "android.hardware.camera".eql? uname
271
+ uses_camera = true
272
+ end
273
+ if "android.hardware.camera.autofocus".eql? uname
274
+ uses_autofocus = true
275
+ end
276
+ if "android.hardware.camera.front".eql? uname
277
+ uses_front = true
278
+ end
279
+ if "android.hardware.camera.flash".eql? uname
280
+ uses_flash = true
281
+ end
282
+ end
283
+
248
284
  caps.sort.each do |cap|
249
285
  element = REXML::Element.new('uses-permission')
250
286
  element.add_attribute('android:name', "android.permission.#{cap}")
251
287
  manifest.add element
288
+ if cap == 'CAMERA'
289
+ if !uses_camera
290
+ element = REXML::Element.new('uses-feature')
291
+ element.add_attribute('android:required', "false")
292
+ element.add_attribute('android:name', "android.hardware.camera")
293
+ manifest.add element
294
+ end
295
+ if !uses_autofocus
296
+ element = REXML::Element.new('uses-feature')
297
+ element.add_attribute('android:required', "false")
298
+ element.add_attribute('android:name', "android.hardware.camera.autofocus")
299
+ manifest.add element
300
+ end
301
+ if !uses_front
302
+ element = REXML::Element.new('uses-feature')
303
+ element.add_attribute('android:required', "false")
304
+ element.add_attribute('android:name', "android.hardware.camera.front")
305
+ manifest.add element
306
+ end
307
+ if !uses_flash
308
+ element = REXML::Element.new('uses-feature')
309
+ element.add_attribute('android:required', "false")
310
+ element.add_attribute('android:name', "android.hardware.camera.flash")
311
+ manifest.add element
312
+ end
313
+ end
252
314
  end
253
315
 
254
316
  caps_proc.each do |p|