-
Notifications
You must be signed in to change notification settings - Fork 30
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
New Feature : Possibility to have a full screen barcode #113
Comments
I've seen devices where if the barcode were as wide as the screen the application runs out of memory. See #99 for details. Because of this, I created a change (which will appear in the next release) which would limit the width of the generated barcode to prevent out of memory errors. If the screen were less wide that the limit then the barcode would reach the end of the screen, less a margin. There may be a better way to generate the barcodes which would prevent the memory issues when drawing large barcodes. I've not been able to figure that out yet, however. |
That seems a viable solution. |
Hopefully the barcodes will not look strange, they may just look a little small as it will not fill the screen. The device which encountered an issue with running out of memory was a tablet in landscape. Just let me know your feedback when the next release comes (: |
Hello! This is me again... |
I think you are right. Some of the 1D barcodes are too narrow now. The issue is that I restricted the width but did not scale the height, so that the ratio matches. Prior to the change the barcode "123" appeared as the following when entering a barcode: When restricting the width only, the ratio was off and the 1D barcodes were squished: The following is reducing the width to 600 px, scaling the height to match the original ratio, then displaying in the available ImageView: At 500 px: and 400 px: On my screen I start to see the barcodes become blurry at a 400 px, so I'll put in a change to enforce a maximum width of 500 px for the barcode generation, then scale the height. This should result in barcodes which still display properly, should not be blurry (or at least not on my screen), and will not consume too much memory. Let me know in the next release if this works for you. |
Thank you for your complete explanation. I'm really sorry to be just a critic and not able to give you proper help in coding... Thank you again for your kind attention. |
Nah, do not be sorry. Developing this application is part of my hobby (I do not get any money from it). There was no open source app that I could find which filled the needs of loyalty card management, so I took it on. In creating the app I've learned a fair amount about Android and barcode. Currently 1000+ people find the application useful, and if making some changes helps it be more useful to them and myself, why not try. (: Constructive criticism or help in finding issues is appreciated.
My understanding is that each application process in Android has a maximum amount of memory is is allowed to have. If it exceeds that limit the process fails/crashes. From data reported to Google on this app, one user on a large tablet found that display a barcode required more memory that the limit. As a result, I think the app was not usable on that tablet. Investigating the app my my phone, I found that the Select Barcode screen was consuming almost 32MB. By limiting the memory used to render a barcode (described earlier) this value is reduced to around 20MB. I cannot say how much memory was consumed by the tablet, but given the resolution which was reported I can see how the barcodes would have exceed the memory limit. If the barcode resolution was determined dynamically based on the screen size, care would need to be taken to prevent exceeding the memory limit on large screens. I think that the resolution of the barcode could be adapted based on the screen dimensions, so that as the screen size increases the barcode does not get blurry. The trouble I run into is that I do not have any hardware to test against to know what is acceptable and what memory limits to impose. I'm fairly confident that having a fixed limit will prevent the memory issue, but I do not know how blurry the barcodes will become. My tablet emulator shows the following before the change: and after the memory limit change: I see that the 1D barcodes look good. But, the 2D barcodes start to shown signs of becoming blurry. I can still scan them in using my phone, but I do not know how it will scale for large tablets. If I have an opportunity to try the app out on a tablet I'll see how it looks. Maybe on the Select Barcode screen the memory limits should be more restrictive, and when displaying a single barcode more memory could be used (perhaps based on the screen size) to make a clear barcode. All worthwhile experiments. For now, I'll release the app with the memory changes thus far. The solution can be improved based on feedback and further analysis. Let me know what you see when the next version is released. I'll try to get a release out in the next day or so. |
Hello, I just tried your v0.12 version and now the barcode fits perfectly in portrait orientation. |
I think I know what you mean. When the screen is rotated to landscape you still start at the top of the activity, and the barcode is further down. Hm... You suggestion is to limit the height of the barcode. My concern with that is with 2D barcodes where the height is important. I'll need to think on how to improve that. Maybe a better layout is needed, so that in landscape everything can fit on one screen. |
So I have a suggestion. |
I think that displaying the barcode first is an option. Ideally I would like to have a better layout for much of the app, however nice layouts it not really my strength. For the issue in the title, I think that it is now resolved. Could you add your feedback about the layout to this issue instead: #88. That issue will capture feedback for a better layout. Thanks! |
Hello.
I'm currently using your app and i can tell it's a very optimal answer to the other alternatives.
It has a lightweight memory footprint and is very robust.
I just want to know if it could be possible to make the barcode full screen when we click on it ?
When I say full screen, I mean barcode alone on the screen with its width adapted to the border of the screen, depending on phone orientation, with a margin on each side to avoid confusion with screen border lines.
I hope my explanations are clear enough...
I'd like to help, but my coding knowledge are very outdated...!?
Thank you for your attention.
The text was updated successfully, but these errors were encountered: