Example usage for android.graphics.drawable DrawableWrapper setAlpha

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

Introduction

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

Prototype

@Override
    public void setAlpha(int alpha) 

Source Link

Usage

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

private void updateImmediate() {
    lazyInit();/*from   ww w .ja v a  2  s .co  m*/

    DrawableWrapper colorWrapper = getColorWrapper();
    if (colorWrapper != null) {
        colorWrapper.setColor(mBackgroundColor);
    }
    DrawableWrapper dimWrapper = getDimWrapper();
    if (dimWrapper != null) {
        dimWrapper.setAlpha(mBackgroundColor == Color.TRANSPARENT ? 0 : DIM_ALPHA_ON_SOLID);
    }
    showWallpaper(mBackgroundColor == Color.TRANSPARENT);

    if (mBackgroundDrawable == null) {
        mLayerDrawable.clearDrawable(R.id.background_imagein, mContext);
    } else {
        if (DEBUG)
            Log.v(TAG, "Background drawable is available");
        mLayerDrawable.updateDrawable(R.id.background_imagein, mBackgroundDrawable);
        if (dimWrapper != null) {
            dimWrapper.setAlpha(FULL_ALPHA);
        }
    }
}

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

private void applyBackgroundChanges() {
    if (!mAttached) {
        return;//from  w  w  w.  j  a va 2s .  c  o  m
    }

    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  ww  w  .j a v  a  2s.co m
    }

    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();
    }
}