Example usage for android.graphics.drawable DrawableWrapper getAlpha

List of usage examples for android.graphics.drawable DrawableWrapper getAlpha

Introduction

In this page you can find the example usage for android.graphics.drawable DrawableWrapper getAlpha.

Prototype

@Override
    public int getAlpha() 

Source Link

Usage

From source file:android.support.v17.leanback.app.BackgroundManager.java

private void applyBackgroundChanges() {
    if (!mAttached) {
        return;/*  w  ww.java 2 s .c  om*/
    }

    if (DEBUG)
        Log.v(TAG, "applyBackgroundChanges drawable " + mBackgroundDrawable);

    int dimAlpha = -1;

    if (getImageOutWrapper() != null) {
        dimAlpha = mBackgroundColor == Color.TRANSPARENT ? 0 : DIM_ALPHA_ON_SOLID;
    }

    DrawableWrapper imageInWrapper = getImageInWrapper();
    if (imageInWrapper == null && mBackgroundDrawable != null) {
        if (DEBUG)
            Log.v(TAG, "creating new imagein drawable");
        imageInWrapper = mLayerDrawable.updateDrawable(R.id.background_imagein, mBackgroundDrawable);
        if (DEBUG)
            Log.v(TAG, "imageInWrapper animation starting");
        imageInWrapper.setAlpha(0);
        dimAlpha = FULL_ALPHA;
    }

    mAnimator.setDuration(FADE_DURATION);
    mAnimator.start();

    DrawableWrapper dimWrapper = getDimWrapper();
    if (dimWrapper != null && dimAlpha >= 0) {
        if (DEBUG)
            Log.v(TAG, "dimwrapper animation starting to " + dimAlpha);
        mDimAnimator.cancel();
        mDimAnimator.setIntValues(dimWrapper.getAlpha(), dimAlpha);
        mDimAnimator.setDuration(FADE_DURATION);
        mDimAnimator
                .setInterpolator(dimAlpha == FULL_ALPHA ? mDecelerateInterpolator : mAccelerateInterpolator);
        mDimAnimator.start();
    }
}

From source file:com.rbware.github.androidcouchpotato.app.BackgroundManager.java

void applyBackgroundChanges() {
    if (!mAttached) {
        return;/*from w w w.  jav  a  2  s. c om*/
    }

    if (DEBUG)
        Log.v(TAG, "applyBackgroundChanges drawable " + mBackgroundDrawable);

    int dimAlpha = -1;

    if (getImageOutWrapper() != null) {
        dimAlpha = mBackgroundColor == Color.TRANSPARENT ? 0 : DIM_ALPHA_ON_SOLID;
    }

    DrawableWrapper imageInWrapper = getImageInWrapper();
    if (imageInWrapper == null && mBackgroundDrawable != null) {
        if (DEBUG)
            Log.v(TAG, "creating new imagein drawable");
        imageInWrapper = mLayerDrawable.updateDrawable(R.id.background_imagein, mBackgroundDrawable);
        if (DEBUG)
            Log.v(TAG, "imageInWrapper animation starting");
        imageInWrapper.setAlpha(0);
        dimAlpha = FULL_ALPHA;
    }

    mAnimator.setDuration(FADE_DURATION);
    mAnimator.start();

    DrawableWrapper dimWrapper = getDimWrapper();
    if (dimWrapper != null && dimAlpha >= 0) {
        if (DEBUG)
            Log.v(TAG, "dimwrapper animation starting to " + dimAlpha);
        mDimAnimator.cancel();
        mDimAnimator.setIntValues(dimWrapper.getAlpha(), dimAlpha);
        mDimAnimator.setDuration(FADE_DURATION);
        mDimAnimator
                .setInterpolator(dimAlpha == FULL_ALPHA ? mDecelerateInterpolator : mAccelerateInterpolator);
        mDimAnimator.start();
    }
}