Java Code Examples for android.graphics.Outline#isEmpty()

The following examples show how to use android.graphics.Outline#isEmpty() . 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: LayerDrawable.java    From Carbon with Apache License 2.0 6 votes vote down vote up
/**
 * Populates <code>outline</code> with the first available (non-empty) layer outline.
 *
 * @param outline Outline in which to place the first available layer outline
 */
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void getOutline(@NonNull Outline outline) {
    final ChildDrawable[] array = mLayerState.mChildren;
    final int N = mLayerState.mNum;
    for (int i = 0; i < N; i++) {
        final Drawable dr = array[i].mDrawable;
        if (dr != null) {
            dr.getOutline(outline);
            if (!outline.isEmpty()) {
                return;
            }
        }
    }
}
 
Example 2
Source File: LayerDrawable.java    From RippleDrawable with MIT License 6 votes vote down vote up
/**
 * Populates <code>outline</code> with the first available (non-empty) layer outline.
 *
 * @param outline Outline in which to place the first available layer outline
 */
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void getOutline(Outline outline) {
    if (!Android.isLollipop()) {
        return;
    }

    final LayerState state = mLayerState;
    final ChildDrawable[] children = state.mChildren;
    final int N = state.mNum;
    for (int i = 0; i < N; i++) {
        children[i].mDrawable.getOutline(outline);
        if (!outline.isEmpty()) {
            return;
        }
    }
}
 
Example 3
Source File: RippleDrawableICS.java    From Carbon with Apache License 2.0 5 votes vote down vote up
/**
 * Populates <code>outline</code> with the first available layer outline, excluding the mask
 * layer.
 *
 * @param outline Outline in which to place the first available layer outline
 */
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void getOutline(@NonNull Outline outline) {
    final LayerState state = mLayerState;
    final ChildDrawable[] children = state.mChildren;
    final int N = state.mNum;
    for (int i = 0; i < N; i++) {
        if (children[i].mId != R.id.carbon_mask) {
            children[i].mDrawable.getOutline(outline);
            if (!outline.isEmpty()) return;
        }
    }
}
 
Example 4
Source File: FrameDrawable.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(Outline outline) {
    if (mItems.isEmpty()) {
        super.getOutline(outline);
        return;
    }
    for (ChildDrawable child : mItems) {
        child.getDrawable().getOutline(outline);
        if (!outline.isEmpty())
            return;
    }
}
 
Example 5
Source File: RippleDrawable.java    From RippleDrawable with MIT License 5 votes vote down vote up
/**
 * Populates <code>outline</code> with the first available layer outline,
 * excluding the mask layer.
 *
 * @param outline Outline in which to place the first available layer outline
 */
@Override
public void getOutline(@NonNull Outline outline) {
    final LayerState state = mLayerState;
    final ChildDrawable[] children = state.mChildren;
    final int N = state.mNum;
    for (int i = 0; i < N; i++) {
        if (children[i].mId != android.R.id.mask) {
            children[i].mDrawable.getOutline(outline);
            if (!outline.isEmpty()) return;
        }
    }
}