本文整理汇总了Java中android.util.StateSet.stateSetMatches方法的典型用法代码示例。如果您正苦于以下问题:Java StateSet.stateSetMatches方法的具体用法?Java StateSet.stateSetMatches怎么用?Java StateSet.stateSetMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.StateSet
的用法示例。
在下文中一共展示了StateSet.stateSetMatches方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setState
import android.util.StateSet; //导入方法依赖的package包/类
/**
* Called by View
*/
void setState(int[] state) {
Tuple match = null;
final int count = mTuples.size();
for (int i = 0; i < count; i++) {
final Tuple tuple = mTuples.get(i);
if (StateSet.stateSetMatches(tuple.mSpecs, state)) {
match = tuple;
break;
}
}
if (match == mLastMatch) {
return;
}
if (mLastMatch != null) {
cancel();
}
mLastMatch = match;
if (match != null) {
start(match);
}
}
示例2: setState
import android.util.StateSet; //导入方法依赖的package包/类
void setState(int[] state) {
Tuple match = null;
int count = this.mTuples.size();
for (int i = 0; i < count; i++) {
Tuple tuple = (Tuple) this.mTuples.get(i);
if (StateSet.stateSetMatches(tuple.mSpecs, state)) {
match = tuple;
break;
}
}
if (match != this.mLastMatch) {
if (this.mLastMatch != null) {
cancel();
}
this.mLastMatch = match;
View view = (View) this.mViewRef.get();
if (match != null && view != null && view.getVisibility() == 0) {
start(match);
}
}
}
示例3: setState
import android.util.StateSet; //导入方法依赖的package包/类
/**
* Called by View
*/
void setState(int[] state) {
Tuple match = null;
final int count = mTuples.size();
for (int i = 0; i < count; i++) {
final Tuple tuple = mTuples.get(i);
if (StateSet.stateSetMatches(tuple.mSpecs, state)) {
match = tuple;
break;
}
}
if (match == mLastMatch) {
return;
}
if (mLastMatch != null) {
cancel();
}
mLastMatch = match;
View view = mViewRef.get();
if (match != null && view != null && view.getVisibility() == View.VISIBLE ) {
start(match);
}
}
示例4: setState
import android.util.StateSet; //导入方法依赖的package包/类
/** Called by View */
void setState(int[] state) {
Tuple match = null;
final int count = tuples.size();
for (int i = 0; i < count; i++) {
final Tuple tuple = tuples.get(i);
if (StateSet.stateSetMatches(tuple.specs, state)) {
match = tuple;
break;
}
}
if (match == lastMatch) {
return;
}
if (lastMatch != null) {
cancel();
}
lastMatch = match;
if (match != null) {
start(match);
}
}
示例5: onStateChange
import android.util.StateSet; //导入方法依赖的package包/类
@Override
protected boolean onStateChange(int[] state) {
boolean active = StateSet.stateSetMatches(STATE_SELECTED, state) | StateSet.stateSetMatches(STATE_PRESSED, state);
if (active != mActive) {
mActive = active;
// Log.d("FolderTransitionDrawable", "onStateChange " + StateSet.dump(state) + " " + active);
if (!active) {
unscheduleSelf(this);
if (mAlpha != 255) {
startTransition(false);
}
} else {
scheduleSelf(this, SystemClock.uptimeMillis() + 500);
}
return true;
}
return false;
}
示例6: setState
import android.util.StateSet; //导入方法依赖的package包/类
public void setState(int[] newState) {
if (Arrays.equals(newState, currentState))
return;
if (currentState != null)
cancel();
for (final int[] state : states) {
if (StateSet.stateSetMatches(state, newState)) {
int firstColor = super.getColorForState(currentState, getDefaultColor());
int secondColor = super.getColorForState(newState, getDefaultColor());
colorAnimation.setIntValues(firstColor, secondColor);
currentState = newState;
animatedColor = firstColor;
colorAnimation.start();
return;
}
}
currentState = newState;
}
示例7: setState
import android.util.StateSet; //导入方法依赖的package包/类
/**
* Called by View
*/
public void setState(int[] state) {
Tuple match = null;
final int count = mTuples.size();
for (int i = 0; i < count; i++) {
final Tuple tuple = mTuples.get(i);
if (StateSet.stateSetMatches(tuple.mSpecs, state)) {
match = tuple;
break;
}
}
if (match == lastMatch) {
return;
}
if (lastMatch != null) {
cancel();
}
lastMatch = match;
View view = (View) viewRef.get();
if (match != null && view != null && view.getVisibility() == View.VISIBLE) {
start(match);
}
}
示例8: setState
import android.util.StateSet; //导入方法依赖的package包/类
/** Called by View */
void setState(int[] state) {
Tuple match = null;
final int count = mTuples.size();
for (int i = 0; i < count; i++) {
final Tuple tuple = mTuples.get(i);
if (StateSet.stateSetMatches(tuple.mSpecs, state)) {
match = tuple;
break;
}
}
if (match == mLastMatch) {
return;
}
if (mLastMatch != null) {
cancel();
}
mLastMatch = match;
if (match != null) {
start(match);
}
}
示例9: getThemeColorStateList
import android.util.StateSet; //导入方法依赖的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()));
}
示例10: onStateChange
import android.util.StateSet; //导入方法依赖的package包/类
@Override
protected boolean onStateChange(int[] state) {
if (StateSet.stateSetMatches(state, View.FOCUS_DOWN)) {
mColor = COLOR_FOCUS_DOWN;
mPaint.setColor(mColor);
mTextPaint.setColor(mColor);
return true;
} else if (StateSet.stateSetMatches(state, View.FOCUS_UP)) {
mColor = COLOR_FOCUS_UP;
mPaint.setColor(mColor);
mTextPaint.setColor(mColor);
return true;
}
return false;
}
示例11: onStateChange
import android.util.StateSet; //导入方法依赖的package包/类
@Override
protected boolean onStateChange(int[] stateSet) {
final boolean useAlt = StateSet.stateSetMatches(DrawableStateSet.ENABLED_PRESSED_STATE_SET, stateSet)
|| StateSet.stateSetMatches(DrawableStateSet.ENABLED_FOCUSED_STATE_SET, stateSet);
setColorFilter(useAlt ? mAltCf : mNormalCf);
return true;
}
示例12: getColorForState
import android.util.StateSet; //导入方法依赖的package包/类
@Override
public int getColorForState(int[] stateSet, int defaultColor) {
final int setLength = mStateSpecs.length;
for (int i = 0; i < setLength; i++) {
final int[] stateSpec = mStateSpecs[i];
if (StateSet.stateSetMatches(stateSpec, stateSet)) {
if (mAlphaCodeColors[i] != null) {
return mAlphaCodeColors[i].getColorForState(stateSet, defaultColor);
} else {
return mColors[i];
}
}
}
return defaultColor;
}
示例13: getColorForState
import android.util.StateSet; //导入方法依赖的package包/类
@Override
public Integer getColorForState(@Nullable int[] stateSet, Integer defaultColor) {
for (StateIndexValue stateIndexValue : mStateIndexValueList) {
if (StateSet.stateSetMatches(stateIndexValue.getState(), stateSet)) {
return stateIndexValue.getColor();
}
}
return defaultColor;
}
示例14: indexOfStateSet
import android.util.StateSet; //导入方法依赖的package包/类
private int indexOfStateSet(int[] stateSet) {
final int[][] stateSets = mStateSets;
final int N = getChildCount();
for (int i = 0; i < N; i++) {
if (StateSet.stateSetMatches(stateSets[i], stateSet)) {
return i;
}
}
return -1;
}
示例15: onStateChange
import android.util.StateSet; //导入方法依赖的package包/类
@Override
protected boolean onStateChange(int[] state) {
mActive = StateSet.stateSetMatches(STATE_FOCUSED, state) | StateSet.stateSetMatches(STATE_PRESSED, state);
invalidateSelf();
return false;
}