public class ConfigurationBoundResourceCache<T> extends Object
Constructor and Description |
---|
ConfigurationBoundResourceCache() |
Modifier and Type | Method and Description |
---|---|
T |
get(long key,
Resources.Theme theme)
Returns an entry from the cache.
|
T |
getInstance(long key,
Resources resources,
Resources.Theme theme)
If the resource is cached, creates and returns a new instance of it.
|
void |
onConfigurationChange(int configChanges)
Prunes cache entries that have been invalidated by a configuration
change.
|
void |
put(long key,
Resources.Theme theme,
T entry)
Adds a new theme-dependent entry to the cache.
|
void |
put(long key,
Resources.Theme theme,
T entry,
boolean usesTheme)
Adds a new entry to the cache.
|
boolean |
shouldInvalidateEntry(ConstantState<T> entry,
int configChanges)
Returns whether a cached entry has been invalidated by a configuration
change.
|
public T getInstance(long key, Resources resources, Resources.Theme theme)
key
- a key that uniquely identifies the drawable resourceresources
- a Resources object from which to create new instances.theme
- the theme where the resource will be usednull
if not in
the cachepublic boolean shouldInvalidateEntry(ConstantState<T> entry, int configChanges)
entry
- a cached entryconfigChanges
- a non-zero bitmask of configuration changestrue
if the entry is invalid, false
otherwisepublic void put(long key, Resources.Theme theme, T entry)
key
- a key that uniquely identifies the entrytheme
- the theme against which this entry was inflated, or
null
if the entry has no theme appliedentry
- the entry to cachepublic void put(long key, Resources.Theme theme, T entry, boolean usesTheme)
key
- a key that uniquely identifies the entrytheme
- the theme against which this entry was inflated, or
null
if the entry has no theme appliedentry
- the entry to cacheusesTheme
- true
if the entry is affected theme changes,
false
otherwisepublic T get(long key, Resources.Theme theme)
key
- a key that uniquely identifies the entrytheme
- the theme where the entry will be usednull
if not in the cachepublic void onConfigurationChange(int configChanges)
configChanges
- a bitmask of configuration changes