ResourceResolvers

public class ResourceResolvers


Class for resolving resources. Delegates the actual work to different types of resolver classes, and allows each type of resolver to be configured individually, as well as instantiation from common resolver implementations.

Summary

Nested types

ResourceResolvers.AndroidImageResourceByResIdResolver

Interface that can provide a Drawable for an AndroidImageResourceByResId

ResourceResolvers.Builder

Builder for ResourceResolvers

ResourceResolvers.InlineImageResourceResolver

Interface that can provide a Drawable for an InlineImageResource

ResourceResolvers.ResourceAccessException

Exception thrown when accessing resources.

Public methods

static @NonNull ResourceResolvers.Builder

Get an empty builder to build ResourceResolvers with.

@NonNull boolean
canImageBeTinted(@NonNull String protoResourceId)
@NonNull ListenableFuture<@NonNull Drawable>
getDrawable(@NonNull String protoResourceId)

Get the drawable corresponding to the given resource ID.

@NonNull Drawable

Returns the placeholder drawable for the resource specified by {@code protoResourceId}.

@NonNull boolean

Returns whether the resource specified by {@code protoResourceId} has a placeholder resource associated with it.

Public methods

builder

@NonNull
public static ResourceResolvers.Builder builder(@NonNull ResourceProto.Resources protoResources)

Get an empty builder to build ResourceResolvers with.

canImageBeTinted

@NonNull
public boolean canImageBeTinted(@NonNull String protoResourceId)

getDrawable

@NonNull
public ListenableFuture<@NonNull DrawablegetDrawable(@NonNull String protoResourceId)

Get the drawable corresponding to the given resource ID.

getPlaceholderDrawableOrThrow

@NonNull
public Drawable getPlaceholderDrawableOrThrow(@NonNull String protoResourceId)

Returns the placeholder drawable for the resource specified by {@code protoResourceId}.

Throws
androidx.wear.tiles.renderer.internal.ResourceResolvers.ResourceAccessException

If the specified resource does not have a placeholder associated, or the placeholder could not be loaded.

java.lang.IllegalArgumentException

If the specified resource, or its placeholder, does not exist.

See also
hasPlaceholderDrawable

ResourceResolvers#hasPlaceholderDrawable(String)

hasPlaceholderDrawable

@NonNull
public boolean hasPlaceholderDrawable(@NonNull String protoResourceId)

Returns whether the resource specified by {@code protoResourceId} has a placeholder resource associated with it.