Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android UI doesn't support Portrait and is small #4

Open
andymac4182 opened this issue Oct 1, 2014 · 27 comments
Open

Android UI doesn't support Portrait and is small #4

andymac4182 opened this issue Oct 1, 2014 · 27 comments

Comments

@andymac4182
Copy link

We are using this in a portrait application currently. On iOS it loads correctly and doesn't rotate the screen. On Android it always rotates the screen and loads a lot smaller selection box. It would be great if they could both load a similar UI and use the orientation of the device.

Here are what they look like on my devices currently
iPhone 6 Plus (https://www.dropbox.com/s/qb0yvgci7gewfmk/2014-10-01%2011.43.30.png?dl=0)
Nexus 5 (https://www.dropbox.com/s/w66eo7lwyth8si9/2014-10-01%2001.45.15.png?dl=0)

UPDATE:
I have noticed that these have been raised on the original plugin as well
wildabeast#120
wildabeast#70
wildabeast#44

@andymac4182 andymac4182 changed the title Screen rotates when on Android Android UI doesn't support Portrait and is small Oct 1, 2014
@kwanchanok-wc
Copy link

1 vote for portrait feature for android

1 similar comment
@n9ti
Copy link

n9ti commented Oct 7, 2014

1 vote for portrait feature for android

EddyVerbruggen added a commit that referenced this issue Oct 8, 2014
…id projects which have not set targetSDK (crashed without it)
@EddyVerbruggen
Copy link

Hi guys, thanks for the feature request and your votes!

Can you please test the 1.2.5 release a bit? On Android the viewfinder should auto-rotate according to the orientation. Also, I've made the viewfinder slightly larger.

@kwanchanok-wc
Copy link

Hi EddyVerbruggen

thank you for your release.
i already test , now it doesn't rotate on android but have more issue.
if after scanning success , image that camera capture for scan still rotate.
i will attach file for example

doesnot rotate when scan
https://cloud.githubusercontent.com/assets/866304/4570594/8be19d90-4f61-11e4-90af-e7e4a236cd8c.png

my image scan
https://cloud.githubusercontent.com/assets/866304/4570593/8bdcb37a-4f61-11e4-8003-562dccc71469.png

scan success still rotate https://cloud.githubusercontent.com/assets/866304/4570595/8be2eec0-4f61-11e4-9539-518118014901.png

EddyVerbruggen added a commit that referenced this issue Oct 9, 2014
@EddyVerbruggen
Copy link

Hi @kwanchanok-wc thanks for testing this so quickly!

The image will orientation may change left-to-right or top-to-bottom, but with verson 1.2.6 it will no longer rotate 90 degrees.

This also fixes the problem where regular barcodes (not QR) weren't recognized in portrait mode.

@trancee
Copy link

trancee commented Oct 10, 2014

I just tried out the latest version 1.2.6 and when the view has opened, I get the following crash log:

10-10 10:57:57.388: E/AndroidRuntime(21736): FATAL EXCEPTION: Thread-21269
10-10 10:57:57.388: E/AndroidRuntime(21736): java.lang.ArrayIndexOutOfBoundsException: src.length=115200 srcPos=-960 dst.length=78720 dstPos=0 length=78720
10-10 10:57:57.388: E/AndroidRuntime(21736): at java.lang.System.arraycopy(Native Method)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.PlanarYUVLuminanceSource.getMatrix(PlanarYUVLuminanceSource.java:92)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.common.HybridBinarizer.getBlackMatrix(HybridBinarizer.java:70)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.BinaryBitmap.getBlackMatrix(BinaryBitmap.java:83)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java:76)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:170)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.MultiFormatReader.decodeWithState(MultiFormatReader.java:85)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.client.android.DecodeHandler.decode(DecodeHandler.java:82)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:60)
10-10 10:57:57.388: E/AndroidRuntime(21736): at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 10:57:57.388: E/AndroidRuntime(21736): at android.os.Looper.loop(Looper.java:177)
10-10 10:57:57.388: E/AndroidRuntime(21736): at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:94)

I hope that helps to find the problem.

@kwanchanok-wc
Copy link

@EddyVerbruggen
i already test, and it's fixed

thank you

@trancee
Copy link

trancee commented Oct 10, 2014

I also tested it on Samsung Galaxy Note 10.1 (GT-N8000) with Android 4.4.2, the previous BarcodeScanner plugin worked as expected, but rotating from Portrait to Landscape. The current version 1.2.6 is correctly showing in Portrait mode, but the view is showing the camera view stretched or distorted, like it would should it as Landscape.

It works well on Samsung Galaxy Nexus S with Android 4.3 in Portrait mode. I am not sure what could be the problem here.

