Search in sources :

Example 61 with TypedArray

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();
}
Also used : TypedArray(android.content.res.TypedArray) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 62 with TypedArray

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();
}
Also used : TypedArray(android.content.res.TypedArray)

Example 63 with TypedArray

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();
        }
    }
}
Also used : TypedArray(android.content.res.TypedArray) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 64 with TypedArray

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();
}
Also used : TypedArray(android.content.res.TypedArray) XmlPullParserException(org.xmlpull.v1.XmlPullParserException)

Example 65 with TypedArray

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);
}
Also used : TypedArray(android.content.res.TypedArray) Paint(android.graphics.Paint)

Aggregations

TypedArray (android.content.res.TypedArray)2031 Paint (android.graphics.Paint)193 TypedValue (android.util.TypedValue)190 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)162 Drawable (android.graphics.drawable.Drawable)119 Resources (android.content.res.Resources)118 View (android.view.View)117 Context (android.content.Context)80 XmlResourceParser (android.content.res.XmlResourceParser)80 ColorStateList (android.content.res.ColorStateList)78 AttributeSet (android.util.AttributeSet)78 IOException (java.io.IOException)77 SuppressLint (android.annotation.SuppressLint)66 TextPaint (android.text.TextPaint)63 TextView (android.widget.TextView)63 ViewGroup (android.view.ViewGroup)59 Bundle (android.os.Bundle)48 Point (android.graphics.Point)43 LayoutInflater (android.view.LayoutInflater)42 ImageView (android.widget.ImageView)40