public class ResourcesImpl extends Object
Resources
is just a thing wrapper around this class. When a configuration change
occurs, clients can retain the same Resources
reference because the underlying
ResourcesImpl
object will be updated or re-created.Modifier and Type | Class and Description |
---|---|
class |
ResourcesImpl.ThemeImpl |
Constructor and Description |
---|
ResourcesImpl(AssetManager assets,
DisplayMetrics metrics,
Configuration config,
DisplayAdjustments displayAdjustments)
Creates a new ResourcesImpl object with CompatibilityInfo.
|
Modifier and Type | Method and Description |
---|---|
int |
calcConfigChanges(Configuration config)
Applies the new configuration, returning a bitmask of the changes
between the old and new configurations.
|
void |
flushLayoutCache()
Call this to remove all cached loaded layout resources from the
Resources object.
|
AssetManager |
getAssets() |
DisplayAdjustments |
getDisplayAdjustments() |
void |
startPreloading()
Start preloading of resource data using this Resources object.
|
void |
updateConfiguration(Configuration config,
DisplayMetrics metrics,
CompatibilityInfo compat) |
public ResourcesImpl(AssetManager assets, DisplayMetrics metrics, Configuration config, DisplayAdjustments displayAdjustments)
assets
- Previously created AssetManager.metrics
- Current display metrics to consider when
selecting/computing resource values.config
- Desired device configuration to consider when
selecting/computing resource values (optional).displayAdjustments
- this resource's Display override and compatibility info.
Must not be null.public DisplayAdjustments getDisplayAdjustments()
public AssetManager getAssets()
public void updateConfiguration(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat)
public int calcConfigChanges(Configuration config)
config
- the new configurationpublic void flushLayoutCache()
public final void startPreloading()