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

New Feature : Possibility to have a full screen barcode #113

Closed
djelloul78 opened this issue Jun 25, 2017 · 11 comments
Closed

New Feature : Possibility to have a full screen barcode #113

djelloul78 opened this issue Jun 25, 2017 · 11 comments

Comments

@djelloul78
Copy link

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.

@brarcher
Copy link
Owner

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.

@djelloul78
Copy link
Author

That seems a viable solution.
But depending on screen size, the barcode could look downsized for some users.
Anyway, give your solution a shot and you'll see the users feedback about it.
IMHO, you'll not receive any complain from people using 5" or less screen sized phones.
Over this size, you'll probably experience strange barcode drawings.
Be assured that I'll test your next release and let you know about this feature.
Thank you for your kind attention.

@brarcher
Copy link
Owner

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 (:

@djelloul78
Copy link
Author

Hello! This is me again...
I'm using your v0.11.1 version currently.
I see that you applied a limitation in width to the barcode.
It's working good with barcode serial that are not too long, but I have some barcode that are longer and that requires more bars to be represented. In this case the bars are very tiny and some barcode reader have difficulty to read the one in the phone screen.
I'm using a 5 inch screen phone, and I can see the barcode could be wider.
I understood your intention with your previous description, but don't you go a little bit too tight on the barcode size?

@brarcher
Copy link
Owner

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:

image

When restricting the width only, the ratio was off and the 1D barcodes were squished:

image

The following is reducing the width to 600 px, scaling the height to match the original ratio, then displaying in the available ImageView:

image

At 500 px:

image

and 400 px:

image

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.

@djelloul78
Copy link
Author

Thank you for your complete explanation.
I'll follow your next release and let you know if things are improved.
Your idea to limit the width to avoid out of memory situation is still a sart one, but regarding your analysis, it seems it could be a good idea to identify what screen size is used and its current DPI to adapt dynamically the barcode shown on the device.

I'm really sorry to be just a critic and not able to give you proper help in coding...
I can understand it could be boring to only receive complain from users that doesn't measure the time and job intelligence it requires sometimes....

Thank you again for your kind attention.

@brarcher
Copy link
Owner

I'm really sorry to be just a critic and not able to give you proper help in coding...
I can understand it could be boring to only receive complain from users that doesn't measure the time and job intelligence it requires sometimes....

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.

it seems it could be a good idea to identify what screen size is used and its current DPI to adapt dynamically the barcode shown on the device.

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:

screen shot 2017-07-12 at 10 19 28 pm

and after the memory limit change:

screen shot 2017-07-12 at 10 20 31 pm

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.

@djelloul78
Copy link
Author

Hello,

I just tried your v0.12 version and now the barcode fits perfectly in portrait orientation.
In landscape mode, the barcode width stays the same but correctly centered making the image looks less tight.
The height stays the same as in portrait orientation too, but this makes a part of the barcode out of the screen and we have to slide the screen up to see it entirely.
This is not a flaw, but I think it could be a good idea to limit the height of the barcode in landscape mode to avoid the needs to "explore" the screen to see everything it contains when presented in this position.
What do you think?

@brarcher
Copy link
Owner

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.

@djelloul78
Copy link
Author

So I have a suggestion.
Why don't you show the barcode first and after the code information?
In fact, the most useful information is the barcode itself.
It could be an easy fix.

@brarcher
Copy link
Owner

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!

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

2 participants