ImageResourcesHandler

public final class ImageResourcesHandler

Resource Handler that manages requests and cache of image resources

Fields

RES_INTEREST_IMG

public static final int RES_INTEREST_IMG

Interest image resource type

RES_USER_IMG

public static final int RES_USER_IMG

User image resource type

Methods

clearCache

public static void clearCache(Context context)

Clears all the cached files

Parameters:
  • context – Context of the calling activity

fillImageResource

public static void fillImageResource(String imageId, int resourceType, String token, ImageView imgView, Context context)

Fills the parameter image view with the server image resourve

Parameters:
  • imageId – Image id
  • resourceType – Type of the resource (one of the listed RES_* constants)
  • token – Session token
  • imgView – Imageview to fill with the resource
  • context – Context of the calling activity

freeCachedResource

public static void freeCachedResource(String imageId, int resourceType, Context context)

Removes from cache an specific resource

(Helpful when a certain resource is never going to be used again for sure)

Parameters:
  • imageId – Image id
  • resourceType – Type of the resource (one of the listed RES_* constants)
  • context – Context of the calling activity

prefetch

public static void prefetch(String imageId, int resourceType, String token, Context context)

Prefetch resources from server (if needed) in order to improve network resources use.

Parameters:
  • imageId – Server id of the fetching resource
  • resourceType – Type of the resource (One of listed const types)
  • context – Context of the calling activity
  • token – User token needed by the server to auth client