public class

SimpleAssetResolver

extends SVGExternalFileResolver
java.lang.Object
   ↳ com.caverock.androidsvg.SVGExternalFileResolver
     ↳ com.caverock.androidsvg.SimpleAssetResolver

Class Overview

A sample implementation of SVGExternalFileResolver that retrieves files from an application's "assets" folder.

Summary

Public Constructors
SimpleAssetResolver(AssetManager assetManager)
Public Methods
boolean isFormatSupported(String mimeType)
Returns true when passed the MIME types for SVG, JPEG, PNG or any of the other bitmap image formats supported by Android's BitmapFactory class.
Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle)
Attempt to find the specified font in the "assets" folder and return a Typeface object.
Bitmap resolveImage(String filename)
Attempt to find the specified image file in the "assets" folder and return a decoded Bitmap.
[Expand]
Inherited Methods
From class com.caverock.androidsvg.SVGExternalFileResolver
From class java.lang.Object

Public Constructors

public SimpleAssetResolver (AssetManager assetManager)

Public Methods

public boolean isFormatSupported (String mimeType)

Returns true when passed the MIME types for SVG, JPEG, PNG or any of the other bitmap image formats supported by Android's BitmapFactory class.

Parameters
mimeType A MIME type (such as "image/jpeg").
Returns
  • true if your resolveImage() implementation supports this file format.

public Typeface resolveFont (String fontFamily, int fontWeight, String fontStyle)

Attempt to find the specified font in the "assets" folder and return a Typeface object. For the font name "Foo", first the file "Foo.ttf" will be tried and if that fails, "Foo.otf".

Parameters
fontFamily Font family as specified in a font-family style attribute.
fontWeight Font weight as specified in a font-weight style attribute.
fontStyle Font style as specified in a font-style style attribute.
Returns
  • an Android Typeface instance, or null

public Bitmap resolveImage (String filename)

Attempt to find the specified image file in the "assets" folder and return a decoded Bitmap.

Parameters
filename the filename as provided in the xlink:href attribute of a <image> element.
Returns
  • an Android Bitmap object, or null if the image could not be found.