diff --git a/android/ZBarScannerActivity.java b/android/ZBarScannerActivity.java index 9f23fa2..ec3bbf6 100644 --- a/android/ZBarScannerActivity.java +++ b/android/ZBarScannerActivity.java @@ -15,6 +15,7 @@ import android.hardware.Camera.Parameters; import android.hardware.Camera.PreviewCallback; import android.hardware.Camera.AutoFocusCallback; +import android.nfc.Tag; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.ActivityCompat; @@ -201,19 +202,7 @@ public void onResume () super.onResume(); try { - if(whichCamera.equals("front")) { - int numCams = Camera.getNumberOfCameras(); - CameraInfo cameraInfo = new CameraInfo(); - for(int i=0; i + android:textSize="16sp" /> @@ -49,11 +46,11 @@ android:background="#ff0000" /> = 110000 + // HACK to hide the Info button + for (UIBarButtonItem* item in [toolbar items]) { + UIButton* button = [item customView]; + if ([button isKindOfClass:UIButton.class]) { + UIButtonType buttonType = [button buttonType]; + if (buttonType == UIButtonTypeInfoDark || buttonType == UIButtonTypeInfoLight) { + [button setHidden:YES]; + } + } + } +#endif +} + @end diff --git a/ios/CsZBar.m b/ios/CsZBar.m index 45a15ab..13df76b 100644 --- a/ios/CsZBar.m +++ b/ios/CsZBar.m @@ -71,6 +71,7 @@ - (void)scan: (CDVInvokedUrlCommand*)command; self.scanReader.cameraFlashMode = UIImagePickerControllerCameraFlashModeAuto; } +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 110000 // Hack to hide the bottom bar's Info button... originally based on http://stackoverflow.com/a/16353530 NSInteger infoButtonIndex; if ([[[UIDevice currentDevice] systemVersion] compare:@"10.0" options:NSNumericSearch] != NSOrderedAscending) { @@ -80,6 +81,7 @@ - (void)scan: (CDVInvokedUrlCommand*)command; } UIView *infoButton = [[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:infoButtonIndex]; [infoButton setHidden:YES]; +#endif //UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; [button setTitle:@"Press Me" forState:UIControlStateNormal]; [button sizeToFit]; [self.view addSubview:button]; CGRect screenRect = [[UIScreen mainScreen] bounds]; @@ -92,8 +94,20 @@ - (void)scan: (CDVInvokedUrlCommand*)command; //The bar length it depends on the orientation toolbarViewFlash.frame = CGRectMake(0.0, 0, (screenWidth > screenHeight ?screenWidth:screenHeight), 44.0); toolbarViewFlash.barStyle = UIBarStyleBlackOpaque; - UIBarButtonItem *buttonFlash = [[UIBarButtonItem alloc] initWithTitle:@"Flash" style:UIBarButtonItemStyleDone target:self action:@selector(toggleflash)]; +// UIBarButtonItem *buttonFlash = [[UIBarButtonItem alloc] initWithTitle:@"Flash" style:UIBarButtonItemStyleDone target:self action:@selector(toggleflash)]; + + NSURL *bundleURL = [[NSBundle mainBundle] URLForResource:@"ZBar" withExtension:@"bundle"]; + NSBundle *bundle = [NSBundle bundleWithURL:bundleURL]; + NSString *imagePath = [bundle pathForResource:@"torch" ofType:@"png"]; + UIImage *image = [UIImage imageWithContentsOfFile:imagePath]; + + UIBarButtonItem *buttonFlash = [[UIBarButtonItem alloc] + initWithImage:image + style:UIBarButtonItemStylePlain + target:(id)self + action:@selector(toggleflash)]; + NSArray *buttons = [NSArray arrayWithObjects: buttonFlash, nil]; [toolbarViewFlash setItems:buttons animated:NO]; [self.scanReader.view addSubview:toolbarViewFlash]; diff --git a/ios/ZBar.bundle/torch.png b/ios/ZBar.bundle/torch.png new file mode 100644 index 0000000..42b6d87 Binary files /dev/null and b/ios/ZBar.bundle/torch.png differ diff --git a/ios/ZBar.bundle/torch@2x.png b/ios/ZBar.bundle/torch@2x.png new file mode 100644 index 0000000..fe6ab42 Binary files /dev/null and b/ios/ZBar.bundle/torch@2x.png differ diff --git a/ios/ZBar.bundle/torch@3x.png b/ios/ZBar.bundle/torch@3x.png new file mode 100644 index 0000000..24d44a4 Binary files /dev/null and b/ios/ZBar.bundle/torch@3x.png differ diff --git a/plugin.xml b/plugin.xml index dd43518..ed6996a 100644 --- a/plugin.xml +++ b/plugin.xml @@ -24,10 +24,10 @@ - + @@ -44,25 +44,27 @@ #000000 - - - - - - - - s - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -108,6 +110,7 @@ +