protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detail_item); backgroundImage = FindViewById<ImageViewAsync>(Resource.Id.backgroundImage); logoImage = FindViewById<ImageViewAsync>(Resource.Id.logoImage); var txtTitle = FindViewById<TextView>(Resource.Id.txtTitle); var position = Intent.GetIntExtra (POSITION, 0); var image = Config.Images [position]; txtTitle.Text = position.ToString (); ImageService.LoadUrl(image) .Retry(3, 200) .DownSample(200, 200) .LoadingPlaceholder(Config.LoadingPlaceholderPath, FFImageLoading.Work.ImageSource.ApplicationBundle) .ErrorPlaceholder(Config.ErrorPlaceholderPath, FFImageLoading.Work.ImageSource.ApplicationBundle) .Into(logoImage); ImageService.LoadUrl(image) .Retry(3, 200) .DownSample(500, 500) .Transform(new BlurTransformation(this)) .LoadingPlaceholder(Config.LoadingPlaceholderPath, FFImageLoading.Work.ImageSource.ApplicationBundle) .ErrorPlaceholder(Config.ErrorPlaceholderPath, FFImageLoading.Work.ImageSource.ApplicationBundle) .Into(backgroundImage); }
public AcquaintanceViewHolder(View itemView) : base(itemView) { AcquaintanceRow = itemView; NameTextView = AcquaintanceRow.FindViewById<TextView>(Resource.Id.nameTextView); CompanyTextView = AcquaintanceRow.FindViewById<TextView>(Resource.Id.companyTextView); JobTitleTextView = AcquaintanceRow.FindViewById<TextView>(Resource.Id.jobTitleTextView); ProfilePhotoImageView = AcquaintanceRow.FindViewById<ImageViewAsync>(Resource.Id.profilePhotoImageView); }
public override void OnDestroyView() { if (_imgDisplay != null) { _imgDisplay.Dispose(); _imgDisplay = null; } base.OnDestroyView(); }
/// <summary> /// Loads the image into given imageView using defined parameters. /// </summary> /// <param name="parameters">Parameters for loading the image.</param> /// <param name="imageView">Image view that should receive the image.</param> public static IScheduledWork Into(this TaskParameter parameters, ImageViewAsync imageView) { var target = new ImageViewTarget(imageView); if (parameters.Source != ImageSource.Stream && string.IsNullOrWhiteSpace(parameters.Path)) { target.SetAsEmpty(); parameters.Dispose(); return null; } var task = CreateTask(parameters, target); ImageService.Instance.LoadImage(task); return task; }
/// <summary> /// Only use this method if you plan to handle exceptions in your code. Awaiting this method will give you this flexibility. /// </summary> /// <returns>An awaitable Task.</returns> /// <param name="parameters">Parameters for loading the image.</param> /// <param name="imageView">Image view that should receive the image.</param> public static Task<IScheduledWork> IntoAsync(this TaskParameter parameters, ImageViewAsync imageView) { var userErrorCallback = parameters.OnError; var finishCallback = parameters.OnFinish; var tcs = new TaskCompletionSource<IScheduledWork>(); parameters .Error(ex => { userErrorCallback(ex); tcs.SetException(ex); }) .Finish(scheduledWork => { finishCallback(scheduledWork); tcs.TrySetResult(scheduledWork); // we should use TrySetResult since SetException could have been called earlier. It is not allowed to set result after SetException }) .Into(imageView); return tcs.Task; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate (Resource.Layout.fragment_image, container, false); using (var textView = view.FindViewById<TextView>(Resource.Id.textView)) { textView.Text = _position.ToString(); } _imgDisplay = view.FindViewById<ImageViewAsync>(Resource.Id.imgDisplay); var urlToImage = Config.Images[_position]; ImageService.Instance.LoadUrl(urlToImage) .Retry(3, 200) .DownSample(300, 300) .Transform(new CircleTransformation()) .Transform(new GrayscaleTransformation()) .LoadingPlaceholder(Config.LoadingPlaceholderPath, ImageSource.ApplicationBundle) .ErrorPlaceholder(Config.ErrorPlaceholderPath, ImageSource.ApplicationBundle) .Into(_imgDisplay); return view; }
/// <summary> /// Loads the image into given imageView using defined parameters. /// </summary> /// <param name="parameters">Parameters for loading the image.</param> /// <param name="imageView">Image view that should receive the image.</param> public static IScheduledWork Into(this TaskParameter parameters, ImageViewAsync imageView) { var task = new ImageLoaderTask(ImageService.Config.DownloadCache, new MainThreadDispatcher(), ImageService.Config.Logger, parameters, imageView); ImageService.LoadImage(task); return task; }
private static ImageLoaderTask CreateTask(this TaskParameter parameters, ImageViewAsync imageView) { var task = new ImageLoaderTask(ImageService.Config.DownloadCache, new MainThreadDispatcher(), ImageService.Config.Logger, parameters, imageView); return task; }
/// <summary> /// Loads the image into given imageView using defined parameters. /// </summary> /// <param name="parameters">Parameters for loading the image.</param> /// <param name="imageView">Image view that should receive the image.</param> public static IScheduledWork Into(this TaskParameter parameters, ImageViewAsync imageView) { var task = CreateTask(parameters, imageView); ImageService.LoadImage(task); return task; }