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
Provide a prebuilt DocumentsProvider for a MuzeiArtProvider #672
Merged
ianhanniballake
merged 19 commits into
muzei:master
from
ianhanniballake:documents_provider
Jul 5, 2020
Merged
Provide a prebuilt DocumentsProvider for a MuzeiArtProvider #672
ianhanniballake
merged 19 commits into
muzei:master
from
ianhanniballake:documents_provider
Jul 5, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By defining a `MuzeiDocumentsProvider` in your manifest, you can make the artwork provided by one or more `MuzeiArtProvider` instances available to users via the Files app. Adds "My Photos" as the sole users of this API in the `main` module.
Generate thumbnails for each image, ensuring that they are rotated correctly.
Make it more clear that the `MuzeiArtDocumentsProvider` is tied to the `MuzeiArtProvider`.
Implement `isChildDocument()` to support `OPEN_DOCUMENT_TREE` Intents.
Reverse the logic of `getDocumentType` so that `authority/id` documents are correctly listed as `image/png` and `authority` documents are considered directories.
Avoid generating dokka docs for methods that should not be overridden.
Ensure that we include the summary in the default projection for the roots so that the app name is shown as the summary when the app name and provider name don't match.
If a `MuzeiArtDocumentsProvider` exists for a given `MuzeiArtProvider`, changes to the `MuzeiArtProvider` should invalidate the `MuzeiArtDocumentsProvider` correctly, ensuring that users always see the most up to date information.
Ensure that `MuzeiArtDocumentsProvider` properly uses the application's icon or label if there isn't one present on the `MuzeiArtProvider`'s `<provider>` element itself.
`resolveContentProvider` does not throw a `NameNotFoundException`, it just returns null. Therefore we can simply remove the try/catch.
Instead of defining a separate variable in the `build.gradle`, use the `galleryArtAuthority` directly, suffixed with `.documents` in AndroidManifest.xml
Turns out that actually using multiple authorities in a `DocumentsProvider` doesn't work on the vast majority of API levels and devices. Update the guidance to make it more clear that subclassing `MuzeiArtDocumentsProvider` and using a single authority for each is the recommended path.
…dule Follow best practices in using a subclass of `MuzeiArtDocumentsProvider` when building independent modules.
Add the single manifest entry needed to support selecting images via the default file picker / Files app from the Unsplash `MuzeiArtProvider`.
hossain-khan
added a commit
to hossain-khan/android-hk-vision-muzei-plugin
that referenced
this pull request
Jul 6, 2020
Updated project based on guidelines provided in the `MuzeiArtDocumentsProvider` Also targeting API 30 as recommended by the release notes. Also, refactored provider authority to reduce code duplication. (Used example from Unsplash plugin) References: * https://github.com/romannurik/muzei/releases/tag/api3.4.0-alpha3 * muzei/muzei#670 * muzei/muzei#672
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A
DocumentsProvider
is the standard mechanism for making private files (like the images provided by aMuzeiArtProvider
) available to users via the default file picker and Files app.The new
MuzeiArtDocumentsProvider
provides a prebuilt way of exposing the images from an existingMuzeiArtProvider
via aDocumentsProvider
. Developers using this API do not need to write any code themselves - instead, they can add theMuzeiArtDocumentsProvider
to their manifest and connect it to an existingMuzeiArtProvider
by using the appropriate authority (adding a suffix of.documents
to theMuzeiArtProvider
's authority).Fixes #670