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:com.vibeosys.travelapp.util.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;

        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.alex.develop.cache.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView.// w ww .  j  av a2 s.com
 *
 * @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[] {

                // Edit by alex
                // before
                new ColorDrawable(android.R.color.transparent),
                // after
                //                            new ColorDrawable(Color.parseColor("#00000000")),
                // end

                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.crazyapk.util.bitmap.ImageWorker.java

/**
 * Called when the processing is complete and the final bitmap should be set on the ImageView.
 *
 * @param imageView//www  . ja  v  a  2 s .  com
 * @param bitmap
 */
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:org.mrchen.commlib.bitmapfun.ImageWorker.java

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

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

From source file:baselyous.com.copticsmedia.mediaTasks.tasks.ebsalmodiaTask.util.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView./*w  ww.  j  ava 2s.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(mResources.getColor(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:air.com.snagfilms.utils.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView.//from  w  w w . j ava2s  .c  o 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.baseproject.image.ImageWorker.java

/**
 * Called when the processing is complete and the final bitmap should be set
 * on the ImageView./*from  w  ww . j  av  a  2s .  c o m*/
 * 
 * @param imageView
 * @param bitmap
 */
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
private void setImageBitmap(ImageView imageView, Bitmap bitmap) {
    if (mFadeInBitmap) {
        if (imageView.getTag() instanceof String && "no_animation".equals(String.valueOf(imageView.getTag()))) {
            imageView.setImageBitmap(bitmap);
        } else {
            // Transition drawable with a transparent drwabale and the final
            // bitmap
            TransitionDrawable td = new TransitionDrawable(
                    new Drawable[] { new ColorDrawable(android.R.color.transparent),
                            new BitmapDrawable(mContext.getResources(), bitmap) });
            final WeakReference<TransitionDrawable> tdReference = new WeakReference<TransitionDrawable>(td);
            td = null;
            // Set background to loading bitmap
            final BitmapDrawable bd = new BitmapDrawable(mContext.getResources(), mLoadingBitmap);
            if (Build.VERSION.SDK_INT >= 16) {
                imageView.setBackground(bd);
            } else {
                imageView.setBackgroundDrawable(bd);

            }
            if (null != tdReference.get()) {
                imageView.setImageDrawable(tdReference.get());
                tdReference.get().startTransition(FADE_IN_TIME);
            }
        }
    } else {
        imageView.setImageBitmap(bitmap);
    }

}

From source file:com.example.mohmurtu.registration.imagesUtil.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be 
 * set on the ImageView./*from  ww  w  .  j  av  a 2s .  c  o  m*/
 *
 * @param imageView
 * @param drawable
 */
private void setImageDrawable(ImageView imageView, Drawable drawable) {
    if (mFadeInBitmap) {
        System.out.println("Doing some thing here");
        // 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 {
        System.out.println("Bitmap is getting drawable");
        imageView.setImageDrawable(drawable);
    }
}

From source file:angel.zhuoxiu.picker.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  2s .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.corebase.android.bitmap.util.ImageWorker.java

/**
 * Called when the processing is complete and the final drawable should be
 * set on the ImageView.//from   w  ww.ja  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);
        imageView.setBackgroundDrawable(null);
        td.startTransition(FADE_IN_TIME);

    } else {
        imageView.setImageDrawable(drawable);
    }
}