List of usage examples for android.widget ImageView setBackgroundDrawable
@Deprecated public void setBackgroundDrawable(Drawable background)
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 a va2s .co m * * @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.//www. ja 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.rp.justcast.photos.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView.//from w w w .ja 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 }); //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.tack.android.image.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView/* w w w. j a va 2 s. co m*/ * @param bitmap */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @SuppressWarnings("deprecation") private void setImageBitmap(ImageView imageView, Bitmap bitmap) { if (mFadeInBitmap) { // Transition drawable with a transparent drawable 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 if (ConfigUtil.hasV16()) { imageView.setBackground(new BitmapDrawable(mResources, mLoadingBitmap)); } else { imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); } imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageBitmap(bitmap); } }
From source file:com.bitants.wally.views.swipeclearlayout.SwipeClearLayout.java
private View generateCircle(Context context, AttributeSet attrs, DisplayMetrics metrics) { ImageView view = new ImageView(context, attrs); GradientDrawable circle = (GradientDrawable) getResources().getDrawable(R.drawable.circle); circle.setColor(CIRCLE_DEFAULT_COLOR); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { view.setBackground(circle);// w ww.jav a 2 s .c o m } else { view.setBackgroundDrawable(circle); } int size = (int) (metrics.density * CIRCLE_SIZE); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(size, size); view.setLayoutParams(params); view.setImageResource(R.drawable.clip_random); view.setScaleType(ImageView.ScaleType.CENTER_INSIDE); view.setRotation(90.0f); return view; }
From source file:com.faayda.imageloader.ImageLoader.java
/** * Called when the processing is complete and the final bitmap should be set on the ImageView. * * @param imageView The ImageView to set the bitmap to. * @param bitmap The new bitmap to set./*from www. j a v a 2 s .co m*/ */ @SuppressLint("NewApi") @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(mResources.getColor(R.color.transparent)), new BitmapDrawable(mResources, bitmap) }); if (android.os.Build.VERSION.SDK_INT >= android.os.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
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 ww w . ja v a 2s. c om td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(drawable); } fragment.attachPhotoView(imageView); }
From source file:com.github.programmerr47.vkgroups.imageloading.ImageWorker.java
/** * Called when the processing is complete and the final drawable should be * set on the ImageView./* www.j av a 2 s .c o m*/ */ private void setImageDrawable(ImageView imageView, BitmapDrawable drawable, LoadBitmapParams loadingParams) { Drawable finalDrawable = postProcessDrawable(drawable, loadingParams); 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)), finalDrawable }); // Set background to loading bitmap imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setImageDrawable(finalDrawable); } }
From source file:image_cache.ImageWorker.java
/** * Called when the processing is complete and the final bitmap should be set * on the ImageView.// ww w. j ava 2 s. c o m * * @param imageView * @param bitmap */ @SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.JELLY_BEAN) 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 if (Utils.hasJellyBean()) imageView.setBackground(new BitmapDrawable(mResources, mLoadingBitmap)); else imageView.setBackgroundDrawable(new BitmapDrawable(mResources, mLoadingBitmap)); imageView.setBackgroundColor(0); imageView.setImageDrawable(td); td.startTransition(FADE_IN_TIME); } else { imageView.setBackgroundColor(0); 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/* w ww . ja va2 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); } }