Java Code Examples for android.graphics.drawable.StateListDrawable.getState()

The following are Jave code examples for showing how to use getState() of the android.graphics.drawable.StateListDrawable class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PeSanKita-android   File: TargetDrawable.java   View Source Code Vote up 5 votes
/**
 * Returns true if the drawable is a StateListDrawable and is in the focused state.
 *
 * @return
 */
public boolean isActive() {
    if (mDrawable instanceof StateListDrawable) {
        StateListDrawable d = (StateListDrawable) mDrawable;
        int[] states = d.getState();
        for (int i = 0; i < states.length; i++) {
            if (states[i] == android.R.attr.state_focused) {
                return true;
            }
        }
    }
    return false;
}
 
Example 2
Project: CSipSimple   File: TargetDrawable.java   View Source Code Vote up 5 votes
/**
 * Returns true if the drawable is a StateListDrawable and is in the focused state.
 *
 * @return
 */
public boolean isActive() {
    if (mDrawable instanceof StateListDrawable) {
        StateListDrawable d = (StateListDrawable) mDrawable;
        int[] states = d.getState();
        for (int i = 0; i < states.length; i++) {
            if (states[i] == android.R.attr.state_focused) {
                return true;
            }
        }
    }
    return false;
}
 
Example 3
Project: Cable-Android   File: TargetDrawable.java   View Source Code Vote up 5 votes
/**
 * Returns true if the drawable is a StateListDrawable and is in the focused state.
 *
 * @return
 */
public boolean isActive() {
    if (mDrawable instanceof StateListDrawable) {
        StateListDrawable d = (StateListDrawable) mDrawable;
        int[] states = d.getState();
        for (int i = 0; i < states.length; i++) {
            if (states[i] == android.R.attr.state_focused) {
                return true;
            }
        }
    }
    return false;
}