List of usage examples for android.content.res ColorStateList ColorStateList
public ColorStateList(int[][] states, @ColorInt int[] colors)
From source file:android.support.v7.widget.AppCompatDrawableManager.java
private ColorStateList createButtonColorStateList(Context context, @ColorInt int baseColor) { final int[][] states = new int[4][]; final int[] colors = new int[4]; int i = 0;//ww w . j av a 2 s . c om final int colorControlHighlight = getThemeAttrColor(context, R.attr.colorControlHighlight); // Disabled state states[i] = ThemeUtils.DISABLED_STATE_SET; colors[i] = getDisabledThemeAttrColor(context, R.attr.colorButtonNormal); i++; states[i] = ThemeUtils.PRESSED_STATE_SET; colors[i] = ColorUtils.compositeColors(colorControlHighlight, baseColor); i++; states[i] = ThemeUtils.FOCUSED_STATE_SET; colors[i] = ColorUtils.compositeColors(colorControlHighlight, baseColor); i++; // Default enabled state states[i] = ThemeUtils.EMPTY_STATE_SET; colors[i] = baseColor; i++; return new ColorStateList(states, colors); }
From source file:android.support.v7ox.widget.AppCompatDrawableManager.java
private ColorStateList createSwitchTrackColorStateList(Context context) { final int[][] states = new int[3][]; final int[] colors = new int[3]; int i = 0;/*from w w w . j a v a 2s . co m*/ // Disabled state states[i] = ThemeUtils.DISABLED_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, android.R.attr.colorForeground, 0.1f); i++; states[i] = ThemeUtils.CHECKED_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated_ox, 0.3f); i++; // Default enabled state states[i] = ThemeUtils.EMPTY_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, android.R.attr.colorForeground, 0.3f); i++; return new ColorStateList(states, colors); }
From source file:be.blinkt.openvpn.views.PagerSlidingTabStrip.java
public void setTextColor(int textColor) { setTextColor(new ColorStateList(new int[][] { new int[] {} }, new int[] { textColor })); }
From source file:base.PagerSlidingTabStrip.java
private ColorStateList getColorStateList(int textColor) { return new ColorStateList(new int[][] { new int[] {} }, new int[] { textColor }); }
From source file:android.support.v7ox.widget.AppCompatDrawableManager.java
private ColorStateList createSwitchThumbColorStateList(Context context) { final int[][] states = new int[3][]; final int[] colors = new int[3]; int i = 0;/*from www .j a va 2s . c o m*/ final ColorStateList thumbColor = ThemeUtils.getThemeAttrColorStateList(context, R.attr.colorSwitchThumbNormal_ox); if (thumbColor != null && thumbColor.isStateful()) { // If colorSwitchThumbNormal is a valid ColorStateList, extract the default and // disabled colors from it // Disabled state states[i] = ThemeUtils.DISABLED_STATE_SET; colors[i] = thumbColor.getColorForState(states[i], 0); i++; states[i] = ThemeUtils.CHECKED_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated_ox); i++; // Default enabled state states[i] = ThemeUtils.EMPTY_STATE_SET; colors[i] = thumbColor.getDefaultColor(); i++; } else { // Else we'll use an approximation using the default disabled alpha // Disabled state states[i] = ThemeUtils.DISABLED_STATE_SET; colors[i] = ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorSwitchThumbNormal_ox); i++; states[i] = ThemeUtils.CHECKED_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated_ox); i++; // Default enabled state states[i] = ThemeUtils.EMPTY_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorSwitchThumbNormal_ox); i++; } return new ColorStateList(states, colors); }
From source file:android.support.v7ox.widget.AppCompatDrawableManager.java
private ColorStateList createEditTextColorStateList(Context context) { final int[][] states = new int[3][]; final int[] colors = new int[3]; int i = 0;//from ww w . j a va2 s .co m // Disabled state states[i] = ThemeUtils.DISABLED_STATE_SET; colors[i] = ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorControlNormal_ox); i++; states[i] = ThemeUtils.NOT_PRESSED_OR_FOCUSED_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlNormal_ox); i++; // Default enabled state states[i] = ThemeUtils.EMPTY_STATE_SET; colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated_ox); i++; return new ColorStateList(states, colors); }
From source file:com.zaparound.PagerSlidingTabStrip.java
private ColorStateList createColorStateList(int color_state_default) { return new ColorStateList(new int[][] { new int[] {} // default }, new int[] { color_state_default // default });// w w w. j a v a 2 s . c o m }
From source file:com.zaparound.PagerSlidingTabStrip.java
private ColorStateList createColorStateList(int color_state_pressed, int color_state_selected, int color_state_default) { return new ColorStateList(new int[][] { new int[] { android.R.attr.state_pressed }, // pressed new int[] { android.R.attr.state_selected }, // enabled new int[] {} // default }, new int[] { color_state_pressed, color_state_selected, color_state_default }); }
From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java
private ColorStateList createColorStateList(int color_state_default) { return new ColorStateList(new int[][] { new int[] {} //default }, new int[] { color_state_default //default });//w w w .j av a 2 s . co m }
From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java
private ColorStateList createColorStateList(int color_state_pressed, int color_state_selected, int color_state_default) { return new ColorStateList(new int[][] { new int[] { android.R.attr.state_pressed }, //pressed new int[] { android.R.attr.state_selected }, // enabled new int[] {} //default }, new int[] { color_state_pressed, color_state_selected, color_state_default }); }