rhodes 7.4.1 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (305) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +319 -0
  3. data/CREDITS +3 -1
  4. data/LICENSE +1 -1
  5. data/README.md +6 -16
  6. data/Rakefile +55 -43
  7. data/SECURITY.md +19 -0
  8. data/appveyor.yml +66 -8
  9. data/azure-pipelines.yml +67 -0
  10. data/bin/rhodes-setup +22 -8
  11. data/extensions/emdk3-manager/ext/platform/android/src/com/rho/emdk3/EMDK3Extension.java +14 -5
  12. data/extensions/instrumentation/ext/platform/android/src/com/rho/instrumentation/Instrumentation.java +29 -15
  13. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/src/com/rhomobile/rhoelements/ans/ANSManager.java +3 -3
  14. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/ElementsCore.java +12 -9
  15. data/extensions/rhoelementsext/ext/rhoelementsext/platform/android/rhoelements_temp/src/com/rho/rhoelements/graphics/BatteryIndicator.java +2 -2
  16. data/lib/commonAPI/barcode/ext/platform/android/AndroidManifest.xml +3 -1
  17. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/BarcodeCaptureActivity.java +11 -13
  18. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/BarcodeGraphicTracker.java +1 -1
  19. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/ui/camera/CameraSource.java +3 -3
  20. data/lib/commonAPI/barcode/ext/platform/android/src/com/google/barcodereader/ui/camera/CameraSourcePreview.java +1 -1
  21. data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro +1 -1
  22. data/lib/commonAPI/barcode/ext/platform/qt/Barcode.pro.erb +2 -2
  23. data/lib/commonAPI/barcode/ext/platform/qt/src/qzxing/QZXing.pri +9 -21
  24. data/lib/commonAPI/barcode/ext.yml +5 -8
  25. data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro +1 -1
  26. data/lib/commonAPI/bluetooth/ext/platform/qt/Bluetooth.pro.erb +1 -1
  27. data/lib/commonAPI/bluetooth/ext/platform/qt/src/bluetooth/bluetoothhelper.h +1 -1
  28. data/lib/commonAPI/coreapi/RhoSystemApi.rb +6 -0
  29. data/lib/commonAPI/coreapi/ext/Intent.xml +4 -0
  30. data/lib/commonAPI/coreapi/ext/platform/android/Rakefile +0 -12
  31. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/intent/IntentSingleton.java +6 -0
  32. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/Notification.java +5 -2
  33. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationScheduler.java +4 -4
  34. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +1 -1
  35. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/webview/WebViewSingleton.java +40 -27
  36. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +5 -6
  37. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.h +1 -1
  38. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/Intent.m +3 -1
  39. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.h +2 -1
  40. data/lib/commonAPI/coreapi/ext/platform/iphone/impl/NotificationSingleton.m +10 -0
  41. data/lib/commonAPI/coreapi/ext/platform/wm/src/IntentImpl.cpp +3 -0
  42. data/lib/commonAPI/coreapi/ext/push.xml +5 -2
  43. data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.cpp +13 -0
  44. data/lib/commonAPI/coreapi/ext/shared/SystemImplBase.h +2 -0
  45. data/lib/commonAPI/coreapi/ext/system.xml +3 -0
  46. data/lib/commonAPI/mediacapture/ext/camera.xml +4 -9
  47. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationCameraActivity.erb +2 -2
  48. data/lib/commonAPI/mediacapture/ext/platform/android/ApplicationFileProvider.erb +1 -1
  49. data/lib/commonAPI/mediacapture/ext/platform/android/ext_java.files +2 -9
  50. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraExtension.java +0 -2
  51. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraFactory.java +19 -24
  52. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraObject.java +322 -730
  53. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraRhoListener.java +247 -433
  54. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/{CameraSingletonObject.java → CameraSingleton.java} +68 -74
  55. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/mediacapture/RhoCameraFileProvider.java +6 -0
  56. data/lib/commonAPI/mediacapture/ext/platform/qt/MediaCapture.pro.erb +1 -1
  57. data/lib/commonAPI/mediacapture/ext/platform/qt/Mediacapture.pro +1 -1
  58. data/lib/commonAPI/printing_zebra/ext/platform/android/src/com/rhomobile/printing/zebra/impl/ZebraPrintingProviderImpl.java +2 -1
  59. data/lib/commonAPI/signature/ext/platform/iphone/impl/readme.txt +7 -0
  60. data/lib/commonAPI/signature/ext/platform/qt/Signature.pro +3 -10
  61. data/lib/commonAPI/signature/ext/platform/qt/Signature.pro.erb +2 -2
  62. data/lib/extensions/fcm-push/ext/android/ApplicationManifestAdds.erb +15 -17
  63. data/lib/extensions/fcm-push/ext/android/Rakefile +59 -34
  64. data/lib/extensions/fcm-push/ext/android/ext_java.files +0 -1
  65. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMFacade.java +13 -17
  66. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java +81 -80
  67. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMListener.java +0 -16
  68. data/lib/extensions/fcm-push/ext/iphone/Podfile +15 -2
  69. data/lib/extensions/fcm-push/ext/iphone/fcm-push.xcodeproj/project.pbxproj +6 -7
  70. data/lib/extensions/fcm-push/ext.yml +1 -1
  71. data/lib/extensions/gmaps/ext/platform/android/ApplicationManifestAdds.erb +1 -0
  72. data/lib/extensions/gmaps/ext/platform/android/src/com/rhomobile/rhodes/gmaps/GMapActivity.java +12 -4
  73. data/lib/extensions/gmaps/ext.yml +3 -1
  74. data/lib/extensions/nfc/ext/platform/android/src/com/rhomobile/nfc/Nfc.java +2 -1
  75. data/lib/extensions/serialport/ext/serialport.pro +1 -1
  76. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  77. data/platform/android/Rhodes/jni/src/MethodResultJni.cpp +4 -0
  78. data/platform/android/Rhodes/jni/src/fileapi.cpp +4 -0
  79. data/platform/android/Rhodes/res/drawable/baseline_check_24.xml +5 -0
  80. data/platform/android/Rhodes/res/drawable/baseline_check_240.xml +5 -0
  81. data/platform/android/Rhodes/res/drawable/baseline_close_24.xml +5 -0
  82. data/platform/android/Rhodes/res/drawable/baseline_close_240.xml +5 -0
  83. data/platform/android/Rhodes/res/layout/overlay_layout.xml +39 -0
  84. data/platform/android/Rhodes/res/layout/perrmission_alert_dialog.xml +267 -0
  85. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +183 -66
  86. data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +38 -6
  87. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoFileProvider.java +32 -0
  88. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +532 -92
  89. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -4
  90. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +259 -163
  91. data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/StatusNotification.java +1 -1
  92. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +14 -3
  93. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +4 -0
  94. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +5 -4
  95. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +79 -38
  96. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +20 -15
  97. data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +18 -9
  98. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/CallReceiver.java +22 -0
  99. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/IKioskMode.java +11 -0
  100. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/KioskManager.java +18 -0
  101. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java +230 -0
  102. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyNotificationListenerService.java +16 -0
  103. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyOverlayService.java +197 -0
  104. data/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/PermissionManager.java +232 -0
  105. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +34 -8
  106. data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality26.java +1 -1
  107. data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/CheckDrawable.java +53 -0
  108. data/platform/android/Rhodes/src/com/rhomobile/rhodes/permissioncheck/PermissionListGenerate.java +366 -0
  109. data/platform/android/Rhodes/src/com/rhomobile/rhodes/rhodes.iml +11 -0
  110. data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +1 -0
  111. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +782 -41
  112. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputConnectionWrapper.java +146 -0
  113. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoInputListener.java +21 -0
  114. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +92 -32
  115. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/TauWebViewOptions.java +118 -0
  116. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderBase.java +18 -17
  117. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/WebSettingsProviderEclairMR1.java +4 -4
  118. data/platform/android/build/RhodesSRC_build.files +13 -0
  119. data/platform/android/build/{aab_builder.rb → aapt2_helper.rb} +94 -37
  120. data/platform/android/build/android-repack.rake +8 -1
  121. data/platform/android/build/android.rake +238 -238
  122. data/platform/android/build/android_tools.rb +10 -10
  123. data/platform/android/build/androidcommon.rb +31 -14
  124. data/platform/android/build/build_tools_finder.rb +46 -0
  125. data/platform/android/build/config.yml +8 -0
  126. data/platform/android/build/dex_builder.rb +88 -0
  127. data/platform/android/build/hostplatform.rb +9 -0
  128. data/platform/android/build/manifest_generator.rb +15 -10
  129. data/platform/android/build/maven_deps_extractor.rb +29 -22
  130. data/platform/android/build/ndkwrapper.rb +92 -51
  131. data/platform/android/proguard/proguard-base-rules.pro +5 -0
  132. data/platform/android/proguard/proguard.jar +0 -0
  133. data/platform/iphone/Classes/AppManager/AppManager.m +3 -1
  134. data/platform/iphone/Classes/Camera/PickImageDelegate.h +2 -0
  135. data/platform/iphone/Classes/Camera/PickImageDelegate.m +45 -23
  136. data/platform/iphone/Classes/CocoaServer/CCocoaServer.h +27 -0
  137. data/platform/iphone/Classes/CocoaServer/CCocoaServer.m +107 -0
  138. data/platform/iphone/Classes/CocoaServer/RhoHTTPConnection.h +16 -0
  139. data/platform/iphone/Classes/CocoaServer/RhoHTTPConnection.m +226 -0
  140. data/platform/iphone/Classes/RhoAppBaseLib-Bridging-Header.h +4 -0
  141. data/platform/iphone/Classes/RhoAppBaseStandaloneLib-Bridging-Header.h +4 -0
  142. data/platform/iphone/Classes/RhoCryptAESGCM.swift +105 -0
  143. data/platform/iphone/Classes/RhoUIWebView.h +1 -1
  144. data/platform/iphone/Classes/RhoUIWebView.m +1 -1
  145. data/platform/iphone/Classes/RhoWKWebView.h +1 -1
  146. data/platform/iphone/Classes/RhoWKWebView.mm +110 -15
  147. data/platform/iphone/Classes/RhoWebView.h +1 -1
  148. data/platform/iphone/Classes/RhoWebViewFabrique.m +13 -2
  149. data/platform/iphone/Classes/Rhodes.m +3 -0
  150. data/platform/iphone/Classes/SimpleMainView.m +5 -5
  151. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -10
  152. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +4 -0
  153. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
  154. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
  155. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
  156. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
  157. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
  158. data/platform/iphone/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
  159. data/platform/iphone/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
  160. data/platform/iphone/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
  161. data/platform/iphone/CocoaHTTPServer/Core/HTTPConnection.h +120 -0
  162. data/platform/iphone/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
  163. data/platform/iphone/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
  164. data/platform/iphone/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
  165. data/platform/iphone/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
  166. data/platform/iphone/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
  167. data/platform/iphone/CocoaHTTPServer/Core/HTTPServer.h +205 -0
  168. data/platform/iphone/CocoaHTTPServer/Core/HTTPServer.m +772 -0
  169. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
  170. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
  171. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
  172. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
  173. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
  174. data/platform/iphone/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
  175. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
  176. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
  177. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
  178. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
  179. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
  180. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
  181. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
  182. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
  183. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
  184. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
  185. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
  186. data/platform/iphone/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
  187. data/platform/iphone/CocoaHTTPServer/Core/WebSocket.h +105 -0
  188. data/platform/iphone/CocoaHTTPServer/Core/WebSocket.m +791 -0
  189. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
  190. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
  191. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
  192. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
  193. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
  194. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
  195. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
  196. data/platform/iphone/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
  197. data/platform/iphone/CocoaHTTPServer/LICENSE.txt +18 -0
  198. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/About.txt +4 -0
  199. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/GCDAsyncSocket.h +1226 -0
  200. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m +8528 -0
  201. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/About.txt +33 -0
  202. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDASLLogger.h +41 -0
  203. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDASLLogger.m +99 -0
  204. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
  205. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.m +727 -0
  206. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDFileLogger.h +334 -0
  207. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDFileLogger.m +1353 -0
  208. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDLog.h +601 -0
  209. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDLog.m +1083 -0
  210. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDTTYLogger.h +167 -0
  211. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/DDTTYLogger.m +1479 -0
  212. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
  213. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
  214. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
  215. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
  216. data/platform/iphone/CocoaHTTPServer/Vendor/CocoaLumberjack/Extensions/README.txt +7 -0
  217. data/platform/iphone/Framework/RhoApplication/RhoApplication.xcodeproj/project.pbxproj +1 -1
  218. data/platform/iphone/Framework/Rhodes/Rhodes.xcodeproj/project.pbxproj +2 -2
  219. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +410 -1
  220. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +1 -1
  221. data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -1
  222. data/platform/iphone/rbuild/iphone.rake +13 -8
  223. data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
  224. data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +1 -1
  225. data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +1 -1
  226. data/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +0 -0
  227. data/platform/sailfish/build/{harbour-SailfishRhodes.pro.erb → SailfishRhodes.pro.erb} +10 -17
  228. data/platform/sailfish/build/rhodes.pro.erb +7 -17
  229. data/platform/sailfish/build/rpm/SailfishRhodes.desktop.erb +12 -0
  230. data/platform/sailfish/build/rpm/SailfishRhodes.erb +2 -0
  231. data/platform/sailfish/build/rpm/SailfishRhodes.spec.erb +43 -0
  232. data/platform/sailfish/build/rubylib.pro.erb +29 -29
  233. data/platform/sailfish/build/sailfish.rake +188 -180
  234. data/platform/sailfish/keys/regular_cert.pem +14 -0
  235. data/platform/sailfish/keys/regular_key.pem +4 -0
  236. data/platform/shared/common/RhodesApp.cpp +59 -10
  237. data/platform/shared/common/iphone/RhoCryptImpl.mm +130 -54
  238. data/platform/shared/net/HttpServer.cpp +20 -0
  239. data/platform/shared/qt/RhoSimulator.pro +1 -1
  240. data/platform/shared/qt/rhodes/rhodes.pro +4 -11
  241. data/platform/shared/qt/sailfish/SailfishRhodes.desktop +3 -4
  242. data/platform/shared/qt/sailfish/SailfishRhodes.pro +9 -10
  243. data/platform/shared/qt/sailfish/icons/108x108/108x108.png +0 -0
  244. data/platform/shared/qt/sailfish/privileges/sailfishrhodes +2 -0
  245. data/platform/shared/qt/sailfish/qml/pages/FirstPageWK.qml +7 -11
  246. data/platform/shared/qt/sailfish/qml/{harbour-sailfishrhodes.qml → sailfishrhodes.qml} +1 -1
  247. data/platform/shared/qt/sailfish/rpm/sailfishrhodes.spec +80 -0
  248. data/platform/shared/qt/sailfish/rpm/{harbour-sailfishrhodes.yaml → sailfishrhodes.yaml} +2 -2
  249. data/platform/shared/qt/sailfish/src/QtMainWindow.cpp +1 -1
  250. data/platform/shared/qt/sailfish/src/QtMainWindow.h +1 -1
  251. data/platform/shared/qt/sailfish/src/main.cpp +6 -38
  252. data/platform/shared/qt/sailfish/src/rootdelegate.h +2 -14
  253. data/platform/shared/ruby/aurora/ruby/config.h +386 -0
  254. data/platform/shared/ruby/aurora/ruby/constdefs.c +5866 -0
  255. data/platform/shared/ruby/aurora/ruby/constdefs.h +1788 -0
  256. data/platform/shared/ruby/osx/ruby/config.h +2 -0
  257. data/platform/shared/ruby/win32/win32.c +10 -3
  258. data/platform/shared/sqlite/crypto.c +14 -0
  259. data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
  260. data/platform/win32/build/rhodes.nsi +3 -3
  261. data/platform/win32/build/win32.rake +1 -1
  262. data/rakefile.rb +55 -43
  263. data/res/build-tools/RhoRuby.exe +0 -0
  264. data/res/build-tools/aapt2/linux/aapt2 +0 -0
  265. data/res/build-tools/aapt2/osx/aapt2 +0 -0
  266. data/res/build-tools/iphonesim/build/Release/iphonesim_8 +4 -4
  267. data/res/generators/templates/application/AndroidManifest.erb +28 -6
  268. data/res/generators/templates/application/build.yml +18 -11
  269. data/res/generators/templates/application/resources/android/res/xml/provider_paths.xml +4 -0
  270. data/res/generators/templates/application/rhoconfig.txt +15 -1
  271. data/res/generators/templates/iphone_project/Bremen8.xcodeproj/project.pbxproj +24 -1
  272. data/res/generators/templates/iphone_project/Classes/SimpleSwiftClass.swift +20 -0
  273. data/res/generators/templates/iphone_project/Classes/rhorunner-Bridging-Header.h +4 -0
  274. data/rhobuild.yml.example +4 -4
  275. data/rhodes.gemspec +4 -3
  276. data/version +1 -1
  277. metadata +157 -57
  278. data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/drawable/camera_btn.xml +0 -14
  279. data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/layout/camera_land.xml +0 -23
  280. data/lib/commonAPI/mediacapture/ext/platform/android/adds/res/layout/camera_port.xml +0 -23
  281. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraActivity.java +0 -156
  282. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraEclair.java +0 -227
  283. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraGingerbread.java +0 -152
  284. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraPreview.java +0 -183
  285. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraSingletonEclair.java +0 -14
  286. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/CameraSingletonGingerbread.java +0 -60
  287. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraObject.java +0 -20
  288. data/lib/commonAPI/mediacapture/ext/platform/android/src/com/rho/camera/ICameraSingletonObject.java +0 -8
  289. data/lib/extensions/fcm-push/ext/android/src/com/rhomobile/rhodes/fcm/FCMTokenRefresherService.java +0 -27
  290. data/platform/android/Rhodes/AndroidManifest.xml.erb +0 -89
  291. data/platform/sailfish/build/rho_build.cmd.erb +0 -14
  292. data/platform/sailfish/build/rho_clean.cmd.erb +0 -14
  293. data/platform/sailfish/build/rho_deploy.cmd.erb +0 -15
  294. data/platform/sailfish/build/rho_rpm.cmd.erb +0 -14
  295. data/platform/sailfish/build/rho_rpmvalidation.cmd.erb +0 -14
  296. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.desktop.erb +0 -7
  297. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.erb +0 -2
  298. data/platform/sailfish/build/rpm/harbour-SailfishRhodes.yaml.erb +0 -37
  299. data/platform/shared/qt/sailfish/harbour-sailfishrhodes.desktop +0 -6
  300. data/platform/shared/qt/sailfish/icons/108x108/harbour-sailfishrhodes.png +0 -0
  301. data/platform/shared/qt/sailfish/privileges/harbour-sailfishrhodes +0 -2
  302. data/platform/shared/qt/sailfish/qml/pages/FirstPageWE.qml +0 -236
  303. /data/platform/shared/qt/sailfish/icons/128x128/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
  304. /data/platform/shared/qt/sailfish/icons/172x172/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
  305. /data/platform/shared/qt/sailfish/icons/86x86/{harbour-sailfishrhodes.png → sailfishrhodes.png} +0 -0
