Java Code Examples for

The following are Jave code examples for showing how to use getCurrent() of the 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: silly-android   File:   View Source Code Vote up 5 votes
 * Tests the {@link Coloring#createStateList(Context, int, int, int, boolean, int)} method.
 * <p>
 * Unfortunately {@link StateListDrawable#getCurrent()} is not shadowed by Robolectric yet.
public final void testCreateStateList() {
    final int colorNormal = Color.WHITE;
    final int colorActive = Color.GRAY;
    final int colorFocused = Color.YELLOW;
    final StateListDrawable drawable = Coloring.createStateList(mActivityContext, colorNormal, colorActive, colorFocused, true, 0);
    assertNotNull("StateListDrawable is null", drawable);
    drawable.setState(new int[] {});
    assertTrue("StateListDrawable is not stateful", drawable.isStateful());
    final Drawable.ConstantState constantState = drawable.getConstantState();
    assertNotNull("Constant state is null", constantState);
    final Drawable currentState = drawable.getCurrent();
    assertNull("Robolectric started shadowing current state", currentState);