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.handu.poweroperational.ui.RecyclerView.divide.DividerListDecoration.java

public DividerListDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();/*from  ww w  .j  a  va2s. c  o m*/
    setOrientation(orientation);
}

From source file:com.arcao.geocaching4locus.widget.decorator.DividerItemDecoration.java

public DividerItemDecoration(Context context, @Orientation int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    a.recycle();/*from  w  w  w  .j  ava2 s  . c  om*/
    setOrientation(orientation);
}

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

public static Drawable getWindowBackground(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.windowBackground });
    final Drawable d = a.getDrawable(0);
    a.recycle();/*from ww w.ja  v  a  2  s.co m*/
    if (isTransparentBackground(context)) {
        applyThemeBackgroundAlphaToDrawable(context, d);
    }
    return d;
}

From source file:ca.co.rufus.androidboilerplate.ui.misc.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation, float paddingStart, boolean rtl) {
    this.rtl = rtl;

    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    divider = a.getDrawable(0);
    a.recycle();//w  w w.  j a v a  2s . c om
    setOrientation(orientation);
    setPaddingStart(paddingStart);
}

From source file:com.github.leonardoxh.recyclerviewutils.DividerItemDecorator.java

public DividerItemDecorator(@NonNull Context context, @DividerOrientation int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    divider = a.getDrawable(0);
    a.recycle();//w w  w . ja v  a 2  s.c o  m
    setOrientation(orientation);
}

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

public static Drawable getWindowContentOverlay(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.windowContentOverlay });
    final Drawable d = a.getDrawable(0);
    a.recycle();/*w  ww.j  ava2  s .c  o  m*/
    return d;
}

From source file:com.cabbage.realmtest.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation, float paddingStart, boolean rtl,
        boolean showLastDivider) {
    this.rtl = rtl;
    this.showLastDivider = showLastDivider;
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    divider = a.getDrawable(0);
    a.recycle();/*from   w w w .  ja  v  a 2s  .co  m*/
    setOrientation(orientation);
    setPaddingStart(paddingStart);
}

From source file:com.tiny.framework.ui.recyclerview.decorator.DividerItemDecoration.java

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

From source file:com.example.android.common.view.DividerItemDecoration.java

public DividerItemDecoration(Context context, int orientation) {
    final TypedArray a = context.obtainStyledAttributes(ATTRS);
    mDivider = a.getDrawable(0);
    //        mDivider = new ColorDrawable(Color.RED);
    a.recycle();//from   w  ww.j  av a2  s  .  c  om
    setOrientation(orientation);
}

From source file:com.justwayward.reader.view.SupportDividerItemDecoration.java

public SupportDividerItemDecoration(Context context, int orientation, boolean dash) {
    if (dash) {// ww  w .j av  a  2  s  .co  m
        mDivider = ContextCompat.getDrawable(context, R.drawable.shape_common_dash_divide);
    } else {
        final TypedArray a = context.obtainStyledAttributes(ATTRS);
        mDivider = a.getDrawable(0);
        a.recycle();
    }
    setOrientation(orientation);
}