Example usage for android.content.res TypedArray getDrawable

List of usage examples for android.content.res TypedArray getDrawable

Introduction

In this page you can find the example usage for android.content.res TypedArray getDrawable.

Prototype

@Nullable
public Drawable getDrawable(@StyleableRes int index) 

Source Link

Document

Retrieve the Drawable for the attribute at index.

Usage

From source file:com.example.nwilde.myfirstapp.SimpleListDividerDecorator.java

/**
 * Constructor./*from  ww  w.  j  a v  a 2  s.  co  m*/
 *
 * @param context divider drawable
 * @param overlap whether the divider is drawn overlapped on bottom of the item.
 */
public SimpleListDividerDecorator(Context context, boolean overlap) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDividerDrawable = a.getDrawable(0);
    mDividerHeight = mDividerDrawable.getIntrinsicHeight();
    mOverlap = overlap;
}

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

public static Drawable getSelectableItemBackgroundDrawable(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.selectableItemBackground });
    try {//from   w w w . ja  v  a 2  s. c o  m
        return a.getDrawable(0);
    } finally {
        a.recycle();
    }
}

From source file:com.txusballesteros.PasswordEditText.java

private Drawable getDrawable(TypedArray attributes, int attribute, int tint) {
    Drawable drawable = attributes.getDrawable(attribute);
    return getDrawable(drawable, tint);
}

From source file:com.ahamed.multiviewadapter.util.SimpleDividerDecoration.java

public SimpleDividerDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();/*from w  ww.  j a va 2 s .co  m*/
    setOrientation(orientation);
}

From source file:com.dimon.ganwumei.widget.MultiSwipeRefreshLayout.java

public MultiSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MultiSwipeRefreshLayout, 0, 0);

    mForegroundDrawable = a.getDrawable(R.styleable.MultiSwipeRefreshLayout_foreground);
    if (mForegroundDrawable != null) {
        mForegroundDrawable.setCallback(this);
        setWillNotDraw(false);/*from   w  w  w.java 2 s. co m*/
    }
    a.recycle();
}

From source file:cc.solart.turbo.decoration.LinearDividerItemDecoration.java

private void resolveDivider(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();//from   ww  w  .  j  a  va  2s  . c o  m
}

From source file:au.com.lumo.ameego.uiUtils.MultiSwipeRefreshLayout.java

public MultiSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MultiSwipeRefreshLayout, 0, 0);

    mForegroundDrawable = a.getDrawable(R.styleable.MultiSwipeRefreshLayout_foreground);
    if (mForegroundDrawable != null) {
        mForegroundDrawable.setCallback(this);
        setWillNotDraw(false);//from  ww w.  j  a  va 2  s  .com
    }

    a.recycle();
}

From source file:cnc.cad.rxjavatestapp.meizi.rx.widget.MultiSwipeRefreshLayout.java

public MultiSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.MultiSwipeRefreshLayout, 0, 0);

    mForegroundDrawable = array.getDrawable(R.styleable.MultiSwipeRefreshLayout_foreground);
    if (mForegroundDrawable != null) {
        mForegroundDrawable.setCallback(this);
        setWillNotDraw(false);//from   w w w .j  a  va2s  .c  om
    }
    array.recycle();
}

From source file:com.bitdubai.fermat_android_api.ui.util.FermatDividerItemDecoration.java

/**
 * Create a item decorator that act has divider for a recyclerView with vertical orientation.
 * the orientation can be changed with {@link FermatDividerItemDecoration#setOrientation(int)}
 *
 * @param context the context activity where is the reciclerView
 *//*w  w  w . j a va 2s  .  co  m*/
public FermatDividerItemDecoration(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
    setOrientation(VERTICAL_LIST);
}

From source file:com.bitdubai.fermat_android_api.ui.Views.DividerItemDecoration.java

/**
 * Create a item decorator that act has divider for a recyclerView with vertical orientation.
 * the orientation can be changed with {@link DividerItemDecoration#setOrientation(int)}
 *
 * @param context the context activity where is the reciclerView
 *//*from   www.  j  a  v  a  2  s  .  c  o m*/
public DividerItemDecoration(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
    setOrientation(VERTICAL_LIST);
}