예제 #1
0
        public static async Task SetImageFromUrlAsync(this ImageView imageView, string url, Context context)
        {
            if (ImagesHelper.CACHE_PATH == null)
            {
                ImagesHelper.CACHE_PATH = ContextCompat.GetExternalCacheDirs(context).First().AbsolutePath;
            }
            Android.Util.Log.Debug("sciezka", ImagesHelper.CACHE_PATH);
            var bmp = FromUrl(url);

            if (bmp == null)
            {
                return;
            }
            if (bmp.IsCompleted)
            {
                //imageView.SetImageBitmap (GetRoundedShape(bmp.Result, context));
                imageView.SetImageBitmap(bmp.Result);
            }
            else
            {
                imageView.SetImageBitmap(await bmp);
            }
            //imageView.SetImageBitmap (GetRoundedShape(await bmp, context));
        }