protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.file_detail); _userName = Intent.GetStringExtra(AppConstants.UserName); _ip = Intent.GetStringExtra(AppConstants.HostIp); _portNumber = Intent.GetIntExtra(AppConstants.PortNumber, 8080); _client = new FileSharingClient(_ip, _portNumber); _fileName = Intent.GetStringExtra(AppConstants.FileName); _image = FindViewById <MvxCachedImageView>(Resource.Id.imgMain); _image.SetImageDrawable(_fileName.HasImageExtension() ? ContextCompat.GetDrawable(Application.Context, Resource.Drawable.default_image) : ContextCompat.GetDrawable(Application.Context, Resource.Drawable.default_file)); _closeBtn = FindViewById <ImageView>(Resource.Id.closeBtn); _closeBtn.Click += CloseView; _downloadBtn = FindViewById <ImageView>(Resource.Id.downloadBtn); _downloadBtn.Click += Download; _imageData = _client.GetImage(_userName, _fileName).FileData; ImageService.Instance.LoadStream(GetStream).DownSample(500).Into(_image); }
public static void LoadImageAsync( this MvxCachedImageView imageView, string bundleResourceName, string url, TransformationBase transformationBase = null) { if (string.IsNullOrEmpty(url)) { imageView.SetImageDrawable(null); if (!string.IsNullOrEmpty(bundleResourceName)) { var loadTask = ImageService.Instance .LoadCompiledResource(bundleResourceName); if (transformationBase != null) { loadTask = loadTask.Transform(transformationBase); } loadTask.IntoAsync(imageView); } return; } var expr = ImageService.Instance.LoadUrl(url); if (!string.IsNullOrEmpty(bundleResourceName)) { expr = expr.LoadingPlaceholder(bundleResourceName, ImageSource.CompiledResource) .ErrorPlaceholder(bundleResourceName, ImageSource.CompiledResource); } if (transformationBase != null) { expr = expr.Transform(transformationBase); } expr.IntoAsync(imageView); }