List of usage examples for android.content.res TypedArray getColor
@ColorInt public int getColor(@StyleableRes int index, @ColorInt int defValue)
From source file:com.codetroopers.betterpickers.radialtimepicker.CircleView.java
void setTheme(TypedArray themeColors) { mCircleColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpRadialBackgroundColor, ContextCompat.getColor(getContext(), R.color.radial_gray_light)); mCentralDotColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpRadialTextColor, ContextCompat.getColor(getContext(), R.color.bpBlue)); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getCardBackgroundColor(final Context context) { final TypedArray a = context.obtainStyledAttributes(new int[] { R.attr.cardItemBackgroundColor }); final int color = a.getColor(0, Color.TRANSPARENT); a.recycle();//from w ww . jav a 2 s . com final int themeAlpha = getThemeAlpha(context); return themeAlpha << 24 | (0x00FFFFFF & color); }
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 w w w . j a v a 2 s . c o m*/ return color; }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getThemeBackgroundColor(final Context context) { final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.colorBackground }); try {//from w w w.j ava 2 s.c o m return a.getColor(0, 0); } finally { a.recycle(); } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getTextColorPrimary(final Context context) { final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary }); try {//w ww .j a v a 2 s. c om return a.getColor(0, Color.TRANSPARENT); } finally { a.recycle(); } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getThemeForegroundColor(final Context context, int theme) { final Context wrapped = theme != 0 ? new ContextThemeWrapper(context, theme) : context; final TypedArray a = wrapped.obtainStyledAttributes(new int[] { android.R.attr.colorForeground }); try {/*from w w w . j a v a2 s . co m*/ return a.getColor(0, 0); } finally { a.recycle(); } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getTextColorSecondary(final Context context) { final TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.textColorSecondary }); try {/*from w w w .j a v a 2 s.c om*/ return a.getColor(0, Color.TRANSPARENT); } finally { a.recycle(); } }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getThemeColor(final Context context) { final Resources res = getResources(context); final Context wrapped = getThemedContext(context, res); final TypedArray a = wrapped.obtainStyledAttributes(new int[] { android.R.attr.colorActivatedHighlight }); try {/*from ww w. j a v a 2 s . co m*/ return a.getColor(0, res.getColor(R.color.material_light_blue)); } finally { a.recycle(); } }
From source file:com.codetroopers.betterpickers.calendardatepicker.YearPickerView.java
public void setTheme(TypedArray themeColors) { mCircleColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpRadialPointerColor, ContextCompat.getColor(getContext(), R.color.bpBlue)); mTextColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpBodyUnselectedTextColor, ContextCompat.getColor(getContext(), R.color.ampm_text_color)); }
From source file:de.vanita5.twittnuker.util.ThemeUtils.java
public static int getThemeBackgroundColor(final Context context, int themeRes) { if (themeRes == 0) { return getThemeBackgroundColor(context); }/*from w ww . jav a 2 s .c om*/ final TypedArray a = context.obtainStyledAttributes(null, new int[] { android.R.attr.colorBackground }, 0, themeRes); try { return a.getColor(0, 0); } finally { a.recycle(); } }