protected static AsyncImageTask GetAsyncImageTask(ImageView imageView) { if (imageView != null) { Drawable drawable = imageView.Drawable; if (drawable is AsyncDrawable) { AsyncDrawable asyncDrawable = (AsyncDrawable)drawable; return(asyncDrawable.AsyncImageTask); } } return(null); }
public static void LoadBitmap(ImageView imageView, double d, int w, int h) { int direction = (int)d; // Check, if there is another image creation is running if (CancelPotentialWork(direction, imageView)) { // Create task for image creation AsyncImageFromDirection asyncImageTask = new AsyncImageFromDirection(imageView, 0, w, h); // Has the ImageView an existing AsyncDrawable if (imageView.Drawable == null || !(imageView.Drawable is AsyncDrawable)) { // No, than create one AsyncDrawable asyncDrawable = new AsyncDrawable(imageView.Context.Resources, BitmapFactory.DecodeResource(imageView.Context.Resources, Android.Resource.Drawable.IcMenuGallery), asyncImageTask); // Set it as bitmap for the ImageView until the correct image is ready imageView.SetImageDrawable(asyncDrawable); } asyncImageTask.Execute(direction); } }
public static void LoadBitmap(ImageView imageView, double d, int w, int h) { int direction = (int)d; // Check, if there is another image creation is running if(CancelPotentialWork(direction, imageView)) { // Create task for image creation AsyncImageFromDirection asyncImageTask = new AsyncImageFromDirection(imageView, 0, w, h); // Has the ImageView an existing AsyncDrawable if(imageView.Drawable == null || !(imageView.Drawable is AsyncDrawable)) { // No, than create one AsyncDrawable asyncDrawable = new AsyncDrawable(imageView.Context.Resources, BitmapFactory.DecodeResource(imageView.Context.Resources, Android.Resource.Drawable.IcMenuGallery), asyncImageTask); // Set it as bitmap for the ImageView until the correct image is ready imageView.SetImageDrawable(asyncDrawable); } asyncImageTask.Execute(direction); } }