@EddyVerbruggen
Copy link

@trancee thanks for the details, a few more questions:

  • Which device shows the crashlog, and does is crash with the front or back camera?
  • Does the Note 10.1 correctly scan the barcodes despite the stretched view?

@kwanchanok-wc
Copy link

i test on galaxy note Galaxy Note II GT-N7100 with android 4.3.
it's may cause android version.

@trancee
Copy link

trancee commented Oct 10, 2014

@EddyVerbruggen the crashlog came from Samsung Galaxy Star (GT-S5282) with Android 4.1.2, it is small screen device (240 x 320 pixels).

The Galaxy Note 10.1 can only scan the barcode, if I hold the barcode the opposite way. It is not easy to make it work, as when I move the barcode, it is reflected in the opposite direction in the camera. But once I get it in the view area, it can recognize it.

@EddyVerbruggen
Copy link

Hi @trancee I've found a fix for 240x320 devices, I will create a 1.2.7 version real soon with this fix.

I'm not entirely sure what the exact problem is with the note 10.1.. you can scan the barcode if you hold it correctly right? If there is a problem please make a screenshot to explain the trouble. I will wait for your reply a bit, otherwise relesae 1.2.7 within a few hours.

Thanks!
Eddy

@trancee
Copy link

trancee commented Oct 13, 2014

@EddyVerbruggen I just tried the new version 1.2.7 with the Galaxy Star, and although it does not crash at the beginning anymore, it does now not recognize the barcode. And after a while, it crashes again with the following log:

10-13 14:27:01.990: D/CameraManager(29213): Calculated framing rect: Rect(40, -33 - 280, 187)
10-13 14:27:02.160: W/dalvikvm(29213): threadid=23: thread exiting with uncaught exception (group=0x4131c2b8)
10-13 14:27:02.240: E/AndroidRuntime(29213): FATAL EXCEPTION: Thread-1077
10-13 14:27:02.240: E/AndroidRuntime(29213): java.lang.ArrayIndexOutOfBoundsException: src.length=115200 srcPos=-16280 dst.length=82080 dstPos=0 length=240
10-13 14:27:02.240: E/AndroidRuntime(29213): at java.lang.System.arraycopy(Native Method)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.PlanarYUVLuminanceSource.getMatrix(PlanarYUVLuminanceSource.java:100)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.common.HybridBinarizer.getBlackMatrix(HybridBinarizer.java:70)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.BinaryBitmap.getBlackMatrix(BinaryBitmap.java:83)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java:76)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.MultiFormatReader.decodeInternal(MultiFormatReader.java:170)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.MultiFormatReader.decodeWithState(MultiFormatReader.java:85)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.client.android.DecodeHandler.decode(DecodeHandler.java:82)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:60)
10-13 14:27:02.240: E/AndroidRuntime(29213): at android.os.Handler.dispatchMessage(Handler.java:99)
10-13 14:27:02.240: E/AndroidRuntime(29213): at android.os.Looper.loop(Looper.java:177)
10-13 14:27:02.240: E/AndroidRuntime(29213): at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:94)
10-13 14:27:02.450: V/MediaPlayer-JNI(29213): native_finalize
10-13 14:27:02.450: W/MediaPlayer-JNI(29213): MediaPlayer finalized without being released
10-13 14:27:02.450: V/MediaPlayer-JNI(29213): release
10-13 14:27:02.450: V/MediaPlayer(29213): setListener
10-13 14:27:02.450: V/MediaPlayer(29213): disconnect
10-13 14:27:02.450: D/dalvikvm(29213): GC_CONCURRENT freed 676K, 24% free 4563K/5959K, paused 81ms+42ms, total 289ms
10-13 14:27:02.460: V/MediaPlayer(29213): destructor
10-13 14:27:02.460: V/MediaPlayer(29213): disconnect

I also noticed the following line when I start the barcode plugin from the app:

10-13 14:30:50.440: I/AutoFocusManager(1191): Current focus mode 'off'; use auto focus? false

Could it be possible that it can not auto focus anymore? Because I noticed the camera does not focus on the barcode but way back in the background and does not change the focus...

@trancee
Copy link

trancee commented Oct 13, 2014

@EddyVerbruggen sorry for the delay, I had to first figure out how to take a screenshot on the Galaxy Note 10.1 with KitKat :) ...

Here is the link to the screenshot:
https://www.dropbox.com/s/muqot6qzn7pbtk3/Screenshots_2014-10-13-14-58-48.png?dl=0

Note how the barcode scanner is correctly in the Portrait mode, but the camera shows the picture in Landscape mode.

@EddyVerbruggen
Copy link

