rhodes 3.2.1 → 3.2.2.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/Manifest.txt +36 -0
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +24 -3
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/CaptureActivity.java +11 -280
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/camera/CameraManager.java +11 -4
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +2 -1
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +36 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.h +25 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +195 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.h +59 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +346 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.h +7 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.mm +58 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactoryRegister.mm +18 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.h +16 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.mm +32 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +9 -2
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h +45 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h +7 -1
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderView.h +21 -4
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarReaderViewController.h +32 -2
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarSDK.h +1 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h +26 -5
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Decoder.h +1 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Symbol.h +2 -3
- data/lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/libzbar.a +0 -0
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode.i +3 -2
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +7 -4
- data/lib/extensions/barcode/ext/barcode/shared/src/zbar.c +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +7 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraOldService.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +8 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraService.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +11 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +21 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +33 -11
- data/platform/android/build/android.rake +63 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/icon.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +6 -4
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -1
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +4 -1
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +4 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Scripting.dll +0 -0
- data/res/generators/rhogen.rb +191 -0
- data/res/generators/templates/extension/app/MontanaTest/controller.rb +20 -0
- data/res/generators/templates/extension/app/MontanaTest/index.erb +17 -0
- data/res/generators/templates/extension/extensions/montana/ext.yml +4 -0
- data/res/generators/templates/extension/extensions/montana/ext/build +17 -0
- data/res/generators/templates/extension/extensions/montana/ext/build.bat +36 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/Rakefile +77 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/ext_build.files +1 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/jni/src/montana.cpp +28 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/src/com/montana/Montana.java +10 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Montana.files +1 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Rakefile +97 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/montana.jdp +48 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/src/com/montana/Montana.java +118 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.h +4 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.m +24 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj +300 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana_Prefix.pch +7 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile +74 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.vcproj +331 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile +62 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.cpp +40 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.h +2 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana.i +15 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c +2287 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/shared/src/montana.c +20 -0
- data/res/generators/templates/extension/extensions/montana/montana.rb +13 -0
- data/spec/framework_spec/build.yml +1 -1
- data/spec/phone_spec/build.yml +1 -1
- data/version +1 -1
- metadata +42 -5
@@ -64,6 +64,7 @@ public final class CameraManager {
|
|
64
64
|
private final Context context;
|
65
65
|
private final CameraConfigurationManager configManager;
|
66
66
|
private Camera camera;
|
67
|
+
private int mCameraIndex = 0;
|
67
68
|
private Rect framingRect;
|
68
69
|
private Rect framingRectInPreview;
|
69
70
|
private boolean initialized;
|
@@ -82,9 +83,9 @@ public final class CameraManager {
|
|
82
83
|
*
|
83
84
|
* @param context The Activity which wants to use the camera.
|
84
85
|
*/
|
85
|
-
public static void init(Context context) {
|
86
|
+
public static void init(Context context, int camera_index) {
|
86
87
|
if (cameraManager == null) {
|
87
|
-
cameraManager = new CameraManager(context);
|
88
|
+
cameraManager = new CameraManager(context, camera_index);
|
88
89
|
}
|
89
90
|
}
|
90
91
|
|
@@ -97,8 +98,9 @@ public final class CameraManager {
|
|
97
98
|
return cameraManager;
|
98
99
|
}
|
99
100
|
|
100
|
-
private CameraManager(Context context) {
|
101
|
+
private CameraManager(Context context, int camera_index) {
|
101
102
|
|
103
|
+
this.mCameraIndex = camera_index;
|
102
104
|
this.context = context;
|
103
105
|
this.configManager = new CameraConfigurationManager(context);
|
104
106
|
|
@@ -121,7 +123,12 @@ public final class CameraManager {
|
|
121
123
|
*/
|
122
124
|
public void openDriver(SurfaceHolder holder) throws IOException {
|
123
125
|
if (camera == null) {
|
124
|
-
|
126
|
+
if (mCameraIndex == 0) {
|
127
|
+
camera = Camera.open();
|
128
|
+
}
|
129
|
+
else {
|
130
|
+
camera = com.rhomobile.rhodes.camera.Camera.getCameraService().getFrontCamera();
|
131
|
+
}
|
125
132
|
if (camera == null) {
|
126
133
|
throw new IOException();
|
127
134
|
}
|
data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java
CHANGED
@@ -65,13 +65,14 @@ public class Barcode {
|
|
65
65
|
|
66
66
|
private static String ourCallback = null;
|
67
67
|
|
68
|
-
public static void take(String callback) {
|
68
|
+
public static void take(String callback, int camera_index) {
|
69
69
|
ourCallback = callback;
|
70
70
|
|
71
71
|
// PerformOnUiThread.exec( new Runnable() {
|
72
72
|
// public void run() {
|
73
73
|
RhodesActivity ra = RhodesActivity.safeGetInstance();
|
74
74
|
Intent intent = new Intent(ra, com.google.zxing.client.android.CaptureActivity.class);
|
75
|
+
intent.putExtra(com.google.zxing.client.android.CaptureActivity.CAMERA_INDEX_EXTRA, camera_index);
|
75
76
|
ra.startActivity(intent);
|
76
77
|
// }
|
77
78
|
// });
|
@@ -18,6 +18,15 @@
|
|
18
18
|
FA4D3F4E136B07B2009D6E63 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA4D3F4D136B07B2009D6E63 /* CoreMedia.framework */; };
|
19
19
|
FA4D3F50136B07BB009D6E63 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA4D3F4F136B07BB009D6E63 /* CoreVideo.framework */; };
|
20
20
|
FA4D3F52136B07CA009D6E63 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA4D3F51136B07CA009D6E63 /* libiconv.dylib */; };
|
21
|
+
FAA838881455B0BA0002F4E6 /* BarcodeViewFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA838831455B0BA0002F4E6 /* BarcodeViewFactory.h */; };
|
22
|
+
FAA838891455B0BA0002F4E6 /* BarcodeViewFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAA838841455B0BA0002F4E6 /* BarcodeViewFactory.mm */; };
|
23
|
+
FAA8388A1455B0BA0002F4E6 /* BarcodeViewFactoryRegister.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAA838851455B0BA0002F4E6 /* BarcodeViewFactoryRegister.mm */; };
|
24
|
+
FAA8388B1455B0BA0002F4E6 /* BarcodeViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA838861455B0BA0002F4E6 /* BarcodeViewManager.h */; };
|
25
|
+
FAA8388C1455B0BA0002F4E6 /* BarcodeViewManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAA838871455B0BA0002F4E6 /* BarcodeViewManager.mm */; };
|
26
|
+
FAA838901455B1F60002F4E6 /* BarcodeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA8388E1455B1F60002F4E6 /* BarcodeViewController.h */; };
|
27
|
+
FAA838911455B1F60002F4E6 /* BarcodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FAA8388F1455B1F60002F4E6 /* BarcodeViewController.m */; };
|
28
|
+
FAA839321455F7210002F4E6 /* BarcodeCallbackHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = FAA839301455F7210002F4E6 /* BarcodeCallbackHelper.h */; };
|
29
|
+
FAA839331455F7210002F4E6 /* BarcodeCallbackHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAA839311455F7210002F4E6 /* BarcodeCallbackHelper.mm */; };
|
21
30
|
FAAE06AD11EF4F02001787D8 /* ImageProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAAE06AA11EF4F02001787D8 /* ImageProvider.cpp */; };
|
22
31
|
FAAE06AE11EF4F02001787D8 /* ImageProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = FAAE06AB11EF4F02001787D8 /* ImageProvider.h */; };
|
23
32
|
FAAE06AF11EF4F02001787D8 /* ImageProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAAE06AC11EF4F02001787D8 /* ImageProvider.mm */; };
|
@@ -38,6 +47,15 @@
|
|
38
47
|
FA4D3F4D136B07B2009D6E63 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
|
39
48
|
FA4D3F4F136B07BB009D6E63 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
|
40
49
|
FA4D3F51136B07CA009D6E63 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
|
50
|
+
FAA838831455B0BA0002F4E6 /* BarcodeViewFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BarcodeViewFactory.h; path = Classes/BarcodeViewFactory.h; sourceTree = "<group>"; };
|
51
|
+
FAA838841455B0BA0002F4E6 /* BarcodeViewFactory.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BarcodeViewFactory.mm; path = Classes/BarcodeViewFactory.mm; sourceTree = "<group>"; };
|
52
|
+
FAA838851455B0BA0002F4E6 /* BarcodeViewFactoryRegister.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BarcodeViewFactoryRegister.mm; path = Classes/BarcodeViewFactoryRegister.mm; sourceTree = "<group>"; };
|
53
|
+
FAA838861455B0BA0002F4E6 /* BarcodeViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BarcodeViewManager.h; path = Classes/BarcodeViewManager.h; sourceTree = "<group>"; };
|
54
|
+
FAA838871455B0BA0002F4E6 /* BarcodeViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BarcodeViewManager.mm; path = Classes/BarcodeViewManager.mm; sourceTree = "<group>"; };
|
55
|
+
FAA8388E1455B1F60002F4E6 /* BarcodeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BarcodeViewController.h; path = Classes/BarcodeViewController.h; sourceTree = "<group>"; };
|
56
|
+
FAA8388F1455B1F60002F4E6 /* BarcodeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BarcodeViewController.m; path = Classes/BarcodeViewController.m; sourceTree = "<group>"; };
|
57
|
+
FAA839301455F7210002F4E6 /* BarcodeCallbackHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BarcodeCallbackHelper.h; path = Classes/BarcodeCallbackHelper.h; sourceTree = "<group>"; };
|
58
|
+
FAA839311455F7210002F4E6 /* BarcodeCallbackHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BarcodeCallbackHelper.mm; path = Classes/BarcodeCallbackHelper.mm; sourceTree = "<group>"; };
|
41
59
|
FAAE06AA11EF4F02001787D8 /* ImageProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ImageProvider.cpp; path = Classes/ImageProvider.cpp; sourceTree = "<group>"; };
|
42
60
|
FAAE06AB11EF4F02001787D8 /* ImageProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageProvider.h; path = Classes/ImageProvider.h; sourceTree = "<group>"; };
|
43
61
|
FAAE06AC11EF4F02001787D8 /* ImageProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ImageProvider.mm; path = Classes/ImageProvider.mm; sourceTree = "<group>"; };
|
@@ -104,6 +122,15 @@
|
|
104
122
|
08FB77AEFE84172EC02AAC07 /* Classes */ = {
|
105
123
|
isa = PBXGroup;
|
106
124
|
children = (
|
125
|
+
FAA839301455F7210002F4E6 /* BarcodeCallbackHelper.h */,
|
126
|
+
FAA839311455F7210002F4E6 /* BarcodeCallbackHelper.mm */,
|
127
|
+
FAA8388E1455B1F60002F4E6 /* BarcodeViewController.h */,
|
128
|
+
FAA8388F1455B1F60002F4E6 /* BarcodeViewController.m */,
|
129
|
+
FAA838831455B0BA0002F4E6 /* BarcodeViewFactory.h */,
|
130
|
+
FAA838841455B0BA0002F4E6 /* BarcodeViewFactory.mm */,
|
131
|
+
FAA838851455B0BA0002F4E6 /* BarcodeViewFactoryRegister.mm */,
|
132
|
+
FAA838861455B0BA0002F4E6 /* BarcodeViewManager.h */,
|
133
|
+
FAA838871455B0BA0002F4E6 /* BarcodeViewManager.mm */,
|
107
134
|
FA4D3F0E136AFA94009D6E63 /* barcode.m */,
|
108
135
|
FAAE06AA11EF4F02001787D8 /* ImageProvider.cpp */,
|
109
136
|
FAAE06AB11EF4F02001787D8 /* ImageProvider.h */,
|
@@ -154,6 +181,10 @@
|
|
154
181
|
files = (
|
155
182
|
AA747D9F0F9514B9006C5449 /* Barcode_Prefix.pch in Headers */,
|
156
183
|
FAAE06AE11EF4F02001787D8 /* ImageProvider.h in Headers */,
|
184
|
+
FAA838881455B0BA0002F4E6 /* BarcodeViewFactory.h in Headers */,
|
185
|
+
FAA8388B1455B0BA0002F4E6 /* BarcodeViewManager.h in Headers */,
|
186
|
+
FAA838901455B1F60002F4E6 /* BarcodeViewController.h in Headers */,
|
187
|
+
FAA839321455F7210002F4E6 /* BarcodeCallbackHelper.h in Headers */,
|
157
188
|
);
|
158
189
|
runOnlyForDeploymentPostprocessing = 0;
|
159
190
|
};
|
@@ -211,6 +242,11 @@
|
|
211
242
|
FAAE06AF11EF4F02001787D8 /* ImageProvider.mm in Sources */,
|
212
243
|
FAAE072811EF4F22001787D8 /* barcode_wrap.c in Sources */,
|
213
244
|
FA4D3F0F136AFA94009D6E63 /* barcode.m in Sources */,
|
245
|
+
FAA838891455B0BA0002F4E6 /* BarcodeViewFactory.mm in Sources */,
|
246
|
+
FAA8388A1455B0BA0002F4E6 /* BarcodeViewFactoryRegister.mm in Sources */,
|
247
|
+
FAA8388C1455B0BA0002F4E6 /* BarcodeViewManager.mm in Sources */,
|
248
|
+
FAA838911455B1F60002F4E6 /* BarcodeViewController.m in Sources */,
|
249
|
+
FAA839331455F7210002F4E6 /* BarcodeCallbackHelper.mm in Sources */,
|
214
250
|
);
|
215
251
|
runOnlyForDeploymentPostprocessing = 0;
|
216
252
|
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
#import <UIKit/UIKit.h>
|
4
|
+
#import <Foundation/Foundation.h>
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
#ifdef __cplusplus
|
12
|
+
extern "C" {
|
13
|
+
#endif //__cplusplus
|
14
|
+
|
15
|
+
void Barcode_executeRhoCallBackWithParams(NSString* callbackURL,
|
16
|
+
NSString* intName, int intValue,
|
17
|
+
NSString* str1Name, NSString* str1Value,
|
18
|
+
NSString* str2Name, NSString* str2Value,
|
19
|
+
NSString* str3Name, NSString* str3Value,
|
20
|
+
NSString* dataName, NSData* dataValue
|
21
|
+
);
|
22
|
+
|
23
|
+
#ifdef __cplusplus
|
24
|
+
}
|
25
|
+
#endif //__cplusplus
|
@@ -0,0 +1,195 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
// rhodes/platform/shared/rubyext/WebView.h
|
5
|
+
#import "rubyext/WebView.h"
|
6
|
+
//void rho_webview_navigate(const char* url, int index);
|
7
|
+
|
8
|
+
|
9
|
+
// rhodes/platform/shared/common/RhodesApp.h
|
10
|
+
#import "common/RhodesApp.h"
|
11
|
+
//void rho_net_request(const char *url);
|
12
|
+
//char* rho_http_normalizeurl(const char* szUrl);
|
13
|
+
|
14
|
+
//#include "net/INetRequest.h"
|
15
|
+
|
16
|
+
#include "ruby/ext/rho/rhoruby.h"
|
17
|
+
|
18
|
+
#include <string.h>
|
19
|
+
|
20
|
+
#import "BarcodeCallbackHelper.h"
|
21
|
+
|
22
|
+
|
23
|
+
/*
|
24
|
+
VALUE rho_ruby_create_string(const char* szVal);
|
25
|
+
VALUE rho_ruby_create_string_withlen(int len);
|
26
|
+
VALUE rho_ruby_create_boolean(unsigned char b);
|
27
|
+
VALUE rho_ruby_create_integer(__int64 i);
|
28
|
+
VALUE rho_ruby_create_double(double d);
|
29
|
+
VALUE rho_ruby_create_time(long t);
|
30
|
+
void rho_ruby_add_to_array(VALUE ar, VALUE val);
|
31
|
+
|
32
|
+
time_t rho_ruby_get_time(VALUE rTime);
|
33
|
+
|
34
|
+
VALUE rho_ruby_create_byte_array(unsigned char* buf, int length);
|
35
|
+
int rho_ruby_unpack_byte_array(VALUE array_value, unsigned char* buf, int max_length);
|
36
|
+
|
37
|
+
*/
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
class BarcodeRhoCallbackIntContainer : public rho::ICallbackObject
|
42
|
+
{
|
43
|
+
public:
|
44
|
+
BarcodeRhoCallbackIntContainer(int number)
|
45
|
+
{
|
46
|
+
mNumber = number;
|
47
|
+
}
|
48
|
+
virtual ~BarcodeRhoCallbackIntContainer() {
|
49
|
+
}
|
50
|
+
|
51
|
+
// return Ruby object
|
52
|
+
virtual unsigned long getObjectValue() {
|
53
|
+
unsigned long rrr = rho_ruby_create_integer(mNumber);
|
54
|
+
return rrr;
|
55
|
+
}
|
56
|
+
|
57
|
+
private:
|
58
|
+
int mNumber;
|
59
|
+
|
60
|
+
};
|
61
|
+
|
62
|
+
class BarcodeRhoCallbackStringContainer : public rho::ICallbackObject
|
63
|
+
{
|
64
|
+
public:
|
65
|
+
BarcodeRhoCallbackStringContainer(NSString* str)
|
66
|
+
{
|
67
|
+
const char* utf8str = [str UTF8String];
|
68
|
+
mString = new char[strlen(utf8str) + 1];
|
69
|
+
strcpy(mString, utf8str);
|
70
|
+
}
|
71
|
+
virtual ~BarcodeRhoCallbackStringContainer() {
|
72
|
+
delete mString;
|
73
|
+
}
|
74
|
+
|
75
|
+
// return Ruby object
|
76
|
+
virtual unsigned long getObjectValue() {
|
77
|
+
unsigned long rrr = rho_ruby_create_string((const char*)mString);
|
78
|
+
return rrr;
|
79
|
+
}
|
80
|
+
|
81
|
+
private:
|
82
|
+
char* mString;
|
83
|
+
|
84
|
+
};
|
85
|
+
|
86
|
+
class BarcodeRhoCallbackDataContainer : public rho::ICallbackObject
|
87
|
+
{
|
88
|
+
public:
|
89
|
+
BarcodeRhoCallbackDataContainer(NSData* data)
|
90
|
+
{
|
91
|
+
mDataSize = [data length];
|
92
|
+
mData = new unsigned char[mDataSize+1];
|
93
|
+
[data getBytes:mData length:mDataSize];
|
94
|
+
}
|
95
|
+
virtual ~BarcodeRhoCallbackDataContainer() {
|
96
|
+
delete mData;
|
97
|
+
}
|
98
|
+
|
99
|
+
// return Ruby object
|
100
|
+
virtual unsigned long getObjectValue() {
|
101
|
+
return rho_ruby_create_byte_array(mData, mDataSize);
|
102
|
+
}
|
103
|
+
|
104
|
+
private:
|
105
|
+
unsigned char* mData;
|
106
|
+
int mDataSize;
|
107
|
+
|
108
|
+
};
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
#ifdef __cplusplus
|
113
|
+
extern "C" {
|
114
|
+
#endif //__cplusplus
|
115
|
+
|
116
|
+
|
117
|
+
void Barcode_executeRhoCallBackWithParams(NSString* callbackURL,
|
118
|
+
NSString* intName, int intValue,
|
119
|
+
NSString* str1Name, NSString* str1Value,
|
120
|
+
NSString* str2Name, NSString* str2Value,
|
121
|
+
NSString* str3Name, NSString* str3Value,
|
122
|
+
NSString* dataName, NSData* dataValue
|
123
|
+
)
|
124
|
+
{
|
125
|
+
NSString* strBody = @"&rho_callback=1";
|
126
|
+
|
127
|
+
if (intName != nil) {
|
128
|
+
strBody = [strBody stringByAppendingString:@"&"];
|
129
|
+
|
130
|
+
//NSNumber *number = [NSNumber numberWithInt:intValue];
|
131
|
+
//NSString* intValueStr = [NSString stringWithFormat:@"%@",number];
|
132
|
+
//NSString* strParam = @"";
|
133
|
+
//strParam = [strParam stringByAppendingString:intName];
|
134
|
+
//strParam = [strParam stringByAppendingString:@"="];
|
135
|
+
//strParam = [strParam stringByAppendingString:intValueStr];
|
136
|
+
NSString* strParam = [NSString stringWithUTF8String:(RHODESAPP().addCallbackObject( new BarcodeRhoCallbackIntContainer(intValue), [intName UTF8String]).c_str())];
|
137
|
+
|
138
|
+
strBody = [strBody stringByAppendingString:strParam];
|
139
|
+
}
|
140
|
+
if ((str1Name != nil) && (str1Value != null)) {
|
141
|
+
strBody = [strBody stringByAppendingString:@"&"];
|
142
|
+
|
143
|
+
//NSString* strParam = @"";
|
144
|
+
//strParam = [strParam stringByAppendingString:str1Name];
|
145
|
+
//strParam = [strParam stringByAppendingString:@"="];
|
146
|
+
//strParam = [strParam stringByAppendingString:str1Value];
|
147
|
+
NSString* strParam = [NSString stringWithUTF8String:(RHODESAPP().addCallbackObject( new BarcodeRhoCallbackStringContainer(str1Value), [str1Name UTF8String]).c_str())];
|
148
|
+
|
149
|
+
strBody = [strBody stringByAppendingString:strParam];
|
150
|
+
}
|
151
|
+
if ((str2Name != nil) && (str2Value != null)) {
|
152
|
+
strBody = [strBody stringByAppendingString:@"&"];
|
153
|
+
|
154
|
+
//NSString* strParam = @"";
|
155
|
+
//strParam = [strParam stringByAppendingString:str2Name];
|
156
|
+
//strParam = [strParam stringByAppendingString:@"="];
|
157
|
+
//strParam = [strParam stringByAppendingString:str2Value];
|
158
|
+
NSString* strParam = [NSString stringWithUTF8String:(RHODESAPP().addCallbackObject( new BarcodeRhoCallbackStringContainer(str2Value), [str2Name UTF8String]).c_str())];
|
159
|
+
|
160
|
+
strBody = [strBody stringByAppendingString:strParam];
|
161
|
+
}
|
162
|
+
if ((str3Name != nil) && (str3Value != null)) {
|
163
|
+
strBody = [strBody stringByAppendingString:@"&"];
|
164
|
+
|
165
|
+
//NSString* strParam = @"";
|
166
|
+
//strParam = [strParam stringByAppendingString:str3Name];
|
167
|
+
//strParam = [strParam stringByAppendingString:@"="];
|
168
|
+
//strParam = [strParam stringByAppendingString:str3Value];
|
169
|
+
NSString* strParam = [NSString stringWithUTF8String:(RHODESAPP().addCallbackObject( new BarcodeRhoCallbackStringContainer(str3Value), [str3Name UTF8String]).c_str())];
|
170
|
+
|
171
|
+
strBody = [strBody stringByAppendingString:strParam];
|
172
|
+
}
|
173
|
+
if (dataName != nil) {
|
174
|
+
strBody = [strBody stringByAppendingString:@"&"];
|
175
|
+
NSString* strParam = [NSString stringWithUTF8String:(RHODESAPP().addCallbackObject( new BarcodeRhoCallbackDataContainer(dataValue), [dataName UTF8String]).c_str())];
|
176
|
+
strBody = [strBody stringByAppendingString:strParam];
|
177
|
+
}
|
178
|
+
|
179
|
+
const char* cb = [callbackURL UTF8String];
|
180
|
+
const char* b = [strBody UTF8String];
|
181
|
+
char* norm_url = rho_http_normalizeurl(cb);
|
182
|
+
|
183
|
+
rho_net_request_with_data(rho_http_normalizeurl(cb), b);
|
184
|
+
|
185
|
+
rho_http_free(norm_url);
|
186
|
+
|
187
|
+
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
#ifdef __cplusplus
|
192
|
+
}
|
193
|
+
#endif //__cplusplus
|
194
|
+
|
195
|
+
|
@@ -0,0 +1,59 @@
|
|
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
|
+
#import <UIKit/UIKit.h>
|
28
|
+
//#import "RhoMainView.h"
|
29
|
+
//#import "RhoViewController.h"
|
30
|
+
//#import "ZBarSDK/Headers/ZBarSDK/ZBarSDK.h"
|
31
|
+
#import "ZBarSDK.h"
|
32
|
+
|
33
|
+
|
34
|
+
@interface BarcodeViewController : UIViewController <ZBarReaderViewDelegate> {
|
35
|
+
UIView *signatureView;
|
36
|
+
UIToolbar *toolbar;
|
37
|
+
|
38
|
+
ZBarReaderView *readerView;
|
39
|
+
UITextView *resultText;
|
40
|
+
ZBarCameraSimulator *cameraSim;
|
41
|
+
|
42
|
+
NSString* callback_url;
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
@property (nonatomic, retain) ZBarReaderView *readerView;
|
47
|
+
@property (nonatomic, retain) UITextView *resultText;
|
48
|
+
@property (nonatomic, retain) NSString* callback_url;
|
49
|
+
|
50
|
+
|
51
|
+
+(void)createBarcodeView:(NSString*) callback;
|
52
|
+
|
53
|
+
- (id)initWithRect:(CGRect)rect;
|
54
|
+
|
55
|
+
- (void)loadView;
|
56
|
+
|
57
|
+
+(UIView*) getCurrentView;
|
58
|
+
|
59
|
+
@end
|
@@ -0,0 +1,346 @@
|
|
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
|
+
#import "BarcodeViewController.h"
|
28
|
+
#import "BarcodeViewManager.h"
|
29
|
+
|
30
|
+
//#import "AppManager.h"
|
31
|
+
//#import "Rhodes.h"
|
32
|
+
#import "common/RhodesApp.h"
|
33
|
+
|
34
|
+
#include "common/RhoConf.h"
|
35
|
+
#include "common/RhodesApp.h"
|
36
|
+
#include "logging/RhoLog.h"
|
37
|
+
|
38
|
+
#undef DEFAULT_LOGCATEGORY
|
39
|
+
#define DEFAULT_LOGCATEGORY "BarcodeViewController"
|
40
|
+
|
41
|
+
#include "BarcodeCallbackHelper.h"
|
42
|
+
|
43
|
+
static BarcodeViewController* bv = nil;
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
@interface RhoCreateBarcodeViewTask : NSObject {}
|
48
|
+
|
49
|
+
+ (void)run:(NSString*)value;
|
50
|
+
|
51
|
+
@end
|
52
|
+
|
53
|
+
@implementation RhoCreateBarcodeViewTask
|
54
|
+
|
55
|
+
static RhoCreateBarcodeViewTask* instance_create = nil;
|
56
|
+
|
57
|
+
-(void)runCommand:(NSString*)callback {
|
58
|
+
//if (mc) {
|
59
|
+
// [mc close];
|
60
|
+
// mc = nil;
|
61
|
+
//}
|
62
|
+
BarcodeViewController* bvc = [[BarcodeViewController alloc] initWithCallback:callback];
|
63
|
+
bv = bvc;
|
64
|
+
[BarcodeViewManager openView];
|
65
|
+
|
66
|
+
}
|
67
|
+
|
68
|
+
+(void) run:(NSString*)value {
|
69
|
+
if (instance_create == nil) {
|
70
|
+
instance_create = [[RhoCreateBarcodeViewTask alloc] init];
|
71
|
+
}
|
72
|
+
[instance_create performSelectorOnMainThread:@selector(runCommand:) withObject:value waitUntilDone:NO];
|
73
|
+
}
|
74
|
+
|
75
|
+
@end
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
@implementation BarcodeViewController
|
84
|
+
|
85
|
+
|
86
|
+
+(void)createBarcodeView:(NSString*) callback {
|
87
|
+
[RhoCreateBarcodeViewTask run:callback];
|
88
|
+
}
|
89
|
+
|
90
|
+
|
91
|
+
- (id)initWithCallback:(NSString*)callback {
|
92
|
+
[self initWithRect:CGRectMake(0,0,320,460)];
|
93
|
+
callback_url = callback;
|
94
|
+
return self;
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
- (id)initWithRect:(CGRect)rect{
|
100
|
+
[self init];
|
101
|
+
|
102
|
+
self.view.frame = rect;
|
103
|
+
|
104
|
+
//content.backgroundColor = [UIColor redColor];
|
105
|
+
//1ontent.backgroundColor = [UIColor groupTableViewBackgroundColor];
|
106
|
+
|
107
|
+
toolbar = [[UIToolbar alloc] init];
|
108
|
+
toolbar.barStyle = UIBarStyleBlack;
|
109
|
+
|
110
|
+
toolbar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
|
111
|
+
toolbar.autoresizesSubviews = YES;
|
112
|
+
|
113
|
+
{
|
114
|
+
UIBarButtonItem *btn_fixed = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
115
|
+
UIBarButtonItem* btn_cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(doCancel:)];
|
116
|
+
UIBarButtonItem* btn_space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
117
|
+
|
118
|
+
NSMutableArray *btns = [NSMutableArray arrayWithCapacity:6];
|
119
|
+
[btns addObject:btn_fixed];
|
120
|
+
[btns addObject:btn_cancel];
|
121
|
+
[btns addObject:btn_fixed];
|
122
|
+
[btns addObject:btn_space];
|
123
|
+
|
124
|
+
[btn_fixed release];
|
125
|
+
[btn_cancel release];
|
126
|
+
[btn_space release];
|
127
|
+
|
128
|
+
[toolbar setItems:btns];
|
129
|
+
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
[toolbar sizeToFit];
|
134
|
+
CGRect srect = self.view.frame;
|
135
|
+
CGRect trect = toolbar.frame;
|
136
|
+
srect.size.height -= trect.size.height;
|
137
|
+
srect.origin.y = 0;
|
138
|
+
trect.origin.x = 0;
|
139
|
+
trect.origin.y = srect.origin.y+srect.size.height;
|
140
|
+
trect.size.width = srect.size.width;
|
141
|
+
toolbar.frame = trect;
|
142
|
+
toolbar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
|
143
|
+
|
144
|
+
CGRect rrect = srect;
|
145
|
+
srect.size.height -= 40;
|
146
|
+
rrect.size.height = 40;
|
147
|
+
rrect.origin.y += srect.size.height;
|
148
|
+
|
149
|
+
resultText = [[UITextView alloc] initWithFrame:rrect];
|
150
|
+
resultText.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
|
151
|
+
resultText.autoresizesSubviews = YES;
|
152
|
+
resultText.frame = rrect;
|
153
|
+
resultText.textAlignment = UITextAlignmentCenter;
|
154
|
+
resultText.font = [resultText.font fontWithSize:22];
|
155
|
+
|
156
|
+
readerView = [[ZBarReaderView alloc] initWithImageScanner:[[ZBarImageScanner alloc] init]];//initWithFrame:srect];//CGRectZero];
|
157
|
+
|
158
|
+
readerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
159
|
+
readerView.autoresizesSubviews = YES;
|
160
|
+
readerView.frame = srect;
|
161
|
+
|
162
|
+
//signatureView = [[SignatureView alloc] initWithFrame:CGRectZero];
|
163
|
+
//signatureView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
164
|
+
//signatureView.autoresizesSubviews = YES;
|
165
|
+
//signatureView.frame = srect;
|
166
|
+
|
167
|
+
[self.view addSubview:readerView];
|
168
|
+
[self.view addSubview:resultText];
|
169
|
+
[self.view addSubview:toolbar];
|
170
|
+
|
171
|
+
//[readerView start];
|
172
|
+
|
173
|
+
// the delegate receives decode results
|
174
|
+
readerView.readerDelegate = self;
|
175
|
+
|
176
|
+
// you can use this to support the simulator
|
177
|
+
if(TARGET_IPHONE_SIMULATOR) {
|
178
|
+
cameraSim = [[ZBarCameraSimulator alloc]
|
179
|
+
initWithViewController: self];
|
180
|
+
cameraSim.readerView = readerView;
|
181
|
+
}
|
182
|
+
|
183
|
+
[self.view layoutSubviews];
|
184
|
+
|
185
|
+
|
186
|
+
return self;
|
187
|
+
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
// Implement loadView to create a view hierarchy programmatically, without using a nib.
|
192
|
+
- (void)loadView {
|
193
|
+
UIView* content = [[UIView alloc] initWithFrame:CGRectZero];
|
194
|
+
content.autoresizesSubviews = YES;
|
195
|
+
|
196
|
+
self.view = content;
|
197
|
+
[content release];
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
}
|
203
|
+
|
204
|
+
- (void)doDone:(id)sender {
|
205
|
+
if (callback_url == nil) {
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
|
209
|
+
Barcode_executeRhoCallBackWithParams(callback_url, nil,0,
|
210
|
+
@"status", @"ok",
|
211
|
+
@"barcode", resultText.text,
|
212
|
+
nil, nil, nil, nil);
|
213
|
+
|
214
|
+
|
215
|
+
/*
|
216
|
+
NSString* strBody = @"";
|
217
|
+
strBody = [strBody stringByAppendingString:@"&rho_callback=1&status=ok"];
|
218
|
+
strBody = [strBody stringByAppendingString:@"&barcode="];
|
219
|
+
strBody = [strBody stringByAppendingString:resultText.text];
|
220
|
+
char* norm_url = rho_http_normalizeurl([callback_url UTF8String]);
|
221
|
+
rho_net_request_with_data(norm_url, [strBody UTF8String]);
|
222
|
+
rho_http_free(norm_url);
|
223
|
+
*/
|
224
|
+
[BarcodeViewManager closeView];
|
225
|
+
}
|
226
|
+
|
227
|
+
- (void)doCancel:(id)sender {
|
228
|
+
if (callback_url == nil) {
|
229
|
+
return;
|
230
|
+
}
|
231
|
+
Barcode_executeRhoCallBackWithParams(callback_url, nil,0,
|
232
|
+
@"status", @"cancel",
|
233
|
+
nil, nil,
|
234
|
+
nil, nil, nil, nil);
|
235
|
+
|
236
|
+
[BarcodeViewManager closeView];
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
///*
|
242
|
+
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
243
|
+
- (void)viewDidLoad {
|
244
|
+
[super viewDidLoad];
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
//[self.view
|
250
|
+
}
|
251
|
+
//*/
|
252
|
+
|
253
|
+
|
254
|
+
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
255
|
+
}
|
256
|
+
|
257
|
+
- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient
|
258
|
+
duration: (NSTimeInterval) duration
|
259
|
+
{
|
260
|
+
// compensate for view rotation so camera preview is not rotated
|
261
|
+
[readerView willRotateToInterfaceOrientation: orient
|
262
|
+
duration: duration];
|
263
|
+
}
|
264
|
+
|
265
|
+
- (void) viewDidAppear: (BOOL) animated
|
266
|
+
{
|
267
|
+
// run the reader when the view is visible
|
268
|
+
[readerView start];
|
269
|
+
}
|
270
|
+
|
271
|
+
- (void) viewWillDisappear: (BOOL) animated
|
272
|
+
{
|
273
|
+
[readerView stop];
|
274
|
+
}
|
275
|
+
|
276
|
+
- (void) readerView: (ZBarReaderView*) view
|
277
|
+
didReadSymbols: (ZBarSymbolSet*) syms
|
278
|
+
fromImage: (UIImage*) img
|
279
|
+
{
|
280
|
+
// do something useful with results
|
281
|
+
for(ZBarSymbol *sym in syms) {
|
282
|
+
resultText.text = sym.data;
|
283
|
+
|
284
|
+
{
|
285
|
+
UIBarButtonItem *btn_fixed = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
286
|
+
UIBarButtonItem* btn_cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(doCancel:)];
|
287
|
+
UIBarButtonItem* btn_space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
288
|
+
UIBarButtonItem* btn_done = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doDone:)];
|
289
|
+
|
290
|
+
NSMutableArray *btns = [NSMutableArray arrayWithCapacity:6];
|
291
|
+
[btns addObject:btn_fixed];
|
292
|
+
[btns addObject:btn_cancel];
|
293
|
+
[btns addObject:btn_fixed];
|
294
|
+
[btns addObject:btn_space];
|
295
|
+
[btns addObject:btn_done];
|
296
|
+
|
297
|
+
[btn_fixed release];
|
298
|
+
[btn_cancel release];
|
299
|
+
[btn_space release];
|
300
|
+
[btn_done release];
|
301
|
+
|
302
|
+
[toolbar setItems:btns];
|
303
|
+
|
304
|
+
}
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
break;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
|
314
|
+
+(UIView*)getCurrentView
|
315
|
+
{
|
316
|
+
return bv.view;
|
317
|
+
}
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
- (void)didReceiveMemoryWarning {
|
322
|
+
// Releases the view if it doesn't have a superview.
|
323
|
+
[super didReceiveMemoryWarning];
|
324
|
+
|
325
|
+
// Release any cached data, images, etc that aren't in use.
|
326
|
+
}
|
327
|
+
|
328
|
+
- (void)viewDidUnload {
|
329
|
+
// Release any retained subviews of the main view.
|
330
|
+
// e.g. self.myOutlet = nil;
|
331
|
+
}
|
332
|
+
|
333
|
+
|
334
|
+
- (void)dealloc {
|
335
|
+
[readerView removeFromSuperview];
|
336
|
+
[toolbar removeFromSuperview];
|
337
|
+
[resultText removeFromSuperview];
|
338
|
+
[readerView release];
|
339
|
+
[toolbar release];
|
340
|
+
[resultText release];
|
341
|
+
[super dealloc];
|
342
|
+
}
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
@end
|