@@ -1,156 +0,0 @@
1
- /*------------------------------------------------------------------------
2
- * (The MIT License)
3
- *
4
- * Copyright (c) 2008-2011 Rhomobile, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in
14
- * all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- * THE SOFTWARE.
23
- *
24
- * http://rhomobile.com
25
- *------------------------------------------------------------------------*/
26
-
27
- package com.rho.camera;
28
-
29
- import java.io.File;
30
- import java.io.IOException;
31
- import java.net.URISyntaxException;
32
- import java.security.InvalidParameterException;
33
- import java.util.HashMap;
34
- import java.util.Map;
35
-
36
- import com.rhomobile.rhodes.Logger;
37
- import com.rhomobile.rhodes.BaseActivity;
38
- import com.rhomobile.rhodes.R;
39
- import com.rhomobile.rhodes.RhodesActivity;
40
-
41
- import android.content.Context;
42
- import android.content.Intent;
43
- import android.content.pm.ActivityInfo;
44
- import android.content.res.Configuration;
45
- import android.graphics.PixelFormat;
46
- import android.hardware.Camera;
47
- import android.net.Uri;
48
- import android.os.Bundle;
49
- import android.view.OrientationEventListener;
50
- import android.view.SurfaceView;
51
- import android.view.View;
52
- import android.view.Window;
53
- import android.view.WindowManager;
54
- import android.view.View.OnClickListener;
55
- import android.widget.Button;
56
- import android.widget.FrameLayout;
57
-
58
- public class CameraActivity extends BaseActivity implements OnClickListener {
59
- private static final String TAG = CameraActivity.class.getSimpleName();
60
- private CameraPreview mPreview;
61
- private Camera mCamera = null;
62
- private ICameraObject camera = null;
63
- private Button button = null;
64
- private String id = null;
65
- //public static boolean CURRENT_SCREEN_AUTO_ROTATE_MODE;
66
- //public static boolean CURRENT_FULL_SCREEN_MODE;
67
-
68
- @Override
69
- protected void onCreate(Bundle extras) {
70
- super.onCreate(extras);
71
- Logger.T(TAG, "onCreate");
72
- CameraObject.CURRENT_SCREEN_AUTO_ROTATE_MODE = RhodesActivity.safeGetInstance().getScreenAutoRotateMode();
73
- CameraObject.CURRENT_FULL_SCREEN_MODE = RhodesActivity.safeGetInstance().getFullScreenMode();
74
- requestWindowFeature(Window.FEATURE_NO_TITLE);
75
- RhodesActivity.safeGetInstance().setScreenAutoRotateMode(false);
76
- RhodesActivity.safeGetInstance().setFullScreenMode(true);
77
- if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
78
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
79
- setContentView(R.layout.camera_port);
80
- }
81
- if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
82
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
83
- setContentView(R.layout.camera_land);
84
- }
85
- id = getIntent().getStringExtra(CameraExtension.INTENT_EXTRA_PREFIX + "CAMERA_ID");
86
- camera = ((CameraFactory)CameraFactorySingleton.getInstance()).getCameraObject(id);
87
- button =(Button)findViewById(R.id.cameraButton);
88
- button.setOnClickListener(this);
89
- mPreview = new CameraPreview((SurfaceView)findViewById(R.id.previewSurface));
90
-
91
- }
92
-
93
- @Override
94
- protected void onResume() {
95
- super.onResume();
96
- Logger.T(TAG, "onResume");
97
- startOrientationService();
98
- try{
99
- mPreview.startPreview(camera, this);
100
- // Setting focus if supported by camera of the device after camera previewing
101
- camera.setFocus(this);
102
- }
103
- catch(RuntimeException e){
104
-
105
- }
106
- }
107
-
108
- @Override
109
- protected void onPause() {
110
- super.onPause();
111
- Logger.T(TAG, "onPause");
112
- button.setEnabled(true);
113
- if(mCamera != null){
114
- mCamera.stopPreview();
115
- mCamera.release();
116
- mCamera = null;
117
- }
118
- }
119
-
120
- @Override
121
- protected void onStop() {
122
- super.onStop();
123
- stopService(new Intent(CameraActivity.this,OrientationListnerService.class));
124
- button.setEnabled(true);
125
- }
126
-
127
- @Override
128
- protected void onDestroy() {
129
- super.onDestroy();
130
- if(camera !=null){
131
- camera.stopPreview();
132
- camera = null;
133
- }
134
- }
135
-
136
- @Override
137
- public void onClick(View view) {
138
- Logger.T(TAG, "onClick");
139
- try{
140
- if (view.getId() == R.id.cameraButton) {
141
- Logger.T(TAG, "cameraButton");
142
- camera.doTakePicture(this,0);
143
- button.setEnabled(false);
144
- }
145
- }
146
- catch(Exception e){
147
- e.printStackTrace();
148
- }
149
- }
150
-
151
- private void startOrientationService()
152
- {
153
- Intent i=new Intent(this,OrientationListnerService.class);
154
- startService(i);
155
- }
156
- }
@@ -1,227 +0,0 @@
1
- package com.rho.camera;
2
-
3
- import java.util.ArrayList;
4
- import java.util.HashMap;
5
- import java.util.List;
6
- import java.util.Map;
7
-
8
- import android.app.Activity;
9
- import android.hardware.Camera;
10
- import android.view.SurfaceHolder;
11
-
12
- import com.rhomobile.rhodes.Logger;
13
- import com.rhomobile.rhodes.api.IMethodResult;
14
-
15
- public class CameraEclair extends CameraObject implements ICameraObject {
16
- private static final String TAG = CameraEclair.class.getSimpleName();
17
-
18
- private List<Camera.Size> mSupportedPictureSizes;
19
-
20
- CameraEclair(String id) {
21
- super(id);
22
-
23
- getPropertiesMap().put("cameraType", "back");
24
- getPropertiesMap().put("compressionFormat", "jpg");
25
- getPropertiesMap().put("outputFormat", "image");
26
- if (hasPermission()) {
27
- openCamera();
28
- Camera.Parameters params = getCamera().getParameters();
29
- closeCamera();
30
-
31
- mSupportedPictureSizes = params.getSupportedPictureSizes();
32
- ISize maxSize = null;
33
- for(android.hardware.Camera.Size size: mSupportedPictureSizes) {
34
- Logger.D(TAG, "Possible picture size: " + size.width + "X" + size.height);
35
- ISize curSize = new CameraSize(size);
36
- if ((maxSize == null) || (curSize.D2() > maxSize.D2())) {
37
- maxSize = curSize;
38
- }
39
- }
40
-
41
- getPropertiesMap().put("maxWidth", String.valueOf(maxSize.getWidth()));
42
- getPropertiesMap().put("maxHeight", String.valueOf(maxSize.getHeight()));
43
- }
44
- else {
45
- mSupportedPictureSizes = new ArrayList<Camera.Size>();
46
- Logger.E(TAG, "Application has no permission to Camera access !!!");
47
- getPropertiesMap().put("maxWidth", String.valueOf(0));
48
- getPropertiesMap().put("maxHeight", String.valueOf(0));
49
- }
50
- }
51
-
52
- @Override
53
- public void startPreview(SurfaceHolder surfaceHolder) {
54
- try {
55
- openCamera();
56
- Camera camera = getCamera();
57
-
58
- Camera.Parameters cameraParams = camera.getParameters();
59
-
60
- List<String> supportedFlashModes = cameraParams.getSupportedFlashModes();
61
- if (supportedFlashModes != null) {
62
- String flashMode = getFlashMode();
63
- if (supportedFlashModes.contains(flashMode)) {
64
- cameraParams.setFlashMode(flashMode);
65
- } else {
66
- Logger.W(TAG,"Flash mode is not supported by the camera: " + flashMode);
67
- }
68
- }
69
-
70
- List<String> supportedColorEffects = cameraParams.getSupportedColorEffects();
71
- if (supportedColorEffects != null) {
72
- String colorEffect = getColorMode();
73
- if (supportedColorEffects.contains(colorEffect)) {
74
- cameraParams.setColorEffect(colorEffect);
75
- } else {
76
- Logger.W(TAG, "Color effect is not supported by the camera: " + colorEffect);
77
- }
78
- }
79
-
80
- camera.setParameters(cameraParams);
81
-
82
- camera.setPreviewDisplay(surfaceHolder);
83
- camera.startPreview();
84
- } catch (Throwable e) {
85
- Logger.E(TAG, e);
86
- return;
87
- }
88
- }
89
-
90
- @Override
91
- public void doTakePicture(final Activity previewActivity, int rotation) {
92
- Logger.T(TAG, "doTakePicture: rotation: " + rotation);
93
- openCamera();
94
- ISize pictureSize = getDesiredSize();
95
- Camera.Parameters params = getCamera().getParameters();
96
- params.setRotation((90 + rotation) % 360);
97
- if (pictureSize != null) {
98
- params.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight());
99
- }
100
- getCamera().setParameters(params);
101
- if (hasAutoFocus()) {
102
- getCamera().autoFocus(new Camera.AutoFocusCallback() {
103
- public void onAutoFocus(boolean success, Camera camera) {
104
- openCamera();
105
- getCamera().takePicture(null, null, new TakePictureCallback(previewActivity));
106
- closeCamera();
107
- }
108
- });
109
-
110
- } else {
111
- getCamera().takePicture(null, null, new TakePictureCallback(previewActivity));
112
- }
113
- closeCamera();
114
- }
115
-
116
- protected ISize getDesiredSize() {
117
- String strDesiredWidth = getActualPropertyMap().get("desiredWidth");
118
- String strDesiredHeight = getActualPropertyMap().get("desiredHeight");
119
-
120
- if (Boolean.parseBoolean(getActualPropertyMap().get("useRealBitmapResize"))) {
121
- return null;
122
- }
123
-
124
- if (Integer.valueOf(strDesiredWidth) <= 0) {
125
- strDesiredWidth = null;
126
- }
127
- if (Integer.valueOf(strDesiredHeight) <= 0) {
128
- strDesiredHeight = null;
129
- }
130
-
131
- int minDiff = Integer.MAX_VALUE;
132
- ISize selectedSize = null;
133
-
134
- if (strDesiredWidth != null && strDesiredHeight != null) {
135
- ISize desiredSize = new RawSize(Integer.valueOf(strDesiredWidth),
136
- Integer.valueOf(strDesiredHeight));
137
- Logger.T(TAG, "Desired picture size: " + desiredSize);
138
- for(Camera.Size size: mSupportedPictureSizes) {
139
- ISize curSize = new CameraSize(size);
140
- int curDiff = Math.abs(curSize.D2() - desiredSize.D2());
141
- if (curDiff < minDiff) {
142
- minDiff = curDiff;
143
- selectedSize = curSize;
144
- }
145
- }
146
- } else if (strDesiredWidth != null) {
147
- int desiredWidth = Integer.valueOf(strDesiredWidth);
148
- Logger.T(TAG, "Desired picture width: " + desiredWidth);
149
- for(Camera.Size size: mSupportedPictureSizes) {
150
- int curDiff = Math.abs(size.width - desiredWidth);
151
- if (curDiff < minDiff) {
152
- minDiff = curDiff;
153
- selectedSize = new CameraSize(size);
154
- }
155
- }
156
- } else if (strDesiredHeight != null) {
157
- int desiredHeight = Integer.valueOf(strDesiredHeight);
158
- Logger.T(TAG, "Desired picture width: " + desiredHeight);
159
- for(Camera.Size size: mSupportedPictureSizes) {
160
- int curDiff = Math.abs(size.height - desiredHeight);
161
- if (curDiff < minDiff) {
162
- minDiff = curDiff;
163
- selectedSize = new CameraSize(size);
164
- }
165
- }
166
- }
167
- Logger.T(TAG, "Selected picture size: " + selectedSize);
168
- return selectedSize;
169
- }
170
-
171
- protected boolean hasAutoFocus() {
172
- if (!hasPermission()) {
173
- Logger.D(TAG, "Application has no permission to Camera access !!!");
174
- return false;
175
- }
176
- String focusMode = getCamera().getParameters().getFocusMode();
177
- boolean supported = false;
178
- if (focusMode != null) {
179
- supported = (focusMode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_AUTO)) || (focusMode.equals(android.hardware.Camera.Parameters.FOCUS_MODE_MACRO));
180
- }
181
- return supported;
182
-
183
- }
184
-
185
- protected String getFlashMode() {
186
- String flashParam = getActualPropertyMap().get("flashMode");
187
- String flashMode = Camera.Parameters.FLASH_MODE_AUTO;
188
- if (flashParam != null) {
189
- if (flashParam.equals("on")) {
190
- flashMode = Camera.Parameters.FLASH_MODE_ON;
191
- } else
192
- if (flashParam.equals("off")) {
193
- flashMode = Camera.Parameters.FLASH_MODE_OFF;
194
- } else
195
- if (flashParam.equals("redEye")) {
196
- flashMode = Camera.Parameters.FLASH_MODE_RED_EYE;
197
- } else
198
- if (flashParam.equals("torch")) {
199
- flashMode = Camera.Parameters.FLASH_MODE_TORCH;
200
- }
201
- }
202
- Logger.T(TAG, "Flash mode: " + flashMode);
203
- return flashMode;
204
- }
205
- protected String getColorMode() {
206
- String colorParam = getActualPropertyMap().get("colorModel");
207
- String colorMode = Camera.Parameters.EFFECT_NONE;
208
- if (colorParam != null) {
209
- if (colorParam.equals("grayscale")) {
210
- colorMode = Camera.Parameters.EFFECT_MONO;
211
- }
212
- }
213
- Logger.T(TAG, "Color effect: " + colorMode);
214
- return colorMode;
215
- }
216
-
217
- public void getSupportedSizeList(IMethodResult result) {
218
- List<Object> res = new ArrayList<Object>();
219
- for(Camera.Size size: mSupportedPictureSizes) {
220
- Map<String, Integer> resSize = new HashMap<String, Integer>();
221
- resSize.put("width", Integer.valueOf(size.width));
222
- resSize.put("height", Integer.valueOf(size.height));
223
- res.add(resSize);
224
- }
225
- result.set(res);
226
- }
227
- }
@@ -1,152 +0,0 @@
1
- package com.rho.camera;
2
-
3
- import java.io.File;
4
- import java.util.List;
5
-
6
- import android.app.Activity;
7
- import android.hardware.Camera;
8
- import android.os.Environment;
9
-
10
- import com.rhomobile.rhodes.Logger;
11
-
12
-
13
- import android.support.v4.content.PermissionChecker;
14
- import android.support.v4.content.ContextCompat;
15
- import android.content.pm.PackageManager;
16
- import com.rhomobile.rhodes.RhodesActivity;
17
- import android.Manifest;
18
-
19
- public class CameraGingerbread extends CameraEclair implements ICameraObject {
20
- private static final String TAG = CameraGingerbread.class.getSimpleName();
21
-
22
- private int mCameraUsers = 0;
23
-
24
- CameraGingerbread(String id) {
25
- super(id);
26
-
27
- getPropertiesMap().put("compressionFormat", "jpg");
28
- getPropertiesMap().put("outputFormat", "image");
29
-
30
- android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
31
- android.hardware.Camera.getCameraInfo(getCameraIndex(), info);
32
- switch (info.facing) {
33
- case android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK:
34
- getPropertiesMap().put("cameraType", "back");
35
- break;
36
- case android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT:
37
- getPropertiesMap().put("cameraType", "front");
38
- break;
39
- default:
40
- getPropertiesMap().put("cameraType", "unknown");
41
- break;
42
- }
43
-
44
- if (hasPermission()) {
45
- openCamera();
46
- Camera.Parameters params = getCamera().getParameters();
47
- closeCamera();
48
-
49
- List<android.hardware.Camera.Size> listSize = params.getSupportedPictureSizes();
50
- ISize maxSize = null;
51
- for(android.hardware.Camera.Size curSize: listSize) {
52
- Logger.D(TAG, "Possible picture size: " + curSize.width + "X" + curSize.height);
53
- if ((maxSize == null) || (curSize.width > maxSize.getWidth())) {
54
- maxSize = new CameraSize(curSize);
55
- }
56
- }
57
-
58
- getPropertiesMap().put("maxWidth", String.valueOf(maxSize.getWidth()));
59
- getPropertiesMap().put("maxHeight", String.valueOf(maxSize.getHeight()));
60
- }
61
- else {
62
- Logger.E(TAG, "Application has no permission to Camera access !!!");
63
- getPropertiesMap().put("maxWidth", String.valueOf(0));
64
- getPropertiesMap().put("maxHeight", String.valueOf(0));
65
- }
66
- }
67
-
68
-
69
- @Override synchronized
70
- protected void openCamera() {
71
- if (hasPermission()) {
72
- if (mCameraUsers == 0) {
73
- setCamera(Camera.open(getCameraIndex()));
74
- }
75
- mCameraUsers++;
76
- }
77
- }
78
-
79
- @Override synchronized
80
- protected void closeCamera() {
81
- if (hasPermission()) {
82
- mCameraUsers--;
83
- if (mCameraUsers == 0) {
84
- getCamera().release();
85
- }
86
- }
87
- }
88
-
89
-
90
- protected String getTemporaryPath(String targetPath) {
91
- if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
92
- File externalRoot = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
93
- if (! externalRoot.exists()){
94
- if (! externalRoot.mkdirs()){
95
- Logger.E(TAG, "Failed to create directory: " + externalRoot);
96
- return null;
97
- }
98
- }
99
- String filename = new File(targetPath).getName();
100
- return new File(externalRoot, filename).getAbsolutePath();
101
- } else {
102
- return null;
103
- }
104
- }
105
- @Override
106
- public void doTakePicture(final Activity previewActivity, int rotation) {
107
- Logger.T(TAG, "doTakePicture: rotation: " + rotation);
108
- android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
109
- android.hardware.Camera.getCameraInfo(getCameraIndex(), info);
110
- openCamera();
111
- ISize pictureSize = getDesiredSize();
112
- Camera.Parameters params = getCamera().getParameters();
113
- if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
114
- params.setRotation((info.orientation - rotation + 360) % 360);
115
- } else {
116
- params.setRotation((info.orientation + rotation) % 360);
117
- }
118
- if (pictureSize != null) {
119
- params.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight());
120
- }
121
- getCamera().setParameters(params);
122
- getCamera().takePicture(null, null, new TakePictureCallback(previewActivity));
123
-
124
- // commented the code because auto focus logic is moved as soon as camera previews not on button click
125
- /*if (hasAutoFocus()) {
126
- getCamera().autoFocus(new Camera.AutoFocusCallback() {
127
- public void onAutoFocus(boolean success, Camera camera) {
128
-
129
- openCamera();
130
- getCamera().takePicture(null, null, new TakePictureCallback(previewActivity));
131
- closeCamera();
132
- }
133
- });
134
-
135
- } else {
136
- getCamera().takePicture(null, null, new TakePictureCallback(previewActivity));
137
- }*/
138
- closeCamera();
139
- }
140
-
141
- public boolean hasPermission() {
142
- boolean res = (PermissionChecker.checkSelfPermission(RhodesActivity.getContext(), Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED);
143
- if (!res) {
144
- Logger.E(TAG, "Application has no permission to Camera access !!!");
145
- }
146
- //else {
147
- // Logger.E(TAG, "Application has permission to Camera access !!!");
148
- //}
149
- return res;
150
- }
151
-
152
- }