当前位置: 首页>>代码示例>>Java>>正文


Java StateSet.WILD_CARD属性代码示例

本文整理汇总了Java中android.util.StateSet.WILD_CARD属性的典型用法代码示例。如果您正苦于以下问题:Java StateSet.WILD_CARD属性的具体用法?Java StateSet.WILD_CARD怎么用?Java StateSet.WILD_CARD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.util.StateSet的用法示例。


在下文中一共展示了StateSet.WILD_CARD属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setTextAccentColorInverse

void setTextAccentColorInverse(TextView view, int accentColor) {
    final int pressedColor = getPressedColor(accentColor);
    final int disabledColor = getDisabledColor(accentColor);

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

    final int[] colors = new int[]{pressedColor, pressedColor, disabledColor, accentColor};

    final ColorStateList stateList = new ColorStateList(states, colors);

    view.setTextColor(stateList);
}
 
开发者ID:crashlytics,项目名称:digits-android,代码行数:17,代码来源:ButtonThemer.java

示例2: generateDefaultTrackColorStateListFromTheme

public static ColorStateList generateDefaultTrackColorStateListFromTheme(Context context) {
	int[][] states = new int[][] {
		SELECTED_STATE_SET,
		ENABLED_STATE_SET,
		StateSet.WILD_CARD
	};

	// This is an approximation of the track colors derived from Lollipop resources
	boolean isLightTheme = Utils.isLightTheme(context);
	int enabled = isLightTheme ? 0x28181818 : 0x85ffffff;

	int[] colors = new int[] {
		Utils.getThemeColor(context, android.R.attr.colorControlActivated),
		enabled,
		0x14181818 //TODO: get this from a theme attr?
	};

	return new ColorStateList(states, colors);
}
 
开发者ID:dgmltn,项目名称:multi-seek-bar,代码行数:19,代码来源:AbsMultiSeekBar.java

示例3: createIndetermColorStateList

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);
    }
 
开发者ID:sevar83,项目名称:indeterminate-checkbox,代码行数:21,代码来源:Utils.java

示例4: createSimpleSelectorCircleDrawable

public static Drawable createSimpleSelectorCircleDrawable(int size, int defaultColor, int pressedColor) {
    OvalShape ovalShape = new OvalShape();
    ovalShape.resize(size, size);
    ShapeDrawable defaultDrawable = new ShapeDrawable(ovalShape);
    defaultDrawable.getPaint().setColor(defaultColor);
    ShapeDrawable pressedDrawable = new ShapeDrawable(ovalShape);
    if (Build.VERSION.SDK_INT >= 21) {
        pressedDrawable.getPaint().setColor(0xffffffff);
        ColorStateList colorStateList = new ColorStateList(
                new int[][]{StateSet.WILD_CARD},
                new int[]{pressedColor}
        );
        return new RippleDrawable(colorStateList, defaultDrawable, pressedDrawable);
    } else {
        pressedDrawable.getPaint().setColor(pressedColor);
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, pressedDrawable);
        stateListDrawable.addState(new int[]{android.R.attr.state_focused}, pressedDrawable);
        stateListDrawable.addState(StateSet.WILD_CARD, defaultDrawable);
        return stateListDrawable;
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:22,代码来源:Theme.java

示例5: getRoundRectSelectorDrawable

public static Drawable getRoundRectSelectorDrawable() {
    if (Build.VERSION.SDK_INT >= 21) {
        Drawable maskDrawable = createRoundRectDrawable(AndroidUtilities.dp(3), 0xffffffff);
        ColorStateList colorStateList = new ColorStateList(
                new int[][]{StateSet.WILD_CARD},
                new int[]{getColor(key_dialogButtonSelector)}
        );
        return new RippleDrawable(colorStateList, null, maskDrawable);
    } else {
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, createRoundRectDrawable(AndroidUtilities.dp(3), getColor(key_dialogButtonSelector)));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, createRoundRectDrawable(AndroidUtilities.dp(3), getColor(key_dialogButtonSelector)));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(0x00000000));
        return stateListDrawable;
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:16,代码来源:Theme.java

示例6: getSelectorDrawable

