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.
- 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
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 3.2.2
|
|
2
|
+
* Fix iPhone build for AppStore
|
|
3
|
+
* Fix Android infinite loop while using GPS
|
|
4
|
+
* Update IronRuby for Windows Phone 7 to log application stack while exception
|
|
5
|
+
* Add generator for native extensions
|
|
6
|
+
* Add real-time Barcode scanning for iPhone
|
|
7
|
+
|
|
1
8
|
## 3.2.1
|
|
2
9
|
* Add migrate-rhodes-app command that updates build.yml to use latest Rhodes gem
|
|
3
10
|
* Change set-rhodes-sdk command to set sdk path at build.yml only
|
data/Manifest.txt
CHANGED
|
@@ -430,6 +430,15 @@ lib/extensions/barcode/ext/barcode/platform/bb/ZXing/README
|
|
|
430
430
|
lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj
|
|
431
431
|
lib/extensions/barcode/ext/barcode/platform/iphone/Barcode_Prefix.pch
|
|
432
432
|
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m
|
|
433
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.h
|
|
434
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm
|
|
435
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.h
|
|
436
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m
|
|
437
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.h
|
|
438
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactory.mm
|
|
439
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewFactoryRegister.mm
|
|
440
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.h
|
|
441
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewManager.mm
|
|
433
442
|
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/ImageProvider.cpp
|
|
434
443
|
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/ImageProvider.h
|
|
435
444
|
lib/extensions/barcode/ext/barcode/platform/iphone/Classes/ImageProvider.mm
|
|
@@ -445,6 +454,7 @@ lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/
|
|
|
445
454
|
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Video.h
|
|
446
455
|
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar/Window.h
|
|
447
456
|
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/zbar.h
|
|
457
|
+
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCameraSimulator.h
|
|
448
458
|
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarCaptureReader.h
|
|
449
459
|
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarHelpController.h
|
|
450
460
|
lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/Headers/ZBarSDK/ZBarImage.h
|
|
@@ -4710,6 +4720,32 @@ res/generators/templates/application/public/js/wp7.js
|
|
|
4710
4720
|
res/generators/templates/application/Rakefile
|
|
4711
4721
|
res/generators/templates/application/rhoconfig.txt
|
|
4712
4722
|
res/generators/templates/bundle/db/syncdb.sqlite
|
|
4723
|
+
res/generators/templates/extension/app/MontanaTest/controller.rb
|
|
4724
|
+
res/generators/templates/extension/app/MontanaTest/index.erb
|
|
4725
|
+
res/generators/templates/extension/extensions/montana/ext/build
|
|
4726
|
+
res/generators/templates/extension/extensions/montana/ext/build.bat
|
|
4727
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/android/ext_build.files
|
|
4728
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/android/jni/src/montana.cpp
|
|
4729
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/android/Rakefile
|
|
4730
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/android/src/com/montana/Montana.java
|
|
4731
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Montana.files
|
|
4732
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/montana.jdp
|
|
4733
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/Rakefile
|
|
4734
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/bb/src/com/montana/Montana.java
|
|
4735
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.h
|
|
4736
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Classes/Montana.m
|
|
4737
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana.xcodeproj/project.pbxproj
|
|
4738
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Montana_Prefix.pch
|
|
4739
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/iphone/Rakefile
|
|
4740
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.vcproj
|
|
4741
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile
|
|
4742
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.cpp
|
|
4743
|
+
res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/src/montana_wm.h
|
|
4744
|
+
res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana.i
|
|
4745
|
+
res/generators/templates/extension/extensions/montana/ext/montana/shared/ruby/montana_wrap.c
|
|
4746
|
+
res/generators/templates/extension/extensions/montana/ext/montana/shared/src/montana.c
|
|
4747
|
+
res/generators/templates/extension/extensions/montana/ext.yml
|
|
4748
|
+
res/generators/templates/extension/extensions/montana/montana.rb
|
|
4713
4749
|
res/generators/templates/model/controller.rb
|
|
4714
4750
|
res/generators/templates/model/edit.bb.erb
|
|
4715
4751
|
res/generators/templates/model/edit.erb
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
#include <logging/RhoLog.h>
|
|
6
6
|
#include <stdlib.h>
|
|
7
7
|
|
|
8
|
+
#include "ruby/ext/rho/rhoruby.h"
|
|
9
|
+
|
|
8
10
|
#undef DEFAULT_LOGCATEGORY
|
|
9
11
|
#define DEFAULT_LOGCATEGORY "BarcodeJNI"
|
|
10
12
|
|
|
@@ -40,17 +42,36 @@ extern "C" const char* rho_barcode_barcode_recognize(const char* filename) {
|
|
|
40
42
|
return barcode_result;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
extern "C" void rho_barcode_take_barcode(const char* callback) {
|
|
45
|
+
extern "C" void rho_barcode_take_barcode(const char* callback, VALUE options) {
|
|
44
46
|
JNIEnv *env = jnienv();
|
|
45
47
|
jclass cls = rho_find_class(env, "com/rhomobile/barcode/Barcode");
|
|
46
48
|
if (!cls) return;
|
|
47
|
-
jmethodID mid = env->GetStaticMethodID( cls, "take", "(Ljava/lang/String;)V");
|
|
49
|
+
jmethodID mid = env->GetStaticMethodID( cls, "take", "(Ljava/lang/String;I)V");
|
|
48
50
|
if (!mid) return;
|
|
51
|
+
|
|
52
|
+
int camera_index = 0;
|
|
53
|
+
if (!rho_ruby_is_NIL(options)) {
|
|
54
|
+
// parse options for camera index ( 0 - main, 1 - front)
|
|
55
|
+
rho_param *param = rho_param_fromvalue(options);
|
|
56
|
+
if (param->type == RHO_PARAM_HASH) {
|
|
57
|
+
int i;
|
|
58
|
+
for (i = 0; i < param->v.hash->size; i++) {
|
|
59
|
+
if (strcasecmp(param->v.hash->name[i], "camera") == 0) {
|
|
60
|
+
if (param->v.hash->value[i]->type == RHO_PARAM_STRING) {
|
|
61
|
+
if (strcasecmp(param->v.hash->value[i]->v.string, "front") == 0) {
|
|
62
|
+
camera_index = 1;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
rho_param_free(param);
|
|
69
|
+
}
|
|
49
70
|
|
|
50
71
|
jstring objCallback = env->NewStringUTF(callback);
|
|
51
72
|
if(objCallback != NULL)
|
|
52
73
|
{
|
|
53
|
-
env->CallStaticObjectMethod(cls, mid, objCallback);
|
|
74
|
+
env->CallStaticObjectMethod(cls, mid, objCallback, camera_index);
|
|
54
75
|
env->DeleteLocalRef(objCallback);
|
|
55
76
|
} else
|
|
56
77
|
{
|
|
@@ -82,6 +82,9 @@ import java.util.Vector;
|
|
|
82
82
|
* @author Sean Owen
|
|
83
83
|
*/
|
|
84
84
|
public final class CaptureActivity extends BaseActivity implements SurfaceHolder.Callback {
|
|
85
|
+
|
|
86
|
+
public static final String CAMERA_INDEX_EXTRA = "camera_index";
|
|
87
|
+
|
|
85
88
|
|
|
86
89
|
private static final String TAG = CaptureActivity.class.getSimpleName();
|
|
87
90
|
|
|
@@ -153,16 +156,6 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
153
156
|
}
|
|
154
157
|
};
|
|
155
158
|
|
|
156
|
-
/*
|
|
157
|
-
private final DialogInterface.OnClickListener aboutListener =
|
|
158
|
-
new DialogInterface.OnClickListener() {
|
|
159
|
-
public void onClick(DialogInterface dialogInterface, int i) {
|
|
160
|
-
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.zxing_url)));
|
|
161
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
162
|
-
startActivity(intent);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
*/
|
|
166
159
|
|
|
167
160
|
ViewfinderView getViewfinderView() {
|
|
168
161
|
return viewfinderView;
|
|
@@ -180,7 +173,13 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
180
173
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
|
181
174
|
setContentView(R.layout.capture);
|
|
182
175
|
|
|
183
|
-
|
|
176
|
+
int camera_index = 0;
|
|
177
|
+
Intent intent = getIntent();
|
|
178
|
+
if (intent != null) {
|
|
179
|
+
camera_index = intent.getIntExtra(CAMERA_INDEX_EXTRA, 0);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
CameraManager.init(getApplication(), camera_index);
|
|
184
183
|
viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
|
|
185
184
|
resultView = findViewById(R.id.result_view);
|
|
186
185
|
//statusView = (TextView) findViewById(R.id.status_view);
|
|
@@ -258,39 +257,6 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
258
257
|
surfaceHolder.addCallback(this);
|
|
259
258
|
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
|
260
259
|
}
|
|
261
|
-
|
|
262
|
-
/*
|
|
263
|
-
Intent intent = getIntent();
|
|
264
|
-
String action = intent == null ? null : intent.getAction();
|
|
265
|
-
String dataString = intent == null ? null : intent.getDataString();
|
|
266
|
-
if (intent != null && action != null) {
|
|
267
|
-
if (action.equals(Intents.Scan.ACTION)) {
|
|
268
|
-
// Scan the formats the intent requested, and return the result to the calling activity.
|
|
269
|
-
source = Source.NATIVE_APP_INTENT;
|
|
270
|
-
decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
|
|
271
|
-
} else if (dataString != null && dataString.contains(PRODUCT_SEARCH_URL_PREFIX) &&
|
|
272
|
-
dataString.contains(PRODUCT_SEARCH_URL_SUFFIX)) {
|
|
273
|
-
// Scan only products and send the result to mobile Product Search.
|
|
274
|
-
source = Source.PRODUCT_SEARCH_LINK;
|
|
275
|
-
sourceUrl = dataString;
|
|
276
|
-
decodeFormats = DecodeFormatManager.PRODUCT_FORMATS;
|
|
277
|
-
} else if (dataString != null && dataString.startsWith(ZXING_URL)) {
|
|
278
|
-
// Scan formats requested in query string (all formats if none specified).
|
|
279
|
-
// If a return URL is specified, send the results there. Otherwise, handle it ourselves.
|
|
280
|
-
source = Source.ZXING_LINK;
|
|
281
|
-
sourceUrl = dataString;
|
|
282
|
-
Uri inputUri = Uri.parse(sourceUrl);
|
|
283
|
-
returnUrlTemplate = inputUri.getQueryParameter(RETURN_URL_PARAM);
|
|
284
|
-
decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
|
|
285
|
-
} else {
|
|
286
|
-
// Scan all formats and handle the results ourselves (launched from Home).
|
|
287
|
-
source = Source.NONE;
|
|
288
|
-
decodeFormats = null;
|
|
289
|
-
}
|
|
290
|
-
characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
|
|
291
|
-
}
|
|
292
|
-
else
|
|
293
|
-
*/
|
|
294
260
|
{
|
|
295
261
|
source = Source.NONE;
|
|
296
262
|
decodeFormats = null;
|
|
@@ -346,77 +312,6 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
346
312
|
return super.onKeyDown(keyCode, event);
|
|
347
313
|
}
|
|
348
314
|
|
|
349
|
-
/*
|
|
350
|
-
@Override
|
|
351
|
-
public boolean onCreateOptionsMenu(Menu menu) {
|
|
352
|
-
super.onCreateOptionsMenu(menu);
|
|
353
|
-
menu.add(0, SHARE_ID, 0, R.string.menu_share)
|
|
354
|
-
.setIcon(android.R.drawable.ic_menu_share);
|
|
355
|
-
menu.add(0, HISTORY_ID, 0, R.string.menu_history)
|
|
356
|
-
.setIcon(android.R.drawable.ic_menu_recent_history);
|
|
357
|
-
menu.add(0, SETTINGS_ID, 0, R.string.menu_settings)
|
|
358
|
-
.setIcon(android.R.drawable.ic_menu_preferences);
|
|
359
|
-
menu.add(0, HELP_ID, 0, R.string.menu_help)
|
|
360
|
-
.setIcon(android.R.drawable.ic_menu_help);
|
|
361
|
-
menu.add(0, ABOUT_ID, 0, R.string.menu_about)
|
|
362
|
-
.setIcon(android.R.drawable.ic_menu_info_details);
|
|
363
|
-
return true;
|
|
364
|
-
}
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
// Don't display the share menu item if the result overlay is showing.
|
|
368
|
-
/*
|
|
369
|
-
@Override
|
|
370
|
-
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
371
|
-
super.onPrepareOptionsMenu(menu);
|
|
372
|
-
menu.findItem(SHARE_ID).setVisible(lastResult == null);
|
|
373
|
-
return true;
|
|
374
|
-
}
|
|
375
|
-
*/
|
|
376
|
-
|
|
377
|
-
/*
|
|
378
|
-
@Override
|
|
379
|
-
public boolean onOptionsItemSelected(MenuItem item) {
|
|
380
|
-
switch (item.getItemId()) {
|
|
381
|
-
case SHARE_ID: {
|
|
382
|
-
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
383
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
384
|
-
intent.setClassName(this, ShareActivity.class.getName());
|
|
385
|
-
startActivity(intent);
|
|
386
|
-
break;
|
|
387
|
-
}
|
|
388
|
-
case HISTORY_ID: {
|
|
389
|
-
AlertDialog historyAlert = historyManager.buildAlert();
|
|
390
|
-
historyAlert.show();
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
case SETTINGS_ID: {
|
|
394
|
-
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
395
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
396
|
-
intent.setClassName(this, PreferencesActivity.class.getName());
|
|
397
|
-
startActivity(intent);
|
|
398
|
-
break;
|
|
399
|
-
}
|
|
400
|
-
case HELP_ID: {
|
|
401
|
-
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
402
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
403
|
-
intent.setClassName(this, HelpActivity.class.getName());
|
|
404
|
-
startActivity(intent);
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
case ABOUT_ID:
|
|
408
|
-
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
409
|
-
builder.setTitle(getString(R.string.title_about) + versionName);
|
|
410
|
-
builder.setMessage(getString(R.string.msg_about) + "\n\n" + getString(R.string.zxing_url));
|
|
411
|
-
builder.setIcon(R.drawable.launcher_icon);
|
|
412
|
-
builder.setPositiveButton(R.string.button_open_browser, aboutListener);
|
|
413
|
-
builder.setNegativeButton(R.string.button_cancel, null);
|
|
414
|
-
builder.show();
|
|
415
|
-
break;
|
|
416
|
-
}
|
|
417
|
-
return super.onOptionsItemSelected(item);
|
|
418
|
-
}
|
|
419
|
-
*/
|
|
420
315
|
|
|
421
316
|
@Override
|
|
422
317
|
public void onConfigurationChanged(Configuration config) {
|
|
@@ -457,34 +352,6 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
457
352
|
drawResultPoints(barcode, rawResult);
|
|
458
353
|
handleDecodeInternally(rawResult, barcode);
|
|
459
354
|
|
|
460
|
-
/*
|
|
461
|
-
switch (source) {
|
|
462
|
-
case NATIVE_APP_INTENT:
|
|
463
|
-
case PRODUCT_SEARCH_LINK:
|
|
464
|
-
handleDecodeExternally(rawResult, barcode);
|
|
465
|
-
break;
|
|
466
|
-
case ZXING_LINK:
|
|
467
|
-
if (returnUrlTemplate == null){
|
|
468
|
-
handleDecodeInternally(rawResult, barcode);
|
|
469
|
-
} else {
|
|
470
|
-
handleDecodeExternally(rawResult, barcode);
|
|
471
|
-
}
|
|
472
|
-
break;
|
|
473
|
-
case NONE:
|
|
474
|
-
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
475
|
-
if (prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
|
|
476
|
-
Toast.makeText(this, R.string.msg_bulk_mode_scanned, Toast.LENGTH_SHORT).show();
|
|
477
|
-
// Wait a moment or else it will scan the same barcode continuously about 3 times
|
|
478
|
-
if (handler != null) {
|
|
479
|
-
handler.sendEmptyMessageDelayed(R.id.restart_preview, BULK_MODE_SCAN_DELAY_MS);
|
|
480
|
-
}
|
|
481
|
-
resetStatusView();
|
|
482
|
-
} else {
|
|
483
|
-
handleDecodeInternally(rawResult, barcode);
|
|
484
|
-
}
|
|
485
|
-
break;
|
|
486
|
-
}
|
|
487
|
-
*/
|
|
488
355
|
}
|
|
489
356
|
}
|
|
490
357
|
|
|
@@ -535,53 +402,10 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
535
402
|
resultView.setVisibility(View.VISIBLE);
|
|
536
403
|
|
|
537
404
|
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
|
|
538
|
-
if (barcode
|
|
539
|
-
//barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
|
|
540
|
-
// R.drawable.launcher_icon));
|
|
541
|
-
} else {
|
|
405
|
+
if (barcode != null) {
|
|
542
406
|
barcodeImageView.setImageBitmap(barcode);
|
|
543
407
|
}
|
|
544
408
|
|
|
545
|
-
//ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
|
546
|
-
|
|
547
|
-
/*
|
|
548
|
-
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
|
|
549
|
-
formatTextView.setText(rawResult.getBarcodeFormat().toString());
|
|
550
|
-
|
|
551
|
-
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
|
|
552
|
-
typeTextView.setText(resultHandler.getType().toString());
|
|
553
|
-
|
|
554
|
-
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
|
555
|
-
String formattedTime = formatter.format(new Date(rawResult.getTimestamp()));
|
|
556
|
-
TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
|
|
557
|
-
timeTextView.setText(formattedTime);
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
|
|
561
|
-
View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
|
|
562
|
-
metaTextView.setVisibility(View.GONE);
|
|
563
|
-
metaTextViewLabel.setVisibility(View.GONE);
|
|
564
|
-
*/
|
|
565
|
-
|
|
566
|
-
/*
|
|
567
|
-
Map<ResultMetadataType,Object> metadata =
|
|
568
|
-
(Map<ResultMetadataType,Object>) rawResult.getResultMetadata();
|
|
569
|
-
if (metadata != null) {
|
|
570
|
-
StringBuilder metadataText = new StringBuilder(20);
|
|
571
|
-
for (Map.Entry<ResultMetadataType,Object> entry : metadata.entrySet()) {
|
|
572
|
-
if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
|
|
573
|
-
metadataText.append(entry.getValue()).append('\n');
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
if (metadataText.length() > 0) {
|
|
577
|
-
metadataText.setLength(metadataText.length() - 1);
|
|
578
|
-
metaTextView.setText(metadataText);
|
|
579
|
-
metaTextView.setVisibility(View.VISIBLE);
|
|
580
|
-
metaTextViewLabel.setVisibility(View.VISIBLE);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
*/
|
|
584
|
-
|
|
585
409
|
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
|
|
586
410
|
CharSequence displayContents = rawResult.getText();// resultHandler.getDisplayContents();
|
|
587
411
|
contentsTextView.setText(displayContents);
|
|
@@ -594,72 +418,10 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
594
418
|
mRetakeButton.setVisibility(View.VISIBLE);
|
|
595
419
|
mOKButton.setVisibility(View.VISIBLE);
|
|
596
420
|
|
|
597
|
-
|
|
598
|
-
/*
|
|
599
|
-
int buttonCount = resultHandler.getButtonCount();
|
|
600
|
-
ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
|
|
601
|
-
buttonView.requestFocus();
|
|
602
|
-
for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
|
|
603
|
-
TextView button = (TextView) buttonView.getChildAt(x);
|
|
604
|
-
if (x < buttonCount) {
|
|
605
|
-
button.setVisibility(View.VISIBLE);
|
|
606
|
-
button.setText(resultHandler.getButtonText(x));
|
|
607
|
-
button.setOnClickListener(new ResultButtonListener(resultHandler, x));
|
|
608
|
-
} else {
|
|
609
|
-
button.setVisibility(View.GONE);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
if (copyToClipboard) {
|
|
614
|
-
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
|
615
|
-
clipboard.setText(displayContents);
|
|
616
|
-
}
|
|
617
|
-
*/
|
|
618
421
|
}
|
|
619
422
|
|
|
620
423
|
// Briefly show the contents of the barcode, then handle the result outside Barcode Scanner.
|
|
621
424
|
private void handleDecodeExternally(Result rawResult, Bitmap barcode) {
|
|
622
|
-
/*
|
|
623
|
-
viewfinderView.drawResultBitmap(barcode);
|
|
624
|
-
|
|
625
|
-
// Since this message will only be shown for a second, just tell the user what kind of
|
|
626
|
-
// barcode was found (e.g. contact info) rather than the full contents, which they won't
|
|
627
|
-
// have time to read.
|
|
628
|
-
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
|
|
629
|
-
//statusView.setText(getString(resultHandler.getDisplayTitle()));
|
|
630
|
-
|
|
631
|
-
if (copyToClipboard) {
|
|
632
|
-
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
|
633
|
-
clipboard.setText(resultHandler.getDisplayContents());
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
if (source == Source.NATIVE_APP_INTENT) {
|
|
637
|
-
// Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
|
|
638
|
-
// the deprecated intent is retired.
|
|
639
|
-
Intent intent = new Intent(getIntent().getAction());
|
|
640
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
641
|
-
intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
|
|
642
|
-
intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
|
|
643
|
-
Message message = Message.obtain(handler, R.id.return_scan_result);
|
|
644
|
-
message.obj = intent;
|
|
645
|
-
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
|
646
|
-
} else if (source == Source.PRODUCT_SEARCH_LINK) {
|
|
647
|
-
// Reformulate the URL which triggered us into a query, so that the request goes to the same
|
|
648
|
-
// TLD as the scan URL.
|
|
649
|
-
Message message = Message.obtain(handler, R.id.launch_product_query);
|
|
650
|
-
int end = sourceUrl.lastIndexOf("/scan");
|
|
651
|
-
message.obj = sourceUrl.substring(0, end) + "?q=" +
|
|
652
|
-
resultHandler.getDisplayContents().toString() + "&source=zxing";
|
|
653
|
-
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
|
654
|
-
} else if (source == Source.ZXING_LINK) {
|
|
655
|
-
// Replace each occurrence of RETURN_CODE_PLACEHOLDER in the returnUrlTemplate
|
|
656
|
-
// with the scanned code. This allows both queries and REST-style URLs to work.
|
|
657
|
-
Message message = Message.obtain(handler, R.id.launch_product_query);
|
|
658
|
-
message.obj = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER,
|
|
659
|
-
resultHandler.getDisplayContents().toString());
|
|
660
|
-
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
|
661
|
-
}
|
|
662
|
-
*/
|
|
663
425
|
}
|
|
664
426
|
|
|
665
427
|
/**
|
|
@@ -668,29 +430,6 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
668
430
|
* it to a value stored as a preference.
|
|
669
431
|
*/
|
|
670
432
|
private boolean showHelpOnFirstLaunch() {
|
|
671
|
-
/*
|
|
672
|
-
try {
|
|
673
|
-
PackageInfo info = getPackageManager().getPackageInfo(PACKAGE_NAME, 0);
|
|
674
|
-
int currentVersion = info.versionCode;
|
|
675
|
-
// Since we're paying to talk to the PackageManager anyway, it makes sense to cache the app
|
|
676
|
-
// version name here for display in the about box later.
|
|
677
|
-
this.versionName = info.versionName;
|
|
678
|
-
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
|
679
|
-
int lastVersion = prefs.getInt(PreferencesActivity.KEY_HELP_VERSION_SHOWN, 0);
|
|
680
|
-
if (currentVersion > lastVersion) {
|
|
681
|
-
prefs.edit().putInt(PreferencesActivity.KEY_HELP_VERSION_SHOWN, currentVersion).commit();
|
|
682
|
-
Intent intent = new Intent(this, HelpActivity.class);
|
|
683
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
|
684
|
-
// Show the default page on a clean install, and the what's new page on an upgrade.
|
|
685
|
-
String page = (lastVersion == 0) ? HelpActivity.DEFAULT_PAGE : HelpActivity.WHATS_NEW_PAGE;
|
|
686
|
-
intent.putExtra(HelpActivity.REQUESTED_PAGE_KEY, page);
|
|
687
|
-
startActivity(intent);
|
|
688
|
-
return true;
|
|
689
|
-
}
|
|
690
|
-
} catch (PackageManager.NameNotFoundException e) {
|
|
691
|
-
Log.w(TAG, e);
|
|
692
|
-
}
|
|
693
|
-
*/
|
|
694
433
|
return false;
|
|
695
434
|
}
|
|
696
435
|
|
|
@@ -750,14 +489,6 @@ public final class CaptureActivity extends BaseActivity implements SurfaceHolder
|
|
|
750
489
|
}
|
|
751
490
|
|
|
752
491
|
private void displayFrameworkBugMessageAndExit() {
|
|
753
|
-
/*
|
|
754
|
-
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
755
|
-
builder.setTitle(getString(R.string.app_name));
|
|
756
|
-
builder.setMessage(getString(R.string.msg_camera_framework_bug));
|
|
757
|
-
builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
|
|
758
|
-
builder.setOnCancelListener(new FinishListener(this));
|
|
759
|
-
builder.show();
|
|
760
|
-
*/
|
|
761
492
|
}
|
|
762
493
|
|
|
763
494
|
private void resetStatusView() {
|