muzei-api / com.google.android.apps.muzei.api.provider / MuzeiArtProvider / isArtworkValid

isArtworkValid

open fun isArtworkValid(artwork: Artwork): Boolean

Called every time an image is loaded (even if there is a cached image available). This gives you an opportunity to circumvent the typical loading process and remove previously cached artwork on demand. The default implementation always returns true.

In most cases, you should proactively delete Artwork that you know is not valid rather than wait for this callback since at this point the user is specifically waiting for the image to appear.

The MuzeiArtProvider will call onInvalidArtwork for you if you return false - there is no need to call this manually from within this method.

Parameters

artwork - The Artwork to confirm

Return
Whether the Artwork is valid and should be loaded