use of android.content.res.TypedArray in project platform_frameworks_base by android.
the class RippleDrawable method applyTheme.
@Override
public void applyTheme(@NonNull Theme t) {
super.applyTheme(t);
final RippleState state = mState;
if (state == null) {
return;
}
if (state.mTouchThemeAttrs != null) {
final TypedArray a = t.resolveAttributes(state.mTouchThemeAttrs, R.styleable.RippleDrawable);
try {
updateStateFromTypedArray(a);
verifyRequiredAttributes(a);
} catch (XmlPullParserException e) {
rethrowAsRuntimeException(e);
} finally {
a.recycle();
}
}
if (state.mColor != null && state.mColor.canApplyTheme()) {
state.mColor = state.mColor.obtainForTheme(t);
}
updateLocalState();
}
use of android.content.res.TypedArray in project platform_frameworks_base by android.
the class RippleDrawable method inflate.
@Override
public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Theme theme) throws XmlPullParserException, IOException {
final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.RippleDrawable);
// Force padding default to STACK before inflating.
setPaddingMode(PADDING_MODE_STACK);
// Inflation will advance the XmlPullParser and AttributeSet.
super.inflate(r, parser, attrs, theme);
updateStateFromTypedArray(a);
verifyRequiredAttributes(a);
a.recycle();
updateLocalState();
}
use of android.content.res.TypedArray in project platform_frameworks_base by android.
the class RotateDrawable method applyTheme.
@Override
public void applyTheme(@NonNull Theme t) {
super.applyTheme(t);
final RotateState state = mState;
if (state == null) {
return;
}
if (state.mThemeAttrs != null) {
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.RotateDrawable);
try {
updateStateFromTypedArray(a);
verifyRequiredAttributes(a);
} catch (XmlPullParserException e) {
rethrowAsRuntimeException(e);
} finally {
a.recycle();
}
}
}
use of android.content.res.TypedArray in project platform_frameworks_base by android.
the class ScaleDrawable method applyTheme.
@Override
public void applyTheme(@NonNull Theme t) {
super.applyTheme(t);
final ScaleState state = mState;
if (state == null) {
return;
}
if (state.mThemeAttrs != null) {
final TypedArray a = t.resolveAttributes(state.mThemeAttrs, R.styleable.ScaleDrawable);
try {
updateStateFromTypedArray(a);
verifyRequiredAttributes(a);
} catch (XmlPullParserException e) {
rethrowAsRuntimeException(e);
} finally {
a.recycle();
}
}
updateLocalState();
}
use of android.content.res.TypedArray in project platform_frameworks_base by android.
the class ShapeDrawable method inflate.
@Override
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
super.inflate(r, parser, attrs, theme);
final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.ShapeDrawable);
updateStateFromTypedArray(a);
a.recycle();
int type;
final int outerDepth = parser.getDepth();
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
final String name = parser.getName();
// call our subclass
if (!inflateTag(name, r, parser, attrs)) {
android.util.Log.w("drawable", "Unknown element: " + name + " for ShapeDrawable " + this);
}
}
// Update local properties.
updateLocalState(r);
}
Aggregations