Methods Summary |
---|
public void | applyOverrideConfiguration(android.content.res.Configuration overrideConfiguration)Call to set an "override configuration" on this context -- this is
a configuration that replies one or more values of the standard
configuration that is applied to the context. See
{@link Context#createConfigurationContext(Configuration)} for more
information.
This method can only be called once, and must be called before any
calls to {@link #getResources()} are made.
if (mResources != null) {
throw new IllegalStateException("getResources() has already been called");
}
if (mOverrideConfiguration != null) {
throw new IllegalStateException("Override configuration has already been set");
}
mOverrideConfiguration = new Configuration(overrideConfiguration);
|
protected void | attachBaseContext(android.content.Context newBase)
super.attachBaseContext(newBase);
|
public android.content.res.Resources | getResources()
if (mResources != null) {
return mResources;
}
if (mOverrideConfiguration == null) {
mResources = super.getResources();
return mResources;
} else {
Context resc = createConfigurationContext(mOverrideConfiguration);
mResources = resc.getResources();
return mResources;
}
|
public java.lang.Object | getSystemService(java.lang.String name)
if (LAYOUT_INFLATER_SERVICE.equals(name)) {
if (mInflater == null) {
mInflater = LayoutInflater.from(getBaseContext()).cloneInContext(this);
}
return mInflater;
}
return getBaseContext().getSystemService(name);
|
public Resources.Theme | getTheme()
if (mTheme != null) {
return mTheme;
}
mThemeResource = Resources.selectDefaultTheme(mThemeResource,
getApplicationInfo().targetSdkVersion);
initializeTheme();
return mTheme;
|
public int | getThemeResId()
return mThemeResource;
|
private void | initializeTheme()
final boolean first = mTheme == null;
if (first) {
mTheme = getResources().newTheme();
Resources.Theme theme = getBaseContext().getTheme();
if (theme != null) {
mTheme.setTo(theme);
}
}
onApplyThemeResource(mTheme, mThemeResource, first);
|
protected void | onApplyThemeResource(Resources.Theme theme, int resid, boolean first)Called by {@link #setTheme} and {@link #getTheme} to apply a theme
resource to the current Theme object. Can override to change the
default (simple) behavior. This method will not be called in multiple
threads simultaneously.
theme.applyStyle(resid, true);
|
public void | setTheme(int resid)
mThemeResource = resid;
initializeTheme();
|