Java Code Examples for android.view.View#EMPTY_STATE_SET

The following examples show how to use android.view.View#EMPTY_STATE_SET . 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: BaseCardView.java    From adt-leanback-support with Apache License 2.0 6 votes vote down vote up
@Override
protected int[] onCreateDrawableState(int extraSpace) {
    // filter out focus states,  since leanback does not fade foreground on focus.
    final int[] s = super.onCreateDrawableState(extraSpace);
    final int N = s.length;
    boolean pressed = false;
    boolean enabled = false;
    for (int i = 0; i < N; i++) {
        if (s[i] == android.R.attr.state_pressed) {
            pressed = true;
        }
        if (s[i] == android.R.attr.state_enabled) {
            enabled = true;
        }
    }
    if (pressed && enabled) {
        return View.PRESSED_ENABLED_STATE_SET;
    } else if (pressed) {
        return LB_PRESSED_STATE_SET;
    } else if (enabled) {
        return View.ENABLED_STATE_SET;
    } else {
        return View.EMPTY_STATE_SET;
    }
}