public static Drawable getSelectorDrawable(boolean whiteBackground) {
    if (whiteBackground) {
        if (Build.VERSION.SDK_INT >= 21) {
            Drawable maskDrawable = new ColorDrawable(0xffffffff);
            ColorStateList colorStateList = new ColorStateList(
                    new int[][]{StateSet.WILD_CARD},
                    new int[]{getColor(key_listSelector)}
            );
            return new RippleDrawable(colorStateList, new ColorDrawable(getColor(key_windowBackgroundWhite)), maskDrawable);
        } else {
            int color = getColor(key_listSelector);
            StateListDrawable stateListDrawable = new StateListDrawable();
            stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
            stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
            stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(getColor(key_windowBackgroundWhite)));
            return stateListDrawable;
        }
    } else {
        return createSelectorDrawable(getColor(key_listSelector), 2);
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:21,代码来源:Theme.java

示例7: createColorStateList

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);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:9,代码来源:ResourceManager.java

示例8: createColorStateList

private static ColorStateList createColorStateList(Context context) {
  return new ColorStateList(
      new int[][]{
          new int[]{-android.R.attr.state_enabled}, // Disabled state.
          StateSet.WILD_CARD,                       // Enabled state.
      },
      new int[]{
          getThemeAttrColor(context, R.attr.colorAccent),  // Disabled state.
          getThemeAttrColor(context, R.attr.colorPrimary), // Enabled state.
      });
}
 
开发者ID:alexjlockwood,项目名称:adp-contextcompat-getcolor,代码行数:11,代码来源:MainActivity.java

示例9: setTextAccentColor

void setTextAccentColor(TextView view, int accentColor) {
    final int enabledColor = getTextColor(accentColor);
    final int disabledColor = getDisabledColor(enabledColor);

    final int[][] states = new int[][]{
            new int[]{-android.R.attr.state_enabled}, //For completeness. Currently unused
            StateSet.WILD_CARD
    };

    final int[] colors = new int[]{disabledColor, enabledColor};
    final ColorStateList stateList = new ColorStateList(states, colors);
    view.setTextColor(stateList);
}
 
开发者ID:crashlytics,项目名称:digits-android,代码行数:13,代码来源:ButtonThemer.java

示例10: generateDefaultColorStateListFromTheme

public static ColorStateList generateDefaultColorStateListFromTheme(Context context) {
	int[][] states = new int[][] {
		View.PRESSED_STATE_SET,
		View.ENABLED_STATE_SET,
		StateSet.WILD_CARD
	};

	int[] colors = new int[] {
		Utils.getThemeColor(context, android.R.attr.colorControlActivated),
		Utils.getThemeColor(context, android.R.attr.colorControlActivated),
		0x42000000 //TODO: get this from a theme attr?
	};

	return new ColorStateList(states, colors);
}
 
开发者ID:dgmltn,项目名称:multi-seek-bar,代码行数:15,代码来源:ThumbView.java

示例11: createStateList

private List<Integer> createStateList(int[] stateSet) {
  List<Integer> stateList = new ArrayList<Integer>();
  if (stateSet == StateSet.WILD_CARD) {
    stateList.add(-1);
  } else {
    for (int state : stateSet) {
      stateList.add(state);
    }
  }

  return stateList;
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:12,代码来源:ShadowStateListDrawable.java

示例12: StateDrawable

public StateDrawable(Drawable normal, Drawable altered) {
	this.normal = normal;
	this.altered = altered;
	this.checked = null;
	this.checkedAltered = null;
	this.hasChecks = false;
	this.stateSet = StateSet.WILD_CARD;
	computeCurrent();
}
 
开发者ID:BandTec,项目名称:SerialBTControl,代码行数:9,代码来源:StateDrawable.java

示例13: createSelectorDrawable

public static Drawable createSelectorDrawable(int color, int maskType) {
    Drawable drawable;
    if (Build.VERSION.SDK_INT >= 21) {
        Drawable maskDrawable = null;
        if (maskType == 1) {
            maskPaint.setColor(0xffffffff);
            maskDrawable = new Drawable() {
                @Override
                public void draw(Canvas canvas) {
                    android.graphics.Rect bounds = getBounds();
                    canvas.drawCircle(bounds.centerX(), bounds.centerY(), AndroidUtilities.dp(18), maskPaint);
                }

                @Override
                public void setAlpha(int alpha) {

                }

                @Override
                public void setColorFilter(ColorFilter colorFilter) {

                }

                @Override
                public int getOpacity() {
                    return PixelFormat.UNKNOWN;
                }
            };
        } else if (maskType == 2) {
            maskDrawable = new ColorDrawable(0xffffffff);
        }
        ColorStateList colorStateList = new ColorStateList(
                new int[][]{StateSet.WILD_CARD},
                new int[]{color}
        );
        return new RippleDrawable(colorStateList, null, maskDrawable);
    } else {
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(0x00000000));
        return stateListDrawable;
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:44,代码来源:Theme.java


注:本文中的android.util.StateSet.WILD_CARD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。