Example usage for android.graphics.drawable TransitionDrawable TransitionDrawable

List of usage examples for android.graphics.drawable TransitionDrawable TransitionDrawable

Introduction

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

Prototype

public TransitionDrawable(Drawable[] layers) 

Source Link

Document

Create a new transition drawable with the specified list of layers.

Usage

From source file:android.bitmap.util.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView./*from   ww w . j  a  va2  s. co  m*/
 *
 * @param imageView
 * @param drawable
 */
@SuppressWarnings("deprecation")
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.example.com.jglx.android.app.util.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView./*from   ww  w  .  j  a v a2s  . c  o m*/
 * 
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final
        // drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.android.project.imagefetcher.ImageWorker.java

/**
 * Called when the processing is complete and the final bitmap should be set
 * on the ImageView./*from  w w  w. j  a v a 2  s .c om*/
 * 
 * @param imageView
 * @param bitmap
 */
@SuppressWarnings("deprecation")
private void setImageBitmap(ImageView imageView, Bitmap bitmap) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drwabale and the final
        // bitmap
        final TransitionDrawable td = new TransitionDrawable(new Drawable[] {
                new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageBitmap(bitmap);
    }
}

From source file:com.github.programmerr47.vkgroups.imageloading.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView./*  w  ww  . j a  va2s .  co  m*/
 */
private void setImageDrawable(ImageView imageView, BitmapDrawable drawable, LoadBitmapParams loadingParams) {
    Drawable finalDrawable = postProcessDrawable(drawable, loadingParams);

    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(new Drawable[] {
                new ColorDrawable(imageView.getResources().getColor(android.R.color.transparent)),
                finalDrawable });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(finalDrawable);
    }
}

From source file:com.rsegismont.androlife.common.utils.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be set on the ImageView.
 * /*from  w  w w  .  j  a v  a 2 s. c  o m*/
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable });
        // Set background to loading bitmap
        //   imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.cloudsynch.quickshare.utils.thumbnail.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView./*from  www .  j ava 2s.co  m*/
 * 
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final
        // drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable });

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:fanx.instl.utils.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView./*from  w  w  w  .  j  av a  2  s. c  o  m*/
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(00000000), drawable });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.yuedu.image.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView./*w w  w .  j  a va  2 s  .c  o m*/
 * 
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final
        // drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(android.R.color.transparent), drawable });
        // Set background to loading bitmap
        // imageView.setBackgroundDrawable(new BitmapDrawable(mResources,
        // mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.wl.pluto.plutochat.chat.cache.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView./*from   w ww.  j  ava2  s.c  o m*/
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with a transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(
                new Drawable[] { new ColorDrawable(Color.TRANSPARENT), drawable });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
}

From source file:com.nf2m.util.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView./*from w  ww .java  2s. co m*/
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(@NonNull ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        // Transition drawable with UriObserver transparent drawable and the final drawable
        final TransitionDrawable td = new TransitionDrawable(new Drawable[] {
                new ColorDrawable(ContextCompat.getColor(mContext, android.R.color.transparent)), drawable });
        // Set background to loading bitmap
        imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap));

        imageView.setImageDrawable(td);
        td.startTransition(FADE_IN_TIME);
    } else {
        imageView.setImageDrawable(drawable);
    }
    if (ImageDetailFragment.mProgress != null) {
        ImageDetailFragment.mProgress.setVisibility(View.GONE);
    }
}