public interface

KnowledgeImageProvider

com.salesforce.android.knowledge.ui.KnowledgeImageProvider

Class Overview

Interface for providing background/header images for articles and data categories.

Images may be provided for articles and data categories by implementing this interface and then passing an instance of the resultant class to the KnowledgeUI client via the setImageProvider(KnowledgeImageProvider) method.

The interface does not specify how the images are sourced, but the recommended implementation is to load them from disk. For performance reasons, it is recommended that implementations cache the loaded assets for future requests. Failure to do so may result in UI lag and excess memory consumption. The Android SDK provides an android.support.v4.util.LruCache which is an excellent choice for a backing cache to a KnowledgeImageProvider.

Summary

Public Methods
abstract Drawable getImageForArticle(Context context, ArticleSummary article)
Returns a Drawable image for the given article, or null if no image should be used.
abstract Drawable getImageForDataCategory(Context context, DataCategorySummary dataCategory)
Returns a Drawable image for the given data category, or null if no image should be used.

Public Methods

public abstract Drawable getImageForArticle (Context context, ArticleSummary article)

Returns a Drawable image for the given article, or null if no image should be used.

Parameters
context A context object to use.
article The article for which an image should be returned.
Returns
  • A drawable image for the article or null.

public abstract Drawable getImageForDataCategory (Context context, DataCategorySummary dataCategory)

Returns a Drawable image for the given data category, or null if no image should be used.

Parameters
context A context object to use.
dataCategory The data category for which an image should be returned.
Returns
  • A drawable image for the data category or null.