List of usage examples for android.graphics.drawable TransitionDrawable TransitionDrawable
public TransitionDrawable(Drawable[] layers)
From source file:com.image.cache.util.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./* w ww .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.setImageDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.fastbootmobile.encore.app.fragments.AlbumViewFragment.java
private void loadArt(final boolean materialTransition) { AlbumArtHelper.retrieveAlbumArt(getResources(), new AlbumArtHelper.AlbumArtListener() { @Override//from w w w. j a v a 2 s . c om public void onArtLoaded(RecyclingBitmapDrawable output, BoundEntity request) { if (output != null) { mHeroImage = output.getBitmap(); if (materialTransition) { MaterialTransitionDrawable mtd = new MaterialTransitionDrawable( (BitmapDrawable) getResources().getDrawable(R.drawable.ic_cloud_offline), (BitmapDrawable) getResources().getDrawable(R.drawable.album_placeholder)); mtd.transitionTo(output); mIvHero.setImageDrawable(mtd); } else { final TransitionDrawable transition = new TransitionDrawable( new Drawable[] { mIvHero.getDrawable(), output }); // Make sure the transition happens after the activity animation is done, // otherwise weird sliding occurs. mHandler.postDelayed(new Runnable() { @Override public void run() { mIvHero.setImageDrawable(transition); transition.startTransition(500); } }, 600); } try { generateHeroPalette(); } catch (IllegalArgumentException ignore) { } } } }, mAlbum, -1, false); }
From source file:com.gtx.cooliris.imagecache.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from ww w.ja v a 2 s. c o m * * @param imageView * @param drawable */ private void setImageDrawable(IAsyncImageView 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 if (null != mLoadingBitmap) { imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); } imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.image.cache.util.ImageWorker.java
private void setImageDrawableFrame(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.setImageDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td);//from ww w. j a va2 s . co m td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:wb.android.workers.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. co m*/ * * @param imageView * @param drawable */ @SuppressWarnings("deprecation") private void setImageDrawable(ImageView imageView, ProgressBar progressBar, Drawable drawable) { if (progressBar != null) { progressBar.setVisibility(View.GONE); } imageView.setVisibility(View.VISIBLE); 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.common.library.bitmap.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from w ww . ja v a 2 s . 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:com.simplelife.seeds.android.utils.gridview.gridviewutil.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(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:prince.app.sphotos.util.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from ww w .ja v a 2 s .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.setImageBitmap(mLoadingBitmap); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.ksharkapps.musicnow.ui.activities.SearchActivity.java
public void changeActionBarColor(int newColor) { int color = newColor != 0 ? newColor : SettingsActivity.getActionBarColor(this); Drawable colorDrawable = new ColorDrawable(color); Drawable bottomDrawable = getResources().getDrawable(R.drawable.transparent_overlay); LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable, bottomDrawable }); if (oldBackground == null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { ld.setCallback(drawableCallback); } else {//from w w w . j a va 2s .com actionBar.setBackgroundDrawable(colorDrawable); } } else { TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld }); // workaround for broken ActionBarContainer drawable handling on // pre-API 17 builds // https://github.com/android/platform_frameworks_base/commit/a7cc06d82e45918c37429a59b14545c6a57db4e4 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { td.setCallback(drawableCallback); } else { actionBar.setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); }
From source file:com.simplelife.seeds.android.utils.gridview.gridviewutil.ImageWorker.java
private void setImageDrawable(ImageView imageView, Drawable drawable, ImageDetailFragment fragment) { 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);//from w w w.ja v a2 s. com td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } fragment.attachPhotoView(imageView); }