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

Update to Muzei API 3.4, fixing issues on Android 10+ #10

Merged
merged 1 commit into from
Oct 14, 2020

Conversation

ianhanniballake
Copy link
Contributor

Upgrade all the way up to the new Muzei API 3.4. This has a number of implications that affected quite a bit of code:

  • Muzei API 3.4 relies on Kotlin 1.3.72 and compileSdkVersion of 30. This required updating to Android Gradle Plugin 4.0.1 as well as AndroidX dependencies of WorkManager and Multidex.
  • Removes the remaining implementation of BingImageOfTheDayArtSource (every Muzei user has upgraded to Muzei 3.0+ by this point).
  • COMMAND_ID_OPEN has been removed entirely - that behavior is already handled by Muzei when you tap on the title on Muzei. It was Muzei API 3.2 that fixed that on Android 10+ devices.
  • The new getCommandActions() API fixes the 'Share current Bing image' action on Android 10+ devices. By keeping the old APIs as well, we maintain backward compatibility with Muzei 3.3 users (although they'll still need to upgrade to Muzei 3.4 to get a working action). It now shows as a Share icon on Muzei 3.4.
  • Reworked the entire approach for sharing the image so that it works consistently without needing an extra copy of each image and the need for Picasso and FileProvider. This required reworking BingImageContentProvider to act as the stand in for FileProvider that directly talks to BingImageOfTheDayArtProvider.

Fixes #9

Upgrade all the way up to the new [Muzei API 3.4](https://github.com/romannurik/muzei/releases/tag/api3.4.0). This has a number of implications that affected quite a bit of code:

- Muzei API 3.4 relies on Kotlin 1.3.72 and `compileSdkVersion` of 30. This required updating to Android Gradle Plugin 4.0.1 as well as AndroidX dependencies of WorkManager and Multidex.
- Removes the remaining implementation of `BingImageOfTheDayArtSource` (every Muzei user has upgraded to Muzei 3.0+ by this point).
- `COMMAND_ID_OPEN` has been removed entirely - that behavior is already handled by Muzei when you tap on the title on Muzei. It was Muzei API 3.2 that fixed _that_ on Android 10+ devices.
- The new `getCommandActions()` API fixes the 'Share current Bing image' action on Android 10+ devices. By keeping the old APIs as well, we maintain backward compatibility with Muzei 3.3 users (although they'll still need to upgrade to Muzei 3.4 to get a working action). It now shows as a Share icon on Muzei 3.4.
- Reworked the entire approach for sharing the image so that it works consistently without needing an extra copy of each image and the need for Picasso and FileProvider. This required reworking `BingImageContentProvider` to act as the stand in for `FileProvider` that directly talks to `BingImageOfTheDayArtProvider`.

Fixes devmil#9
strievi added a commit to strievi/muzei-bingimageoftheday that referenced this pull request Aug 4, 2020
Rework 02cbb9f to delegate responsibility of providing image files
to `BingImageOfTheDayContentProvider`. This removes the need of an
intermediary cache (`FileProvider`) as filenames are now set through
`OpenableColumns.DISPLAY_NAME`. Also, missing cache files will be
automatically recovered when external apps call `openFile()`. Note,
however that some of them (e.g., Gmail/Drive/Keep on Android 5.1.1) will
cause `NetworkOnMainThreadException`s since they are calling this
synchronously.

See also: devmil#10
@devmil
Copy link
Owner

devmil commented Oct 14, 2020

Sorry for the late reply.
Wow. What a great effort! Thank you for contributing this.

@devmil devmil merged commit 416e62a into devmil:master Oct 14, 2020
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.

Share menu not working on Android 10
2 participants