Example usage for android.content Context obtainStyledAttributes

List of usage examples for android.content Context obtainStyledAttributes

Introduction

In this page you can find the example usage for android.content Context obtainStyledAttributes.

Prototype

public final TypedArray obtainStyledAttributes(AttributeSet set, @StyleableRes int[] attrs,
        @AttrRes int defStyleAttr, @StyleRes int defStyleRes) 

Source Link

Document

Retrieve styled attribute information in this Context's theme.

Usage

From source file:com.abdlh.axelspringerhack.UI.Views.ScrimInsetsFrameLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a != null) {
        mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForegroundBild);
        a.recycle();/*w w w . j a  va2s.  c  om*/
    }
    setWillNotDraw(true);
}

From source file:com.amaze.carbonfilemanager.ui.views.ScrimInsetsRelativeLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayout, defStyle, 0);
    if (a == null) {
        return;/*from   w  w w  .j a  v a 2s  .  c  o m*/
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground);
    a.recycle();

    setWillNotDraw(true);
}

From source file:br.liveo.ui.ScrimInsetsFrameLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a == null) {
        return;// www .j av  a  2s. c  o  m
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground);
    a.recycle();

    setWillNotDraw(true);
}

From source file:com.androcast.illusion.illusionmod.elements.ScrimInsetsFrameLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a == null) {
        return;/*from   ww w  . jav  a2  s  .  c  o  m*/
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetFg);
    a.recycle();

    setWillNotDraw(true);
}

From source file:com.ant.track.app.ui.ScrimInsetsRelativeLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a == null) {
        return;//  w  ww.ja va  2  s  .com
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForeground2);
    a.recycle();

    setWillNotDraw(true);
}

From source file:com.anton.sample.view.ScrimInsetsFrameLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a == null) {
        return;//from   w  w  w. ja  va2 s  .c  o m
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_si_insetForeground);
    a.recycle();

    setWillNotDraw(true);
}

From source file:com.aprz.easy_iosched.ui.widget.ScrimInsetsFrameLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a == null) {
        return;/*from  w  w  w  .j  a v  a 2 s. c  o  m*/
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_appInsetForeground);
    a.recycle();

    setWillNotDraw(true);
}

From source file:de.vanita5.twittnuker.util.ThemeUtils.java

public static int getThemeBackgroundColor(final Context context, int themeRes) {
    if (themeRes == 0) {
        return getThemeBackgroundColor(context);
    }/*w ww  .j av a  2 s. co m*/
    final TypedArray a = context.obtainStyledAttributes(null, new int[] { android.R.attr.colorBackground }, 0,
            themeRes);
    try {
        return a.getColor(0, 0);
    } finally {
        a.recycle();
    }
}

From source file:butter.droid.widget.ScrimInsetsFrameLayout.java

private void init(Context context, AttributeSet attrs, int defStyle) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsView, defStyle, 0);
    if (a == null) {
        return;/*from  ww  w .j a v  a 2  s  .  c o m*/
    }
    mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsView_insetForegroundColor);
    a.recycle();

    setWillNotDraw(true);
}

From source file:com.android.calculator2.CalculatorPadLayout.java

public CalculatorPadLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final TypedArray a = context.obtainStyledAttributes(attrs,
            new int[] { android.R.attr.rowCount, android.R.attr.columnCount }, defStyle, 0);
    mRowCount = a.getInt(0, 1);//from   w  w w . ja  v a 2s .c  o  m
    mColumnCount = a.getInt(1, 1);

    a.recycle();
}