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:info.papdt.blacklight.support.Utility.java

public static Drawable getFABNewIcon(Context context) {
    try {//from ww  w.jav  a 2  s . c o  m
        TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight);
        Drawable ret = array.getDrawable(R.styleable.BlackLight_FABNewIcon);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return null;
    }
}

From source file:by.vshkl.localweather.ui.DividerItemDecoration.java

public DividerItemDecoration(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
}

From source file:com.rashwan.reactive_popular_movies.common.utilities.DividerItemDecoration.java

public DividerItemDecoration(Context context, int dividerColor) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    this.dividerColor = ContextCompat.getColor(context, dividerColor);
    a.recycle();/*from w ww  .  j a v  a2s.  c om*/
}

From source file:com.nextgis.maplibui.mapui.TrackLayerUI.java

@Override
public Drawable getIcon(Context context) {
    int[] attrs = new int[] { R.attr.ic_track };
    TypedArray ta = context.obtainStyledAttributes(attrs);
    Drawable track = ta.getDrawable(0);
    ta.recycle();//from w  w  w.ja v a  2s. c o m
    return track;
}

From source file:com.fox.myappstore.widgets.DividerDecoration.java

/**
 * Default divider will be used/*from  www  . j  a  v a2s .c om*/
 */
public DividerDecoration(Context context) {
    final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
    divider = styledAttributes.getDrawable(0);
    styledAttributes.recycle();
}

From source file:com.ahamed.sample.common.decorator.ThickItemDecorator.java

public ThickItemDecorator(Context context) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();
}

From source file:com.example.sergey.currentweather.utils.SimpleHorizontalDivider.java

/**
 * Default divider will be used//from w w  w.j ava 2s  .  com
 */
public SimpleHorizontalDivider(Context context) {
    final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
    mDivider = styledAttributes.getDrawable(0);
    styledAttributes.recycle();
}

From source file:br.com.oficinatablet.chats.decoration.DividerItemDecoration.java

/**
 * Divider padro ser usado/*from   ww  w  .  ja  v  a2s .  c  om*/
 */
public DividerItemDecoration(Context context) {
    final TypedArray styledAttributes = context.obtainStyledAttributes(ATTRS);
    mDivider = styledAttributes.getDrawable(0);
    styledAttributes.recycle();
}

From source file:com.readystatesoftware.chuck.internal.support.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation, boolean includeLastItem) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();//from   ww w.j a v  a  2  s  . c o m
    setOrientation(orientation);
    mIncludeLastItem = includeLastItem;
}

From source file:ciriti.retrofitmockserver.widget.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();//  w  w w . ja v a 2 s  .  c  om
    setOrientation(orientation);
}