List of usage examples for android.graphics.drawable TransitionDrawable TransitionDrawable
public TransitionDrawable(Drawable[] layers)
From source file:com.appgeneration.magmanager.imagefetcher.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView// www . j a v a2 s . c o m * @param bitmap */ @SuppressWarnings("deprecation") private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Use TransitionDrawable to fade in final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); imageView.setBackgroundDrawable(imageView.getDrawable()); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
From source file:com.pouch.util.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from ww w . jav a 2 s . c om * * @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(0xFFFFFF), 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:org.chromium.chrome.browser.ntp.snippets.SnippetArticleViewHolder.java
private void fadeThumbnailIn(SnippetArticle snippet, Bitmap thumbnail) { mImageCallback = null;//from w w w .j a v a 2 s .co m if (thumbnail == null) return; // Nothing to do, we keep the placeholder. // We need to crop and scale the downloaded bitmap, as the ImageView we set it on won't be // able to do so when using a TransitionDrawable (as opposed to the straight bitmap). // That's a limitation of TransitionDrawable, which doesn't handle layers of varying sizes. Resources res = mThumbnailView.getResources(); int targetSize = res.getDimensionPixelSize(R.dimen.snippets_thumbnail_size); Bitmap scaledThumbnail = ThumbnailUtils.extractThumbnail(thumbnail, targetSize, targetSize, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); // Store the bitmap to skip the download task next time we display this snippet. snippet.setThumbnailBitmap(scaledThumbnail); // Cross-fade between the placeholder and the thumbnail. Drawable[] layers = { mThumbnailView.getDrawable(), new BitmapDrawable(mThumbnailView.getResources(), scaledThumbnail) }; TransitionDrawable transitionDrawable = new TransitionDrawable(layers); mThumbnailView.setImageDrawable(transitionDrawable); transitionDrawable.startTransition(FADE_IN_ANIMATION_TIME_MS); }
From source file:com.krava.vkmessenger.domain.image.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./* ww w . j a v a 2s.c om*/ * * @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(imageView.getResources().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:com.ruoogle.base.imgload.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView// w w w . ja va2 s . co m * @param bitmap */ private void setImageBitmap(ImageView imageView, Drawable aDrawable) { 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), aDrawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { /*aDrawable??*/ if (aDrawable == null) { imageView.setImageBitmap(mLoadingBitmap); } else { imageView.setImageDrawable(aDrawable); } } }
From source file:com.android.displayingbitmaps.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 om * * @param imageView * @param drawable */ protected 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:org.android.framework.engine.image.util.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.// ww w. j a v a2 s . com * * @param imageViewObject * @param drawable */ private void setImageDrawable(ImageTask.ImageViewObject imageViewObject, 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 imageViewObject.view.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); if (imageViewObject.view instanceof ImageView) { ((ImageView) imageViewObject.view).setImageDrawable(td); imageViewObject.view.setBackgroundDrawable(null); } else { imageViewObject.view.setBackgroundDrawable(td); } td.startTransition(FADE_IN_TIME); } else { if (imageViewObject.view instanceof ImageView) { ((ImageView) imageViewObject.view).setImageDrawable(drawable); imageViewObject.view.setBackgroundDrawable(null); } else { imageViewObject.view.setBackgroundDrawable(drawable); } } }
From source file:com.vstar.lib.io.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView./*from ww w. j av a2 s.c o m*/ * * @param imageView * @param bitmap */ private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Use TransitionDrawable to fade in final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); // noinspection deprecation imageView.setBackgroundDrawable(imageView.getDrawable()); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
From source file:com.intuit.qboecoui.feeds.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 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 }); // 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.andreaszeiser.bob.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView./* www. j av a 2s .c o m*/ * * @param imageView * @param bitmap */ private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Use TransitionDrawable to fade in final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); // noinspection deprecation imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }