murraycu / android-galaxyzoo

This Android app lets you classify Galaxy Zoo subjects. It is available in the Google Play Store: https://play.google.com/store/apps/details?id=com.murrayc.galaxyzoo.app . Try beta versions early here: https://play.google.com/apps/testing/com.murrayc.galaxyzoo.app . See also the iPhone app for Galaxy Zoo: https://github.com/murraycu/ios-galaxyzoo/
GNU General Public License v3.0
11 stars 13 forks source link

Correctly share image via share menu item #36

Open avitaker opened 7 years ago

avitaker commented 7 years ago

Solves issue #30. Now added some documentation, removed some generated files and hardcoded strings.

Previously, there were permission problems from trying to share the image to image sharing apps, according to the issue tracker. The following changes were made: FileProvider class is defined in AndroidManifest, along with the required meta-data and associated files (a string was added to strings.xml for the provider authority). This is apparently required for sharing streams in Android M and above. Temporary file of the image is written to keep track of exact file location, as well as have a temporary cache of previously shared images. This is done in an AsyncTask that is defined at the bottom of SubjectFragment and executed in the updateShareIntent method. In devices with Android M or above, explicit permission to write and read images is obtained if not already provided. The FileProvider class is used to create the URI that will eventually be sent in the intent. An intent flag is added for purposes of magic (I'm not really sure what it does, but it works).

In the limited use case of trying to share images, this code works. Additional changes might be required to distinguish text from image intents to share, because the code right now will set the share intent to an image type if mUriImageRemote is not null.

murraycu commented 7 years ago

Please squash these into one commit.

murraycu commented 7 years ago

Could you do that, please?

avitaker commented 7 years ago

Absolutely. Sorry, I've been busy recently but I'll try to squash the changes into one commit within the next 24 hours.

avitaker commented 7 years ago

Hey, I've attempted to squash the commits into one, but they're still showing as 6 commits ahead on my branch. I'm not sure if that's what you're looking for.

murraycu commented 7 years ago

Thanks, but this is indeed a mess. I will try to pick the useful parts out of this.

murraycu commented 7 years ago

OK. I have now pushed a commit with your changes, including some minor cleanup.

To do that, I did this.

Thanks.

murraycu commented 7 years ago

This is the commit: https://github.com/murraycu/android-galaxyzoo/commit/863c54e20969b1f542216ce998c4946cc4c1c234

avitaker commented 7 years ago

Alright, thank you for cleaning it up for me, I'm actually not very experienced with git. Glad we could work together to fix that issue, and I'll rebase to your master

murraycu commented 7 years ago

If in doubt, I create a new branch and cherry-pick commits into. If even that doesn't work then I "git format-patch HEAD~10" and apply the patches manually.

I "git rebase -i HEAD~10" to squash commits together.

murraycu commented 7 years ago

For now, I have reverted this change: https://github.com/murraycu/android-galaxyzoo/commit/5720d6f35e16d9fb5100e752a1131cb0a2a86742 due to this problem: https://github.com/murraycu/android-galaxyzoo/issues/30#issuecomment-308060395

We should push the change again when we have resolved this problem, maybe with an extra commit. Here is the commit message for the original commit, which we could reuse: https://github.com/murraycu/android-galaxyzoo/commit/863c54e20969b1f542216ce998c4946cc4c1c234

avitaker commented 7 years ago

Ah that's true. I can think of a solution to the problem but I'll have to sit down and implement and test it on my end. I'll look into it this week.

On Mon, Jun 26, 2017 at 2:10 AM, Murray Cumming notifications@github.com wrote:

For now, I have reverted this change: 5720d6f https://github.com/murraycu/android-galaxyzoo/commit/5720d6f35e16d9fb5100e752a1131cb0a2a86742 due to this problem:

30 (comment)

https://github.com/murraycu/android-galaxyzoo/issues/30#issuecomment-308060395

We should push the change again when we have resolved this problem, maybe with an extra commit. Here is the commit message for the original commit, which we could reuse: 863c54e https://github.com/murraycu/android-galaxyzoo/commit/863c54e20969b1f542216ce998c4946cc4c1c234

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/murraycu/android-galaxyzoo/pull/36#issuecomment-310980500, or mute the thread https://github.com/notifications/unsubscribe-auth/ALzzBOHsmrodOGE4xJwhgnFMEGw6dWbfks5sH1l0gaJpZM4M4UUB .