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

Long list of improvements #7

Merged
merged 5 commits into from
Jan 5, 2016
Merged

Conversation

ZKjellberg
Copy link
Contributor

  1. New permission implementation. App now checks whenever user makes a request. Upon confirming permission, app initiates processing request
  2. Updated the TextView output with better formatting
    .4 New App Icon using Android Studio Image Generator Tool
  3. New Screenshot for README, with Nexus 6P frame using Android Studio Screenshot Tool
  4. Added freezesText to TextView XML which stores state for rotation
  5. onActivityResult did not require FileReader, which also means the try/catch was unnecessary
  6. Replaced hard link path to internal data with the proper method call to discover
  7. Removed WRITE_INTERNAL_STORAGE as this permission does not exist
  8. Updated TextView text on failure
  9. Added font size to TextView to increase visibility. This helped provide a better screenshot.

1. New permission implementation. App now checks whenever user makes a request. Upon confirming permission, app initiates processing request
2. Updated the TextView output with better formatting
.4 New App Icon using Android Studio Image Generator Tool
5. New Screenshot for README, with Nexus 6P frame using Android Studio Screenshot Tool
6. Added freezesText to TextView XML which stores state for rotation
7. onActivityResult did not require FileReader, which also means the try/catch was unnecessary
8. Replaced hard link path to internal data with the proper method call to discover
9. Removed WRITE_INTERNAL_STORAGE as this permission does not exist
10. Updated TextView text on failure
Increased font size for result.
@ZKjellberg
Copy link
Contributor Author

Bullet 4 partially resolves Issue #6.I am not sure yet how to save the state of the Picasso image.

I encountered a few odd issues while testing. (Updated numbers to continue from first post)
10. Picasso does not embedd images on failures. I'm not sure why since the code to embedd the image is before the result check.
11. There might be a limit to how many requests you can make per minute. After testing, I would get failures, but waiting a few minutes would have them working again.
12. I am sometimes getting a NullPointerException error for the following code: if (results == null || results.getResults().size() == 0) { Does Java check both conditions simultaneously? I cannot reproduce this reliably.

FATAL EXCEPTION: main
Process: com.sandro.openalprsample, PID: 26642
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
   at com.sandro.openalprsample.MainActivity$2$1.run(MainActivity.java:96)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5417)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

… was never updated. It will now generate a new path for each image, allowing a refresh.

Centered TextView contents.
@ZKjellberg
Copy link
Contributor Author

Regarding my comment bullet 10 on Picasso not embedding images on failures. This was not due to the failure, this was because the variable destination = new File(Environment.getExternalStorageDirectory(), name + ".jpg"); was in the onCreate() and was never updated, resulting in the same file path being used every time, which Picasso did not seem to want to refresh. For the moment, I changed this to a new path on each request. Problem here, which is same problem on exhaustive testing, is the user will create a large collection of images in the data folder which will never be used again.

I am wondering if there is a better approach for this instead of writing to storage. If it is possible to pull directly from camera result and use it in memory for the session. This would remove the need for the storage permission, but would be a challenge for retaining state.

…sso. Picasso doesn't complain about null requests interestingly.
@ZKjellberg
Copy link
Contributor Author

In prior commit I improved TextEdit by setting it the text to be centered.

For latest commit, this should close issue #6. I added a static reference to the last used destination and load this value upon onResume(). Allowing user to rotate screen without losing any data. Curiously my onCreate() TextView initialization value does not overwrite the result.

Think I am happy with current workflow beyond maybe wanting to add a toggle button for EU or USA plates.

@SandroMachado
Copy link
Owner

  1. I am sometimes getting a NullPointerException error for the following code: if (results == null || results.getResults().size() == 0) { Does Java check both conditions simultaneously? I cannot reproduce this reliably.

It is necessary to add a null point check to the results.getResults(). I will try to do it later.

@ZKjellberg thanks again for your great work! I really appreciate your help.

SandroMachado added a commit that referenced this pull request Jan 5, 2016
Long list of improvements
@SandroMachado SandroMachado merged commit 7cef5c1 into SandroMachado:master Jan 5, 2016
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

Successfully merging this pull request may close these issues.

None yet

2 participants