List of usage examples for android.graphics.drawable TransitionDrawable TransitionDrawable
public TransitionDrawable(Drawable[] layers)
From source file:com.bitmaphandler.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from ww w. ja v a 2s. c om * * @param imageView * @param drawable */ @SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.JELLY_BEAN) 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 }); if (useLoadingImage && mLoadingBitmap != null) { // Set background to loading bitmap if (imageView instanceof CircleImageView) { if (!Utils.hasJellyBean()) { imageView.setBackgroundDrawable(new BitmapDrawable(mResources, CircleImageView.getCroppedBitmap(mLoadingBitmap, mLoadingBitmap.getWidth()))); } else { imageView.setBackground(new BitmapDrawable(mResources, CircleImageView.getCroppedBitmap(mLoadingBitmap, mLoadingBitmap.getWidth()))); } } else if (imageView instanceof RoundedBitmapDisplayer) { if (!Utils.hasJellyBean()) { imageView.setBackgroundDrawable( new BitmapDrawable(mResources, RoundedBitmapDisplayer.roundCorners(mLoadingBitmap, imageView, ((RoundedBitmapDisplayer) imageView).getRoundPixle()))); } else { imageView.setBackground(new BitmapDrawable(mResources, RoundedBitmapDisplayer.roundCorners( mLoadingBitmap, imageView, ((RoundedBitmapDisplayer) imageView).getRoundPixle()))); } } else { if (!Utils.hasJellyBean()) { imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); } else { imageView.setBackground(new BitmapDrawable(mResources, mLoadingBitmap)); } } } imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.example.android.displayingbitmaps.imageloader.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 om*/ * * @param imageView * @param drawable */ private void setImageDrawable(final ImageView imageView, final 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), new BitmapDrawable(mResources, mLoadingBitmap), drawable }); // Set background to loading bitmap // imageView.setBackgroundDrawable( // new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setBackgroundColor(Color.TRANSPARENT); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); imageView.setBackgroundColor(Color.TRANSPARENT); } }
From source file:com.sky.drovik.player.bitmapfun.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView/*from w w w .j av a 2 s.co m*/ * @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:android.support.asy.image.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView./* www . java 2 s. co m*/ * * @param imageView * @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:cz.appvision.ebookreader.image.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.// ww w . ja v a2 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 Drawable currentDrawable = imageView.getDrawable(); if (currentDrawable.getClass().equals(AsyncDrawable.class)) { String placeholderKey = ((AsyncDrawable) currentDrawable).getPlaceholderKey(); imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap.get(placeholderKey))); } imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.rickstart.moviefriend.util.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./*from ww w. j a va 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.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.abcs.sociax.gimgutil.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView./*from w w w .j av a 2 s . co m*/ * * @param imageView * @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.setImageDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
From source file:com.linhnv.apps.maxim.utils.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./*from w w w . java 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(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.ksharkapps.musicnow.ui.activities.BaseActivity.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 {/*w w w . ja v a 2 s . com*/ actBar.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 { actBar.setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler actBar.setDisplayShowTitleEnabled(false); actBar.setDisplayShowTitleEnabled(true); if (Utils.hasKitKat()) { if (SettingsActivity.getTranslucentMode(this)) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(getResources().getColor(R.color.contextual_actionbar_color)); } } }
From source file:com.nyuen.five00dp.util.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView/* w w w . ja va 2s . c o m*/ * @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); } }