Example usage for android.graphics.drawable Drawable getChangingConfigurations

List of usage examples for android.graphics.drawable Drawable getChangingConfigurations

Introduction

In this page you can find the example usage for android.graphics.drawable Drawable getChangingConfigurations.

Prototype

public @Config int getChangingConfigurations() 

Source Link

Document

Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created.

Usage

From source file:Main.java

/**
 * Copies various properties from one drawable to the other.
 * @param to drawable to copy properties to
 * @param from drawable to copy properties from
 *///  www.j av a  2s. com
public static void copyProperties(Drawable to, Drawable from) {
    if (from == null || to == null || to == from) {
        return;
    }

    to.setBounds(from.getBounds());
    to.setChangingConfigurations(from.getChangingConfigurations());
    to.setLevel(from.getLevel());
    to.setVisible(from.isVisible(), /* restart */false);
    to.setState(from.getState());
}

From source file:codetail.graphics.drawables.LayerDrawable.java

/**
 * Add a new layer to this drawable. The new layer is identified by an id.
 *
 * @param layer      The drawable to add as a layer.
 * @param themeAttrs Theme attributes extracted from the layer.
 * @param id         The id of the new layer.
 * @param left       The left padding of the new layer.
 * @param top        The top padding of the new layer.
 * @param right      The right padding of the new layer.
 * @param bottom     The bottom padding of the new layer.
 *//*from w  ww.  j  av  a  2 s.c  om*/
ChildDrawable addLayer(Drawable layer, TypedValue[] themeAttrs, int id, int left, int top, int right,
        int bottom) {
    final ChildDrawable childDrawable = new ChildDrawable();
    childDrawable.mId = id;
    childDrawable.mThemeAttrs = themeAttrs;
    childDrawable.mDrawable = layer;
    DrawableCompat.setAutoMirrored(childDrawable.mDrawable, isAutoMirrored());
    childDrawable.mInsetL = left;
    childDrawable.mInsetT = top;
    childDrawable.mInsetR = right;
    childDrawable.mInsetB = bottom;

    addLayer(childDrawable);

    mLayerState.mChildrenChangingConfigurations |= layer.getChangingConfigurations();
    layer.setCallback(this);

    return childDrawable;
}