Java Code Examples for android.util.StateSet#WILD_CARD

The following examples show how to use android.util.StateSet#WILD_CARD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java    From indeterminate-checkbox with Apache License 2.0 6 votes vote down vote up
private static ColorStateList createIndeterminateColorStateList(Context context) {

        final int[][] states = new int[][]{
                new int[]{-android.R.attr.state_enabled},
                new int[]{R.attr.state_indeterminate},
                new int[]{android.R.attr.state_checked},
                StateSet.WILD_CARD
        };

        final int normal = resolveColor(context, R.attr.colorControlNormal, Color.DKGRAY);
        final int activated = resolveColor(context, R.attr.colorControlActivated, Color.CYAN);
        final int intermediate = resolveColor(context, R.attr.colorControlIndeterminate, activated);
        final float disabledAlpha = resolveFloat(context, android.R.attr.disabledAlpha, 0.25f);
        final int[] colors = new int[]{
                Utils.applyAlpha(normal, disabledAlpha),
                intermediate,
                activated,
                normal
        };

        return new ColorStateList(states, colors);
    }
 
Example 2
Source File: Utils.java    From simpletask-android with GNU General Public License v3.0 6 votes vote down vote up
private static ColorStateList createIndetermColorStateList(Context context) {

        final int[][] states = new int[][]{
                new int[]{-android.R.attr.state_enabled},
                new int[]{R.attr.state_indeterminate},
                new int[]{android.R.attr.state_checked},
                StateSet.WILD_CARD
        };

        final int normal = resolveColor(context, R.attr.colorControlNormal, Color.DKGRAY);
        final int activated = resolveColor(context, R.attr.colorControlActivated, Color.CYAN);
        final float disabledAlpha = resolveFloat(context, android.R.attr.disabledAlpha, 0.25f);
        final int[] colors = new int[]{
                Utils.applyAlpha(normal, disabledAlpha),
                normal,
                activated,
                normal
        };

        return new ColorStateList(states, colors);
    }
 
Example 3
Source File: ResourceManager.java    From letv with Apache License 2.0 5 votes vote down vote up
public static ColorStateList createColorStateList(int normal, int pressed) {
    int[] colors = new int[]{pressed, pressed, pressed, normal};
    int[][] states = new int[4][];
    states[0] = new int[]{16842919};
    states[1] = new int[]{16842913};
    states[2] = new int[]{16842908};
    states[3] = StateSet.WILD_CARD;
    return new ColorStateList(states, colors);
}