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) Update empty filename issue for supporting multiple images #641

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arshad54
Copy link

@arshad54 arshad54 commented Aug 4, 2020

Platforms affected

Android

Motivation and Context

I was stucked from few days because i am not able to get correct path for the images selected using PHOTOALBUM but then i got a new problem after rectifying the issue i found that the cameraLauncher.java file renaming every image selected from gallery to .Pic. therefore its very difficult to differentiate them and also it is overriding the images.

Description

This is required to differ between multiple images as the java file renaming every file to .Pic. so instead this i added timestamp to the empty filename so that the developer can able to differentiate between multiple files and their paths.

Testing

I have tested this on android 10 using camera and gallery app in my device and it is working fine.

Checklist

  • [x ] I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@arshad54 arshad54 changed the title Update empty filename issue for supporting multiple images (android) Update empty filename issue for supporting multiple images Aug 4, 2020
Comment on lines +338 to +340
//creating timestamps for empty filename to differentiate between multiple files selected via gallery
String timeStamp = new SimpleDateFormat(TIME_FORMAT).format(new Date());
fileName = timeStamp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//creating timestamps for empty filename to differentiate between multiple files selected via gallery
String timeStamp = new SimpleDateFormat(TIME_FORMAT).format(new Date());
fileName = timeStamp;
// Append the current time in milliseconds for empty filename to differentiate between multiple files selected via gallery
fileName = ".Pic-" + System.currentTimeMillis();

IMO, I would suggest the above.

What you have might work to a certain point.

The TIME_FORMAT's lowest placement is in seconds.

Could someone take burst shots and therefore have many photos per second. Using System.currentTimeMillis might help out a bit since it's now in milliseconds.

Example filename with the above code would be: .Pic-1647402802991

I would not recommend updating the value of TIME_FORMAT. If changed, then the PR becomes a major breaking PR.

To keep or not to keep the ".Pic-" prefix is questionable? If it is kept as a prefix, then it could be used as a keyword filter when grabbing all files with the .Pic prefixed. I don't know if this is necessary, but I also don't know what other files exist in the same directory.

What do you think?

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.

2 participants