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(@StyleableRes int[] attrs) 

Source Link

Document

Retrieve styled attribute information in this Context's theme.

Usage

From source file:info.papdt.blacklight.support.Utility.java

public static int getSelectorGrey(Context context) {
    try {//from  ww w .jav  a 2  s  .co m
        TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight);
        int ret = array.getColor(R.styleable.BlackLight_SelectorGrey, 0);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return 0;
    }
}

From source file:info.papdt.blacklight.support.Utility.java

public static int getDragBackground(Context context) {
    try {/*from   ww w.  j  ava  2s  . co m*/
        TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight);
        int ret = array.getColor(R.styleable.BlackLight_DragBackground, 0);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return 0;
    }
}

From source file:info.papdt.blacklight.support.Utility.java

public static int getCardSubColor(Context context) {
    try {/*from  w ww.j  av  a2  s.c om*/
        TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight);
        int ret = array.getColor(R.styleable.BlackLight_CardSubColor, 0);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return 0;
    }
}

From source file:info.papdt.blacklight.support.Utility.java

public static Drawable getFABNewIcon(Context context) {
    try {//from   w ww  .j  av  a  2 s .  com
        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:info.papdt.blacklight.support.Utility.java

public static int getColorPrimary(Context context) {
    try {/*from   ww  w .j  av a 2s.  c om*/
        TypedArray array = context.obtainStyledAttributes(R.styleable.Theme);
        int ret = array.getColor(R.styleable.Theme_colorPrimary, 0);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return 0;
    }
}

From source file:info.papdt.blacklight.support.Utility.java

public static int getColorPrimaryDark(Context context) {
    try {/*w ww  .  j a  va  2  s  .com*/
        TypedArray array = context.obtainStyledAttributes(R.styleable.Theme);
        int ret = array.getColor(R.styleable.Theme_colorPrimaryDark, 0);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return 0;
    }
}

From source file:info.papdt.blacklight.support.Utility.java

public static int getDrawerForeground(Context context) {
    try {/*from  w w w  .  j  ava2 s. c  om*/
        TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight);
        int ret = array.getColor(R.styleable.BlackLight_DrawerForeground, 0);
        array.recycle();
        return ret;
    } catch (NotFoundException e) {
        return 0;
    }

}

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:de.vanita5.twittnuker.util.ThemeUtils.java

public static int getColorBackgroundCacheHint(final Context context) {
    final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.colorBackgroundCacheHint });
    final int color = a.getColor(0, Color.TRANSPARENT);
    a.recycle();/*from  www .  j  a va  2 s  .  co  m*/
    return color;
}

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();/*from  www.  ja va2  s .  co  m*/
    return d;
}