List of usage examples for android.graphics.drawable TransitionDrawable startTransition
public void startTransition(int durationMillis)
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 ww. j av 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(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.tangjd.displayingbitmaps.util.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 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(imageView.getContext().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.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 w w w .j av a 2 s .c o m td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
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./*from w w w . j ava 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.setImageDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
From source file:com.xiaodong.dream.catcher.demo.image.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView// ww w .ja v a 2s .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(mResources.getColor(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.collcloud.frame.viewpager.main.PagerTabMainActivity.java
private void changeColor(int newColor) { tabs.setIndicatorColor(newColor);/*from w w w . j a v a 2s. co m*/ // change ActionBar color just if an ActionBar is available if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Drawable colorDrawable = new ColorDrawable(newColor); Drawable bottomDrawable = getResources().getDrawable(R.drawable.tab_pagertab_actionbar_bottom); 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 { //getActionBar().setBackgroundDrawable(ld); } } 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 { //getActionBar().setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler // getActionBar().setDisplayShowTitleEnabled(false); // getActionBar().setDisplayShowTitleEnabled(true); } currentColor = newColor; }
From source file:com.rp.justcast.photos.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 .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 }); //final TransitionDrawable td = new TransitionDrawable(new Drawable[] { 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.itsherpa.andg.imageloader.ContactImageLoader.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView./*from w w w . j av a2 s . c om*/ * * @param imageView * The ImageView to set the bitmap to. * @param bitmap * The new bitmap to set. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @SuppressWarnings("deprecation") private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Transition drawable to fade from loading bitmap to final bitmap final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(android.R.color.transparent), new BitmapDrawable(mResources, bitmap) }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { imageView.setBackground(imageView.getDrawable()); } else { imageView.setBackgroundDrawable(imageView.getDrawable()); } imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
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. jav a2 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.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } }
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 a 2s . com td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } fragment.attachPhotoView(imageView); }