Hmm, that may be a limitation of the camera in the Note 10.1, not sure we can help that. Do you need to hold you Note in landscape position to be able to scan a 2D barcode?

@trancee
Copy link

trancee commented Oct 13, 2014

Actually, it is not. Before I updated to your version of the BarcodeScanner plugin, I used the original one and it had that exact same issue on the Galaxy Star phone. With your version, it shows correctly now, but wrong on the Galaxy Note 10.1 (with the original plugin in Landscape mode it works fine). Also, my friend has the same problem on his devices, but not sure which one it is anymore (Nexus probably).

@EddyVerbruggen
Copy link

Sorry I don't have a Note 10.1 so I need to get this clear:

When holding the Note in portrait mode (with the red line horizontal and the camera view shows in landscape mode), can you scan a 2D barcode when holding that barcode horizontally (so underneath the red line)?

If not, does scanning work if you hold the barcode vertically?

@trancee
Copy link

trancee commented Oct 13, 2014

Sorry, I did not answer your question previously.

In that mode, I have to hold the barcode vertically for the scanner to recognize the code. It won't work if I hold it horizontally.

@EddyVerbruggen
Copy link

OK, that's not good :)

Is it possible for you to share your entire project with me? Including the AndroidManifest.xml etc?

@trancee
Copy link

trancee commented Oct 13, 2014

Unfortunately, I am not able to share the project. But I could set up a test project where the exact same problem occurs. I am using Cordova and Sencha Touch framework. Would that help?

@EddyVerbruggen
Copy link

Yes it would be of tremendous help!

@trancee
Copy link

trancee commented Oct 13, 2014

I have added you to the repository. I confirm that the current APK there has the problem on my Galaxy Note 10.1.

@cgort
Copy link

cgort commented Oct 15, 2014

I'm having similar issues with the latest plugin (stretched, distorted image in portrait mode) on a samsung galaxy 7plus tablet. It worked fine in previous versions where it rotated into landscape for the scan. I'll keep checking in to see if there are new updates. In the meantime, is it possible to revert to a previous version, via cordova plugin add [email protected] ?

@EddyVerbruggen
Copy link

@cgort Yes you can use https://github.com/Telerik-Verified-Plugins/[email protected]

I will release a new version tomorrow btw.

EddyVerbruggen added a commit that referenced this issue Oct 17, 2014
EddyVerbruggen added a commit that referenced this issue Oct 17, 2014
@cgort
Copy link

cgort commented Oct 20, 2014

Eddy, the latest version (1.2.8) hangs on both the Galaxy7plus tablet running 4.0.4 and Galaxy Ace 2 phone running 4.1.2 that I'm testing with. My code simply does:
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan( showScanResult, showScanError ); Neither the success nor the error are ever getting called. Any thoughts?

@cgort
Copy link

cgort commented Oct 20, 2014

OK, I found that if I use the syntax: cordova.plugins.barcodeScanner.scan(showScanResult, showScanError); the plugin gets kicked off correctly. However, on the tablet, it comes in upside down in portrait mode, and on the phone, the video preview is stretched a little vertically in portrait mode, so that when if finds a qr code, the overlay of the code with the outline and dots does not line up with the video of the code. If the phone is held in landscape, the video seems correct, but the overlay comes in stretched horizontally.

@andymac4182
Copy link
Author

Any update on these last bugs?

EddyVerbruggen added a commit that referenced this issue Nov 14, 2015
…id projects which have not set targetSDK (crashed without it)
EddyVerbruggen added a commit that referenced this issue Nov 14, 2015
EddyVerbruggen added a commit that referenced this issue Nov 14, 2015
EddyVerbruggen added a commit that referenced this issue Nov 14, 2015
EddyVerbruggen pushed a commit that referenced this issue Nov 14, 2015
Make scanning on iOS a little bit more robust
EddyVerbruggen added a commit that referenced this issue Apr 16, 2016
Image upside down on tablet #20
Android UI doesn't support Portrait and is small #4
Prebuilt Zebra Crossing (xzing) Library #3
Forcing landscape on camera android #17

And also fixes these issues found here (possibly others as well):
Android Nexus 5x upside down images phonegap/phonegap-plugin-barcodescanner#175
Support Aztec for Android and Ios phonegap/phonegap-plugin-barcodescanner#195
Android: Force landscape orientation? phonegap/phonegap-plugin-barcodescanner#177
Android M issues. Due to new intent/permissions phonegap/phonegap-plugin-barcodescanner#167
Problem with Android 6.0.1 phonegap/phonegap-plugin-barcodescanner#139
Is the zxing version used years away from the original zxing lib? phonegap/phonegap-plugin-barcodescanner#124
Updating ZXing Library phonegap/phonegap-plugin-barcodescanner#59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants