[#1101] Add new feature to allow user scan QR code from saved image #1141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
QrBarcodeScanFragment.java: add logical code
drawable: add two xml icons, ic_barcode_from_image_24dp.xml and ic_qrcode_from_image_24dp.xml
modify fragment_qrcode_barcode.xml
modify strings.xml
Description
ScreenShots for the new feature in UI:
![image](https://private-user-images.githubusercontent.com/61658637/277947107-cb551317-1117-43d3-a045-f83d857fd364.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDA4OTksIm5iZiI6MTcyNjEwMDU5OSwicGF0aCI6Ii82MTY1ODYzNy8yNzc5NDcxMDctY2I1NTEzMTctMTExNy00M2QzLWEwNDUtZjgzZDg1N2ZkMzY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDAwMjMxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcwZWFkYTc3MzE2MTExMDRmYWRiZDcyY2MyYjAzZWQyNzIwNGVlODE4YjA5ZjYyZTRjMWIwMTdhYjk2ZDE1NTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5cB2ouQu6bxNnuoPtW-2eK-MkfUci-6Uk_ZOyRSFZ5A)
Two new buttons
users choose images from the gallery
![image](https://private-user-images.githubusercontent.com/61658637/277167767-1ad71176-ce61-4475-ab1e-6b77e7f63a31.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDA4OTksIm5iZiI6MTcyNjEwMDU5OSwicGF0aCI6Ii82MTY1ODYzNy8yNzcxNjc3NjctMWFkNzExNzYtY2U2MS00NDc1LWFiMWUtNmI3N2U3ZjYzYTMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDAwMjMxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5ODY3NDBhOGRkNTQ1NTYwODQ3NjJkMWFmZTQwNjQzY2IzNjhmYjM5NTg2YmQ3NmU5NDY2YWVjZmNkMzQyMWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.cDzybbT1rUkWz7spzXkXRwIz5kM_hRvRD0VrauSWyQ8)
when the user scanned no corresponding code or no code in the saved image
![image](https://private-user-images.githubusercontent.com/61658637/277947001-85144c62-f80b-487e-bffc-96a0273659ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDA4OTksIm5iZiI6MTcyNjEwMDU5OSwicGF0aCI6Ii82MTY1ODYzNy8yNzc5NDcwMDEtODUxNDRjNjItZjgwYi00ODdlLWJmZmMtOTZhMDI3MzY1OWFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDAwMjMxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3MTE0OWZlMzhiYTM5OGUzOTFhZDRjZWYwMjIxYjlmZmM2YTJlNTJiMGYyYmQ2YzUzYTI1OGU3ODE2YTMxZmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.tItfUZOC9xk9KlJFn9rq-JcEkpZ6a9vJ4iQ8BiKbxKg)
when the user scanned a detectable code
![image](https://private-user-images.githubusercontent.com/61658637/277170533-df7387d9-23e9-451f-a757-2d8571bb35ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjYxMDA4OTksIm5iZiI6MTcyNjEwMDU5OSwicGF0aCI6Ii82MTY1ODYzNy8yNzcxNzA1MzMtZGY3Mzg3ZDktMjNlOS00NTFmLWE3NTctMmQ4NTcxYmIzNWFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEyVDAwMjMxOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE1ODI3M2Y2YTFjYTg5YTIxNzczYjQzZGRjNWE5MzEwYWZmZTA3OGExOWNhM2MzYzgyZDkwNGI4MWU3N2IyZTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.pJLKa2L9RmPtuocYG1jVoKejUPHprfrVkQgy_AQdT9I)
As I cannot change the UI in the camera scanning interface, I prefer to add two access points for users to choose what they want to do with the QR/bar code scanner, either read from the gallery or the camera.
I created two new cards for users to choose whether to scan with the camera or from images from the gallery.
I believe this is the optimal solution while maintaining the speed of the original camera opening and not changing the camera interface. It raises the learning cost for the user. Still, once the user is familiar with it, he/she will find it much more appealing as it doesn't pop up a window asking which one to choose and then has to click again to select it if he/she touches it accidentally by mistake. Large icons and clickable areas reduce the number of accidental touches.
Fixes #1101
Type of change
Just put an x in the [] which are valid.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
./gradlew assembleDebug assembleRelease
./gradlew checkstyle
Checklist:
And new codes are highlighted, it's easy to see what has been changed.
Moreover, I found it was incompatible with my editor when I wanted to do the tests on it. I just made a local change with the test. Nothing more changes
System: macOS 14.0
CPU: Apple M2 Pro
EDITOR: Android Studio Flamingo | 2022.2.1