List of usage examples for android.content.res TypedArray getColor
@ColorInt public int getColor(@StyleableRes int index, @ColorInt int defValue)
From source file:info.papdt.blacklight.support.Utility.java
public static int getColorPrimary(Context context) { try {//from w w w . j a v a 2s .co m 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 {/*from w ww . ja v a2s .c o m*/ 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 getLayerColor(Context context) { try {/*from w w w . j a v a 2s .co m*/ TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight); int ret = array.getColor(R.styleable.BlackLight_LayerColor, 0); array.recycle(); return ret; } catch (NotFoundException e) { return 0; } }
From source file:info.papdt.blacklight.support.Utility.java
public static int getFABBackground(Context context) { try {/* ww w . j av a 2 s . co m*/ TypedArray array = context.obtainStyledAttributes(R.styleable.BlackLight); int ret = array.getColor(R.styleable.BlackLight_FABBackground, 0); array.recycle(); return ret; } catch (NotFoundException e) { return 0; } }
From source file:info.papdt.blacklight.support.Utility.java
public static int getSelectorGrey(Context context) { try {//from w w w. j a v a 2 s . c o 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 www. j a va 2 s .c o 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 a 2 s . c o m*/ 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 int getDrawerForeground(Context context) { try {// w w w. ja v a 2s. co m 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:info.papdt.blacklight.support.Utility.java
public static void initDarkTabHost(Activity activity, TabHost tabhost) { if (isDarkMode(activity)) { int textColor = 0; try {/* w w w . ja v a 2 s. co m*/ TypedArray array = activity.getTheme().obtainStyledAttributes(R.styleable.BlackLight); textColor = array.getColor(R.styleable.BlackLight_CardForeground, 0); array.recycle(); } catch (NotFoundException e) { return; } for (int i = 0; i < tabhost.getTabWidget().getChildCount(); i++) { TextView tv = (TextView) tabhost.getTabWidget().getChildAt(i).findViewById(android.R.id.title); tv.setTextColor(textColor); } } }
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
public static void initializeResources(Context context) { TypedArray a = context.obtainStyledAttributes(new int[] { R.attr.colorAccent, R.attr.colorControlHighlight, R.attr.colorControlActivated, R.attr.colorButtonNormal, android.R.attr.textColorPrimary, android.R.attr.textColorPrimaryInverse, R.attr.colorPrimary, R.attr.colorPrimaryDark, android.R.attr.textColorSecondary, android.R.attr.colorBackground, android.R.attr.textColorSecondaryInverse }); if (a.hasValue(0)) COLOR_ACCENT = a.getColor(0, Color.TRANSPARENT); if (a.hasValue(1)) COLOR_CONTROL_HIGHLIGHT = a.getColor(1, Color.TRANSPARENT); if (a.hasValue(2)) COLOR_CONTROL_ACTIVATED = a.getColor(2, Color.TRANSPARENT); if (a.hasValue(3)) COLOR_BUTTON_NORMAL = a.getColor(3, Color.TRANSPARENT); if (a.hasValue(4)) COLOR_TEXT_PRIMARY = a.getColor(4, Color.TRANSPARENT); if (a.hasValue(5)) COLOR_TEXT_PRIMARY_INVERSE = a.getColor(5, Color.TRANSPARENT); if (a.hasValue(6)) COLOR_PRIMARY = a.getColor(6, Color.TRANSPARENT); if (a.hasValue(7)) COLOR_PRIMARY_DARK = a.getColor(7, Color.TRANSPARENT); if (a.hasValue(8)) COLOR_TEXT_SECONDARY = a.getColor(8, Color.TRANSPARENT); if (a.hasValue(9)) COLOR_BACKGROUND = a.getColor(9, Color.TRANSPARENT); if (a.hasValue(10)) COLOR_TEXT_SECONDARY_INVERSE = a.getColor(10, Color.TRANSPARENT); a.recycle();/* w ww .j a v a 2 s . c om*/ CORNER_RADIUS = context.getResources().getDimensionPixelSize(R.dimen.control_corner_material); if (Config.DEBUG) { Log.i(TAG, "COLOR_ACCENT: " + Integer.toHexString(COLOR_ACCENT)); Log.i(TAG, "COLOR_CONTROL_HIGHLIGHT: " + Integer.toHexString(COLOR_CONTROL_HIGHLIGHT)); Log.i(TAG, "COLOR_CONTROL_ACTIVATED: " + Integer.toHexString(COLOR_CONTROL_ACTIVATED)); Log.i(TAG, "COLOR_BUTTON_NORMAL: " + Integer.toHexString(COLOR_BUTTON_NORMAL)); Log.i(TAG, "COLOR_TEXT_PRIMARY: " + Integer.toHexString(COLOR_TEXT_PRIMARY)); Log.i(TAG, "COLOR_TEXT_PRIMARY_INVERSE: " + Integer.toHexString(COLOR_TEXT_PRIMARY_INVERSE)); Log.i(TAG, "COLOR_PRIMARY: " + Integer.toHexString(COLOR_PRIMARY)); Log.i(TAG, "COLOR_PRIMARY_DARK: " + Integer.toHexString(COLOR_PRIMARY_DARK)); Log.i(TAG, "COLOR_TEXT_SECONDARY: " + Integer.toHexString(COLOR_TEXT_SECONDARY)); Log.i(TAG, "COLOR_BACKGROUND: " + Integer.toHexString(COLOR_BACKGROUND)); Log.i(TAG, "COLOR_TEXT_SECONDARY_INVERSE: " + Integer.toHexString(COLOR_TEXT_SECONDARY_INVERSE)); } }