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


Java ColorStateList.isStateful方法代码示例

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


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

示例1: updateDayNumberTextColors

import android.content.res.ColorStateList; //导入方法依赖的package包/类
/**
 * Updates colors for different states hold by {@link #DAY_NUMBERS_COLORS_STATE} from the current
 * {@link ColorStateList} specified via {@link #setDayNumberTextColor(ColorStateList)}.
 *
 * @return {@code True} if at least one color has been changed so invalidation of day numbers
 * area is needed, {@code false} otherwise.
 */
private boolean updateDayNumberTextColors() {
	final ColorStateList colors = DAY_NUMBER_TEXT_INFO.mAppearance.getTextColor();
	int defColor = DayNumberColorsState.DEF_COLOR;
	if (colors.isStateful()) {
		defColor = colors.getDefaultColor();
		DAY_NUMBERS_COLORS_STATE.dayNumberColorNormal = colors.getColorForState(WidgetStateSet.ENABLED, defColor);
		DAY_NUMBERS_COLORS_STATE.dayNumberColorPressed = colors.getColorForState(WidgetStateSet.ENABLED_PRESSED, defColor);
		DAY_NUMBERS_COLORS_STATE.dayNumberColorSelected = colors.getColorForState(WidgetStateSet.ENABLED_SELECTED, defColor);
		DAY_NUMBERS_COLORS_STATE.dayNumberColorDisabled = colors.getColorForState(WidgetStateSet.DISABLED, defColor);
	} else {
		DAY_NUMBERS_COLORS_STATE.dayNumberColorNormal = defColor;
		DAY_NUMBERS_COLORS_STATE.dayNumberColorPressed = defColor;
		DAY_NUMBERS_COLORS_STATE.dayNumberColorSelected = defColor;
		DAY_NUMBERS_COLORS_STATE.dayNumberColorDisabled = defColor;
	}
	return true;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:25,代码来源:MonthView.java

示例2: isStateful

import android.content.res.ColorStateList; //导入方法依赖的package包/类
/**
 */
@Override
public boolean isStateful() {
	if (mDrawableLayerTints == null) {
		return super.isStateful();
	}

	for (int i = 0; i < mDrawableLayerTints.size(); i++) {
		final ColorStateList tintList = mDrawableLayerTints.valueAt(i).tintList;
		if (tintList != null && tintList.isStateful()) {
			return true;
		}
	}
	return super.isStateful();
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:17,代码来源:TintLayerDrawable.java

示例3: getThemeColorStateList

import android.content.res.ColorStateList; //导入方法依赖的package包/类
public static ColorStateList getThemeColorStateList(Context context, ColorStateList origin) {
    if (origin == null) return null;

    if (origin.isStateful()) {
        TintInfo tintInfo = parseColorStateList(origin);
        if (tintInfo == null || tintInfo.isInvalid()) {
            return origin;
        }

        int[] newColors;
        int[][] newStates;
        int index = 0;
        boolean hasDisableColor = StateSet.stateSetMatches(tintInfo.mTintStates[0], DISABLED_STATE_SET);
        if (!hasDisableColor) {
            newStates = new int[tintInfo.mTintStates.length + 1][];
            newColors = new int[tintInfo.mTintStates.length + 1];
            newStates[index] = DISABLED_STATE_SET;
            newColors[index] = getDisabledThemeAttrColor(context, R.attr.themeColorSecondary);
            index++;
        } else {
            newStates = new int[tintInfo.mTintStates.length][];
            newColors = new int[tintInfo.mTintStates.length];
        }

        for (int i = 0; i < tintInfo.mTintStates.length; i++) {
            newStates[index] = tintInfo.mTintStates[i];
            newColors[index] = replaceColor(context, tintInfo.mTintColors[i]);
            index++;
        }
        return new ColorStateList(newStates, newColors);
    }
    return ColorStateList.valueOf(replaceColor(context, origin.getDefaultColor()));
}
 
开发者ID:Pingsh,项目名称:Mix,代码行数:34,代码来源:ThemeUtils.java

示例4: createSwitchThumbColorStateList

import android.content.res.ColorStateList; //导入方法依赖的package包/类
private ColorStateList createSwitchThumbColorStateList(Context context) {
    int[][] states = new int[3][];
    int[] colors = new int[3];
    ColorStateList thumbColor = ThemeUtils.getThemeAttrColorStateList(context, R.attr.colorSwitchThumbNormal);
    int i;
    if (thumbColor == null || !thumbColor.isStateful()) {
        states[0] = ThemeUtils.DISABLED_STATE_SET;
        colors[0] = ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorSwitchThumbNormal);
        i = 0 + 1;
        states[i] = ThemeUtils.CHECKED_STATE_SET;
        colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated);
        i++;
        states[i] = ThemeUtils.EMPTY_STATE_SET;
        colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorSwitchThumbNormal);
        i++;
    } else {
        states[0] = ThemeUtils.DISABLED_STATE_SET;
        colors[0] = thumbColor.getColorForState(states[0], 0);
        i = 0 + 1;
        states[i] = ThemeUtils.CHECKED_STATE_SET;
        colors[i] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated);
        i++;
        states[i] = ThemeUtils.EMPTY_STATE_SET;
        colors[i] = thumbColor.getDefaultColor();
        i++;
    }
    return new ColorStateList(states, colors);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:29,代码来源:AppCompatDrawableManager.java

示例5: getDisabledThemeAttrColor

import android.content.res.ColorStateList; //导入方法依赖的package包/类
public static int getDisabledThemeAttrColor(Context context, int attr) {
    ColorStateList csl = getThemeAttrColorStateList(context, attr);
    if (csl != null && csl.isStateful()) {
        return csl.getColorForState(DISABLED_STATE_SET, csl.getDefaultColor());
    }
    TypedValue tv = getTypedValue();
    context.getTheme().resolveAttribute(16842803, tv, true);
    return getThemeAttrColor(context, attr, tv.getFloat());
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:ThemeUtils.java

示例6: isStateful

import android.content.res.ColorStateList; //导入方法依赖的package包/类
public boolean isStateful() {
    ColorStateList tintList = isCompatTintEnabled() ? this.mState.mTint : null;
    return (tintList != null && tintList.isStateful()) || this.mDrawable.isStateful();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:DrawableWrapperDonut.java

示例7: resolveColorForState

import android.content.res.ColorStateList; //导入方法依赖的package包/类
/**
 * Obtains a color from the specified <var>colorStateList</var> for the specified <var>stateSet</var>.
 *
 * @param colorStateList The colors state list from which to obtain the color.
 * @param stateSet       The state set used to resolved the color.
 * @return Resolved color for the state or the default one if the colors state list does not hold
 * color for the specified state.
 */
@ColorInt
public static int resolveColorForState(@NonNull ColorStateList colorStateList, @NonNull int[] stateSet) {
	return colorStateList.isStateful() ?
			colorStateList.getColorForState(stateSet, colorStateList.getDefaultColor()) :
			colorStateList.getDefaultColor();
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:15,代码来源:WidgetUtils.java


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